Skip to content

Commit

Permalink
deps: Update zeta-icon library (#107)
Browse files Browse the repository at this point in the history
ci: check secrets (#54)
ci: fix token

---------

Co-authored-by: zeta-icons-bot <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: mikecoomber <[email protected]>
  • Loading branch information
4 people authored Jun 19, 2024
1 parent 7358467 commit ccaf8a9
Show file tree
Hide file tree
Showing 9 changed files with 2,195 additions and 2,205 deletions.
7 changes: 5 additions & 2 deletions example/lib/pages/assets/icons_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ class _IconsExampleState extends State<IconsExample> {
Wrap(
spacing: 8,
runSpacing: 8,
children: iconsRound.values.map((e) => Icon(e)).toList(),
children: icons.values.map((e) => Icon(e)).toList(),
),
const SizedBox(height: 20),
Text('Sharp', style: ZetaTextStyles.bodyLarge),
Wrap(
spacing: 8,
runSpacing: 8,
children: iconsSharp.values.map((e) => Icon(e)).toList(),
children: icons.values
.map((e) =>
Icon(IconData(e.codePoint, fontFamily: ZetaIcons.familySharp, fontPackage: ZetaIcons.package)))
.toList(),
),
],
),
Expand Down
4 changes: 2 additions & 2 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399

Expand Down
1 change: 0 additions & 1 deletion example/widgetbook/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ class _HotReloadState extends State<HotReload> {
WidgetbookUseCase(name: 'Bottom Sheet', builder: (context) => bottomSheetContentUseCase(context)),
WidgetbookUseCase(name: 'BreadCrumbs', builder: (context) => breadCrumbsUseCase(context)),
WidgetbookUseCase(name: 'Checkbox', builder: (context) => checkboxUseCase(context)),
WidgetbookUseCase(name: 'Bottom Sheet', builder: (context) => bottomSheetContentUseCase(context)),
WidgetbookUseCase(name: 'Date Input', builder: (context) => dateInputUseCase(context)),
WidgetbookUseCase(name: 'Dial Pad', builder: (context) => dialPadUseCase(context)),
WidgetbookUseCase(name: 'Dialog', builder: (context) => dialogUseCase(context)),
Expand Down
29 changes: 17 additions & 12 deletions example/widgetbook/pages/assets/icon_widgetbook.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@ import 'package:zeta_flutter/zeta_flutter.dart';
import '../../test/test_components.dart';

Widget iconsUseCase(BuildContext context) {
Map<String, IconData> icons =
((context.knobs.boolean(label: 'Rounded', initialValue: true)) ? iconsRound : iconsSharp);

final Map<String, IconData> sortedIcons = Map.fromEntries(icons.entries.toList()
..sort((a, b) {
final _a = (a.key.split('_')..removeLast()).join();
final _b = (b.key.split('_')..removeLast()).join();
return _a.compareTo(_b);
}));
bool rounded = context.knobs.boolean(label: 'Rounded', initialValue: true);

return WidgetbookTestWidget(
removeBody: true,
Expand All @@ -28,9 +20,9 @@ Widget iconsUseCase(BuildContext context) {
Wrap(
spacing: ZetaSpacing.xl_4,
runSpacing: ZetaSpacing.xl_4,
children: sortedIcons.entries.map(
children: icons.entries.map(
(e) {
final nameArr = (e.key.split('_')..removeLast()).join(' ').capitalize();
final nameArr = (e.key.split('_')).join(' ').capitalize();
return Container(
width: 120,
height: 120,
Expand All @@ -47,7 +39,20 @@ Widget iconsUseCase(BuildContext context) {
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [Icon(e.value, size: ZetaSpacing.xl_6), Text(nameArr, textAlign: TextAlign.center)],
children: [
Icon(
IconData(
e.value.codePoint,
fontFamily: rounded ? ZetaIcons.familyRound : ZetaIcons.familySharp,
fontPackage: ZetaIcons.package,
),
size: ZetaSpacing.xl_6,
),
Text(
nameArr,
textAlign: TextAlign.center,
)
],
),
),
);
Expand Down
21 changes: 8 additions & 13 deletions example/widgetbook/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ import 'package:flutter/material.dart';
import 'package:widgetbook/widgetbook.dart';
import 'package:zeta_flutter/zeta_flutter.dart';

String iconLabelBuilder(IconData? value, [bool rounded = true]) {
return ((rounded
? iconsRound.entries.firstWhere((element) => element.value == value)
: iconsSharp.entries.firstWhere((element) => element.value == value))
.key
.split('.')
.last
.split('_')
..removeLast())
.join(' ');
String iconLabelBuilder(int? codePoint, [bool rounded = true]) {
return icons.entries.firstWhere((element) => element.value.codePoint == codePoint).key.split('_').join(' ');
}

List<IconData> iconOptions(rounded) => rounded ? iconsRound.values.toList() : iconsSharp.values.toList();
List<IconData> iconOptions(rounded) => icons.values
.map((e) => IconData(e.codePoint,
fontFamily: rounded ? ZetaIcons.familyRound : ZetaIcons.familySharp, fontPackage: ZetaIcons.package))
.toList();

String enumLabelBuilder(Enum? value) => value?.name.split('.').last.capitalize() ?? '';

Expand All @@ -29,13 +24,13 @@ IconData? iconKnob(
? context.knobs.listOrNull(
label: name,
options: iconOptions(rounded),
labelBuilder: (value) => iconLabelBuilder(value, rounded),
labelBuilder: (value) => iconLabelBuilder(value?.codePoint, rounded),
initialOption: initial,
)
: context.knobs.list(
label: name,
options: iconOptions(rounded),
labelBuilder: (value) => iconLabelBuilder(value, rounded),
labelBuilder: (value) => iconLabelBuilder(value?.codePoint, rounded),
initialOption: initial,
);
}
Expand Down
Binary file modified lib/src/assets/fonts/zeta-icons-round.ttf
Binary file not shown.
Binary file modified lib/src/assets/fonts/zeta-icons-sharp.ttf
Binary file not shown.
Loading

0 comments on commit ccaf8a9

Please sign in to comment.