diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index df90b783..30591e87 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -95,7 +95,7 @@ jobs: - name: Build example app run: | cd example - flutter build web -o ../build --no-tree-shake-icons + flutter build web -t widgetbook/main.dart -o ../build --no-tree-shake-icons - uses: FirebaseExtended/action-hosting-deploy@v0 with: repoToken: "${{ secrets.GITHUB_TOKEN }}" diff --git a/example/widgetbook/pages/assets/icon_widgetbook.dart b/example/widgetbook/pages/assets/icon_widgetbook.dart new file mode 100644 index 00000000..5894222c --- /dev/null +++ b/example/widgetbook/pages/assets/icon_widgetbook.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import 'package:widgetbook/widgetbook.dart'; +import 'package:zeta_flutter/zeta_flutter.dart'; + +import '../../test/test_components.dart'; + +WidgetbookComponent iconWidgetbook() { + return WidgetbookComponent( + isInitiallyExpanded: false, + name: 'Icons', + useCases: [ + WidgetbookUseCase( + name: 'All Icons', + builder: (context) { + List icons = (context.knobs.boolean(label: 'Rounded', initialValue: true) + ? [...iconsRounded] + : [...iconsSharp]) + ..sort((a, b) => a.codePoint < b.codePoint ? 1 : 0); + return WidgetbookTestWidget( + removeBody: true, + widget: SingleChildScrollView( + child: Wrap( + spacing: ZetaSpacing.b, + runSpacing: ZetaSpacing.b, + children: icons.map((e) => Icon(e, size: ZetaSpacing.x10)).toList(), + ), + ), + ); + }, + ), + ], + ); +} diff --git a/example/widgetbook/components/accordion_widgetbook.dart b/example/widgetbook/pages/components/accordion_widgetbook.dart similarity index 97% rename from example/widgetbook/components/accordion_widgetbook.dart rename to example/widgetbook/pages/components/accordion_widgetbook.dart index 7943cda6..d7297153 100644 --- a/example/widgetbook/components/accordion_widgetbook.dart +++ b/example/widgetbook/pages/components/accordion_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent accordionWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/avatar_widgetbook.dart b/example/widgetbook/pages/components/avatar_widgetbook.dart similarity index 98% rename from example/widgetbook/components/avatar_widgetbook.dart rename to example/widgetbook/pages/components/avatar_widgetbook.dart index e2a8d1f8..0a91e51c 100644 --- a/example/widgetbook/components/avatar_widgetbook.dart +++ b/example/widgetbook/pages/components/avatar_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent avatarWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/badges_widgetbook.dart b/example/widgetbook/pages/components/badges_widgetbook.dart similarity index 99% rename from example/widgetbook/components/badges_widgetbook.dart rename to example/widgetbook/pages/components/badges_widgetbook.dart index ce3a3562..6cdafb88 100644 --- a/example/widgetbook/components/badges_widgetbook.dart +++ b/example/widgetbook/pages/components/badges_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent badgeWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/banner_widgetbook.dart b/example/widgetbook/pages/components/banner_widgetbook.dart similarity index 98% rename from example/widgetbook/components/banner_widgetbook.dart rename to example/widgetbook/pages/components/banner_widgetbook.dart index 4bec293f..de5b538c 100644 --- a/example/widgetbook/components/banner_widgetbook.dart +++ b/example/widgetbook/pages/components/banner_widgetbook.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; -WidgetbookComponent BannerWidgetBook() { +WidgetbookComponent bannerWidgetBook() { return WidgetbookComponent( isInitiallyExpanded: false, name: 'Banners', diff --git a/example/widgetbook/components/bottom_sheet_widgetbook.dart b/example/widgetbook/pages/components/bottom_sheet_widgetbook.dart similarity index 97% rename from example/widgetbook/components/bottom_sheet_widgetbook.dart rename to example/widgetbook/pages/components/bottom_sheet_widgetbook.dart index 986796ea..a305ebcf 100644 --- a/example/widgetbook/components/bottom_sheet_widgetbook.dart +++ b/example/widgetbook/pages/components/bottom_sheet_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent bottomSheetWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/button_widgetbook.dart b/example/widgetbook/pages/components/button_widgetbook.dart similarity index 98% rename from example/widgetbook/components/button_widgetbook.dart rename to example/widgetbook/pages/components/button_widgetbook.dart index afbec8dd..74161006 100644 --- a/example/widgetbook/components/button_widgetbook.dart +++ b/example/widgetbook/pages/components/button_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent buttonWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/checkbox_widgetbook.dart b/example/widgetbook/pages/components/checkbox_widgetbook.dart similarity index 98% rename from example/widgetbook/components/checkbox_widgetbook.dart rename to example/widgetbook/pages/components/checkbox_widgetbook.dart index 38218b07..eeef1945 100644 --- a/example/widgetbook/components/checkbox_widgetbook.dart +++ b/example/widgetbook/pages/components/checkbox_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent checkboxWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/chip_widgetbook.dart b/example/widgetbook/pages/components/chip_widgetbook.dart similarity index 98% rename from example/widgetbook/components/chip_widgetbook.dart rename to example/widgetbook/pages/components/chip_widgetbook.dart index 89fc8ea3..e4f1a9f4 100644 --- a/example/widgetbook/components/chip_widgetbook.dart +++ b/example/widgetbook/pages/components/chip_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent chipWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/components/password_input_widgetbook.dart b/example/widgetbook/pages/components/password_input_widgetbook.dart similarity index 98% rename from example/widgetbook/components/password_input_widgetbook.dart rename to example/widgetbook/pages/components/password_input_widgetbook.dart index 539c2baa..eca168ef 100644 --- a/example/widgetbook/components/password_input_widgetbook.dart +++ b/example/widgetbook/pages/components/password_input_widgetbook.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import '../test/test_components.dart'; +import '../../test/test_components.dart'; WidgetbookComponent passwordInputWidgetBook() { return WidgetbookComponent( diff --git a/example/widgetbook/theme/color_widgetbook.dart b/example/widgetbook/pages/theme/color_widgetbook.dart similarity index 100% rename from example/widgetbook/theme/color_widgetbook.dart rename to example/widgetbook/pages/theme/color_widgetbook.dart diff --git a/example/widgetbook/theme/typography_widgetbook.dart b/example/widgetbook/pages/theme/typography_widgetbook.dart similarity index 63% rename from example/widgetbook/theme/typography_widgetbook.dart rename to example/widgetbook/pages/theme/typography_widgetbook.dart index dc1b8a22..6bd60751 100644 --- a/example/widgetbook/theme/typography_widgetbook.dart +++ b/example/widgetbook/pages/theme/typography_widgetbook.dart @@ -27,7 +27,7 @@ WidgetbookComponent textWidgetBook() { name: 'Typography', useCases: [ WidgetbookUseCase( - name: 'Text styles', + name: 'Individual text styles', builder: (context) => Text( context.knobs.string(label: 'Text', initialValue: 'The quick brown fox jumps over the lazy dog.'), style: context.knobs @@ -43,6 +43,29 @@ WidgetbookComponent textWidgetBook() { ), ), ), + WidgetbookUseCase( + name: 'All text styles', + builder: (context) => SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Row( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: dedicatedSizes.keys.map( + (e) { + return Text( + e, + style: dedicatedSizes[e]?.apply( + color: Zeta.of(context).colors.textDefault, + fontStyle: FontStyle.normal, + decoration: TextDecoration.none, + ), + ).paddingAll(ZetaSpacing.b); + }, + ).toList()), + ], + ), + )), ], ); } diff --git a/example/widgetbook/widgetbook.dart b/example/widgetbook/widgetbook.dart index 7d670471..b1bf2359 100644 --- a/example/widgetbook/widgetbook.dart +++ b/example/widgetbook/widgetbook.dart @@ -2,17 +2,18 @@ import 'package:flutter/material.dart'; import 'package:widgetbook/widgetbook.dart'; import 'package:zeta_flutter/zeta_flutter.dart'; -import 'components/accordion_widgetbook.dart'; -import 'components/avatar_widgetbook.dart'; -import 'components/badges_widgetbook.dart'; -import 'components/bottom_sheet_widgetbook.dart'; -import 'components/button_widgetbook.dart'; -import 'components/checkbox_widgetbook.dart'; -import 'theme/color_widgetbook.dart'; -import 'components/banner_widgetbook.dart'; -import 'components/chip_widgetbook.dart'; -import 'components/password_input_widgetbook.dart'; -import 'theme/typography_widgetbook.dart'; +import 'pages/assets/icon_widgetbook.dart'; +import 'pages/components/accordion_widgetbook.dart'; +import 'pages/components/avatar_widgetbook.dart'; +import 'pages/components/badges_widgetbook.dart'; +import 'pages/components/bottom_sheet_widgetbook.dart'; +import 'pages/components/button_widgetbook.dart'; +import 'pages/components/checkbox_widgetbook.dart'; +import 'pages/theme/color_widgetbook.dart'; +import 'pages/components/banner_widgetbook.dart'; +import 'pages/components/chip_widgetbook.dart'; +import 'pages/components/password_input_widgetbook.dart'; +import 'pages/theme/typography_widgetbook.dart'; import 'utils/zebra.dart'; class HotReload extends StatelessWidget { @@ -31,7 +32,7 @@ class HotReload extends StatelessWidget { avatarWidgetBook(), checkboxWidgetBook(), buttonWidgetBook(), - BannerWidgetBook(), + bannerWidgetBook(), accordionWidgetBook(), chipWidgetBook(), passwordInputWidgetBook(), @@ -43,6 +44,11 @@ class HotReload extends StatelessWidget { isInitiallyExpanded: false, children: [textWidgetBook(), colorWidgetBook()]..sort((a, b) => a.name.compareTo(b.name)), ), + WidgetbookCategory( + name: 'Assets', + isInitiallyExpanded: true, + children: [iconWidgetbook()]..sort((a, b) => a.name.compareTo(b.name)), + ), ], addons: [ DeviceFrameAddon(