From 785601bb9a739cffa0de2e3147c5ffd2c56b6183 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 4 Jul 2024 15:30:28 +0100 Subject: [PATCH] Update to zeta_flutter 0.14.0 --- analysis_options.yaml | 1 + lib/main.dart | 31 ++++---------------- lib/src/pages/example.dart | 58 +++++++++++++++++++------------------- lib/src/pages/home.dart | 2 +- pubspec.yaml | 4 +-- 5 files changed, 38 insertions(+), 58 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 88e127a..1a0d4fd 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -21,6 +21,7 @@ linter: # producing the lint. rules: public_member_api_docs: false + flutter_style_todos: false # avoid_print: false # Uncomment to disable the `avoid_print` rule # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule # Additional information about this file can be found at diff --git a/lib/main.dart b/lib/main.dart index 88ef77d..cb59c45 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,35 +18,14 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { @override Widget build(BuildContext _) { - return ZetaProvider( - initialThemeData: ZetaThemeData( - colorsDark: ZetaColors.dark( - // TODO(Theme): Add custom color pallete - ), - colorsLight: ZetaColors.light( - // TODO(Theme): Add custom color pallete - ), - ), - builder: (context, themeData, themeMode) { - final dark = themeData.colorsDark.toScheme(); - final light = themeData.colorsLight.toScheme(); + return ZetaProvider.base( + //TODO: Add custom colors, fonts, etc. + builder: (context, lightTheme, darkTheme, themeMode) { return MaterialApp.router( routerConfig: goRouter, themeMode: themeMode, - theme: ThemeData( - useMaterial3: true, - fontFamily: themeData.fontFamily, - scaffoldBackgroundColor: light.surfaceTertiary, - colorScheme: light, - textTheme: zetaTextTheme, - ), - darkTheme: ThemeData( - useMaterial3: true, - fontFamily: themeData.fontFamily, - scaffoldBackgroundColor: dark.surfaceTertiary, - colorScheme: dark, - textTheme: zetaTextTheme, - ), + theme: lightTheme, + darkTheme: darkTheme, ); }, ); diff --git a/lib/src/pages/example.dart b/lib/src/pages/example.dart index b6b9787..75c7fb3 100644 --- a/lib/src/pages/example.dart +++ b/lib/src/pages/example.dart @@ -34,15 +34,15 @@ class _ExamplePageState extends State { child: Row( children: const [ ZetaStatusLabel(label: 'Status label'), - ZetaPriorityPill(priority: 'Priority Pill'), - ZetaBadge(label: 'Badge'), + ZetaPriorityPill(label: 'Priority Pill'), + ZetaLabel(label: 'Label'), ZetaIndicator.icon(), ZetaIndicator.notification(), ZetaTag.left(label: 'Tag'), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), - ZetaSystemBanner(context: context, title: 'Banner'), + ZetaBanner(context: context, title: 'Banner'), ZetaBreadCrumbs( children: [ ZetaBreadCrumb(label: 'BreadCrumb', onPressed: () {}), @@ -93,8 +93,8 @@ class _ExamplePageState extends State { rounded: true, isLarge: true, ), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), SingleChildScrollView( scrollDirection: Axis.horizontal, @@ -120,8 +120,8 @@ class _ExamplePageState extends State { checked = b ?? false; }), ), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), Column( children: [ @@ -135,8 +135,8 @@ class _ExamplePageState extends State { leading: ZetaAvatar(initials: 'AZ', size: ZetaAvatarSize.xxxs), ), const ZetaAssistChip(label: 'Assist Chip', leading: Icon(ZetaIcons.star_round)), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), ZetaFilterSelection( items: List.generate(10, (e) => e).map((e) => ZetaFilterChip(label: 'Filter Chip ${e + 1}')).toList(), @@ -145,6 +145,7 @@ class _ExamplePageState extends State { ), const ZetaDialPad(), ZetaDropdown( + onChange: (value) {}, items: [ ZetaDropdownItem(value: 'Dropdown item', icon: const Icon(ZetaIcons.add_box_sharp)), ZetaDropdownItem(value: 'Dropdown item 2', icon: const Icon(ZetaIcons.activity_round)), @@ -164,8 +165,7 @@ class _ExamplePageState extends State { Column( children: [ ZetaListItem( - title: const Text('List Item'), - selected: checked, + primaryText: 'List Item', onTap: () => setState(() { checked = !checked; }), @@ -184,12 +184,12 @@ class _ExamplePageState extends State { count: 19, enabledNotificationIcon: true, enabledWarningIcon: true, - onCallTap: () {}, - onDeleteTap: () {}, - onMenuMoreTap: () {}, - onPttTap: () {}, onTap: () {}, time: DateTime.now(), + slidableActions: [ + ZetaSlidableAction.call(onPressed: () {}), + ZetaSlidableAction.delete(onPressed: () {}), + ], ), ], ), @@ -203,21 +203,21 @@ class _ExamplePageState extends State { const SizedBox(width: 250, child: ZetaPhoneInput(label: 'Phone Input')), const SizedBox(width: 250, child: ZetaTimeInput(label: 'Phone Input')), const SizedBox(width: 250, child: ZetaTextInput(label: 'Phone Input')), - const SizedBox( + SizedBox( width: 250, child: ZetaSelectInput( - label: Text('Select Input'), + label: 'Select Input', items: [ - ZetaSelectInputItem(value: 'Item 1'), - ZetaSelectInputItem(value: 'Item 2'), - ZetaSelectInputItem(value: 'Item 3'), - ZetaSelectInputItem(value: 'Item 4'), - ZetaSelectInputItem(value: 'Item 5'), + ZetaDropdownItem(value: 'Item 1'), + ZetaDropdownItem(value: 'Item 2'), + ZetaDropdownItem(value: 'Item 3'), + ZetaDropdownItem(value: 'Item 4'), + ZetaDropdownItem(value: 'Item 5'), ], ), ), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), SingleChildScrollView( scrollDirection: Axis.horizontal, @@ -230,8 +230,8 @@ class _ExamplePageState extends State { const SizedBox(width: 250, child: ZetaProgressBar(progress: 1, type: ZetaProgressBarType.buffering)), const SizedBox(width: 250, child: ZetaProgressBar(progress: 1, type: ZetaProgressBarType.standard)), const ZetaProgressCircle(progress: 1, size: ZetaCircleSizes.s), - ].gap(ZetaSpacing.m), - ).paddingHorizontal(ZetaSpacing.m), + ].gap(ZetaSpacing.xl_2), + ).paddingHorizontal(ZetaSpacing.xl_2), ), ZetaScreenHeaderBar( actionButtonLabel: 'Action', @@ -275,7 +275,7 @@ class _ExamplePageState extends State { ), const ZetaTooltip(child: Text('Tooltip')), const SizedBox(height: 100), - ].gap(ZetaSpacing.xxl), + ].gap(ZetaSpacing.xl_10), ), ); } diff --git a/lib/src/pages/home.dart b/lib/src/pages/home.dart index 866909f..86655ed 100644 --- a/lib/src/pages/home.dart +++ b/lib/src/pages/home.dart @@ -7,7 +7,7 @@ class HomePage extends StatelessWidget { @override Widget build(BuildContext context) { return const Padding( - padding: EdgeInsets.all(ZetaSpacing.m), + padding: EdgeInsets.all(ZetaSpacing.xl_2), child: Column( children: [ ZetaInPageBanner( diff --git a/pubspec.yaml b/pubspec.yaml index e977ddd..b4926c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,8 +30,8 @@ environment: dependencies: flutter: sdk: flutter - go_router: ^14.1.3 - zeta_flutter: ^0.10.0 + go_router: ^14.2.0 + zeta_flutter: ^0.14.0 dev_dependencies: flutter_test: