Skip to content

Commit

Permalink
fix: [MDS-756] Use moon_flutter_icons package for icons (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kypsis authored Oct 18, 2023
1 parent d9cda0c commit 78d7735
Show file tree
Hide file tree
Showing 32 changed files with 1,230 additions and 19,869 deletions.
2,338 changes: 0 additions & 2,338 deletions example/lib/src/storybook/common/icons/icons_list.dart

This file was deleted.

1,170 changes: 1,170 additions & 0 deletions example/lib/src/storybook/common/icons_map.dart

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/accordion.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

enum AccordionItems { first, second }
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/alert.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool showAlert = true;
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/bottom_sheet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class BottomSheetStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class ButtonStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/carousel.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

int selectedDot = 0;
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/chip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class ChipStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/dropdown.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';

import 'package:storybook_flutter/storybook_flutter.dart';

Expand Down
37 changes: 23 additions & 14 deletions example/lib/src/storybook/stories/icons.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:example/src/storybook/common/icons/icons_list.dart';
import 'dart:ui';

import 'package:example/src/storybook/common/icons_map.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
Expand All @@ -9,14 +11,23 @@ class IconsStory extends Story {
: super(
name: "Icons",
builder: (BuildContext context) {
final ScrollBehavior scrollBehaviour = ScrollConfiguration.of(context).copyWith(
scrollbars: false,
overscroll: false,
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
);

return CustomScrollView(
scrollBehavior: scrollBehaviour,
slivers: [
SliverPadding(
padding: const EdgeInsets.symmetric(vertical: 64),
sliver: _IconsGridWithTitle(
title: "MoonIcons",
iconsList: iconsList,
iconsNameList: iconsNameList,
iconsMap: iconsMap,
),
),
],
Expand All @@ -27,13 +38,11 @@ class IconsStory extends Story {

class _IconsGridWithTitle extends StatelessWidget {
final String title;
final List<IconData> iconsList;
final List<String> iconsNameList;
final Map<String, IconData> iconsMap;

const _IconsGridWithTitle({
required this.title,
required this.iconsList,
required this.iconsNameList,
required this.iconsMap,
});

@override
Expand All @@ -48,7 +57,7 @@ class _IconsGridWithTitle extends StatelessWidget {
),
),
SliverGrid.builder(
itemCount: iconsList.length,
itemCount: iconsMap.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 8,
Expand All @@ -59,15 +68,15 @@ class _IconsGridWithTitle extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (iconsNameList[index].contains("16"))
MoonIcon(iconsList[index], size: 16)
else if (iconsNameList[index].contains("24"))
MoonIcon(iconsList[index], size: 24)
if (iconsMap.keys.toList()[index].contains("16"))
MoonIcon(iconsMap.values.toList()[index], size: 16)
else if (iconsMap.keys.toList()[index].contains("24"))
MoonIcon(iconsMap.values.toList()[index], size: 24)
else
MoonIcon(iconsList[index], size: 32),
MoonIcon(iconsMap.values.toList()[index], size: 32),
const SizedBox(height: 20),
Text(
iconsNameList[index],
iconsMap.keys.toList()[index],
style: TextStyle(
fontSize: 10,
color: context.moonColors!.trunks,
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool? checkboxIsSelected = false;
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/popover.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool show = false;
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/segmented_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class SegmentedControlStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool value = false;
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class TabBarStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/tag.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class TagStory extends Story {
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/text_input.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

TextEditingController _textController = TextEditingController();
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/text_input_group.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

TextEditingController _textController = TextEditingController();
Expand Down
6 changes: 5 additions & 1 deletion example/lib/src/storybook/stories/toast.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:example/src/storybook/common/color_options.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class ToastStory extends Story {
Expand Down Expand Up @@ -132,7 +133,10 @@ class ToastStory extends Story {
displayDuration: displayDurationKnob != null ? Duration(seconds: displayDurationKnob) : null,
borderRadius:
borderRadiusKnob != null ? BorderRadius.circular(borderRadiusKnob.toDouble()) : null,
leading: MoonIcon(MoonIcons.info_24, color: iconColor),
leading: MoonIcon(
MoonIcons.info_24,
color: iconColor,
),
title: Text(
customLabelTextKnob,
style: TextStyle(color: textColor),
Expand Down
1 change: 1 addition & 0 deletions example/lib/src/storybook/stories/tooltip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:example/src/storybook/common/color_options.dart';
import 'package:example/src/storybook/common/widgets/text_divider.dart';
import 'package:flutter/material.dart';
import 'package:moon_design/moon_design.dart';
import 'package:moon_icons/moon_icons.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

bool showOnTap = false;
Expand Down
9 changes: 5 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ dependencies:
flutter_svg: ^2.0.1
moon_design:
path: ../
moon_icons: any
package_info_plus: ^3.0.2
storybook_flutter:
git:
url: https://github.com/coingaming/storybook_flutter.git
path: packages/storybook_flutter
dev_dependencies:
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
lint: ^2.1.2
storybook_flutter:
git:
url: https://github.com/coingaming/storybook_flutter.git
path: packages/storybook_flutter
flutter:
uses-material-design: true
fonts:
Expand Down
Binary file removed fonts/MoonIcons.ttf
Binary file not shown.
Loading

0 comments on commit 78d7735

Please sign in to comment.