diff --git a/example/lib/src/component_library/components/pagination/pagination_library_item.dart b/example/lib/src/component_library/components/pagination/pagination_library_item.dart index 3f60b008..05df579b 100644 --- a/example/lib/src/component_library/components/pagination/pagination_library_item.dart +++ b/example/lib/src/component_library/components/pagination/pagination_library_item.dart @@ -21,14 +21,17 @@ class PaginationLibraryInputs extends ComponentLibraryInputs { final ComponentLibraryIntInput page = ComponentLibraryIntInput( 'Page', initialValue: 1, + min: 1, ); final ComponentLibraryIntInput amountOfItems = ComponentLibraryIntInput( 'amountOfItems', initialValue: 55, + min: 1, ); final ComponentLibraryIntInput itemsPerPage = ComponentLibraryIntInput( 'itemsPerPage', initialValue: 10, + min: 1, ); @override List buildInputItems() => [ diff --git a/example/lib/src/component_library/components/pagination/pagination_library_variant.dart b/example/lib/src/component_library/components/pagination/pagination_library_variant.dart index c4c8dcc5..40c4a03f 100644 --- a/example/lib/src/component_library/components/pagination/pagination_library_variant.dart +++ b/example/lib/src/component_library/components/pagination/pagination_library_variant.dart @@ -3,19 +3,21 @@ import 'package:impaktfull_ui_2/impaktfull_ui.dart'; import 'package:impaktfull_ui_example/src/component_library/components/pagination/pagination_library_item.dart'; import 'package:impaktfull_ui_example/src/component_library/config/component_library_item.dart'; -class PaginationLibraryVariant extends ComponentLibraryVariant { +class PaginationLibraryVariant + extends ComponentLibraryVariant { const PaginationLibraryVariant(); @override String get title => 'Default'; @override - List build(BuildContext context, PaginationLibraryPrimaryInputs inputs) { + List build( + BuildContext context, PaginationLibraryPrimaryInputs inputs) { return [ ImpaktfullUiPagination( - amountOfItems: inputs.amountOfItems.value ?? 0, - itemsPerPage: inputs.itemsPerPage.value ?? 0, - page: inputs.page.value ?? 0, + amountOfItems: inputs.amountOfItems.value ?? 1, + itemsPerPage: inputs.itemsPerPage.value ?? 1, + page: inputs.page.value ?? 1, onLoadPage: (page) { inputs.page.updateState(page); ImpaktfullUiNotification.show(title: 'Load page $page'); diff --git a/example/lib/src/component_library/components/sidebar_navigation/sidebar_navigation_library_variant.dart b/example/lib/src/component_library/components/sidebar_navigation/sidebar_navigation_library_variant.dart index a8478067..4cfdbe0f 100644 --- a/example/lib/src/component_library/components/sidebar_navigation/sidebar_navigation_library_variant.dart +++ b/example/lib/src/component_library/components/sidebar_navigation/sidebar_navigation_library_variant.dart @@ -5,14 +5,16 @@ import 'package:impaktfull_ui_example/src/component_library/config/component_lib import 'package:impaktfull_ui_example/src/util/network_images.dart'; import 'package:impaktfull_ui_example/src/widget/components/components_library_variant_descriptor.dart'; -class SidebarNavigationLibraryVariant extends ComponentLibraryVariant { +class SidebarNavigationLibraryVariant + extends ComponentLibraryVariant { const SidebarNavigationLibraryVariant(); @override String get title => 'Default'; @override - List build(BuildContext context, SidebarNavigationLibraryPrimaryInputs inputs) { + List build( + BuildContext context, SidebarNavigationLibraryPrimaryInputs inputs) { return [ ComponentsLibraryVariantDescriptor( height: 250, @@ -68,7 +70,8 @@ class SidebarNavigationLibraryVariant extends ComponentLibraryVariant index) + secondaryItems: List.generate( + inputs.amountOfSecondaryItems.value ?? 0, (index) => index) .map( (index) => ImpaktfullUiSidebarNavigationItem( leading: theme.assets.icons.confetti, @@ -102,7 +105,9 @@ class SidebarNavigationLibraryVariant extends ComponentLibraryVariant const SizedBox(width: 40), - borderRadius: ImpaktfullUiSidebarNavigationItemTheme.of(context).dimens.borderRadius, + borderRadius: ImpaktfullUiSidebarNavigationItemTheme.of(context) + .dimens + .borderRadius, padding: const EdgeInsets.symmetric( horizontal: 12, vertical: 8, @@ -118,7 +123,8 @@ class SidebarNavigationLibraryVariant extends ComponentLibraryVariant ImpaktfullUiNotification.show(title: 'Logout tapped'), + onTap: () => + ImpaktfullUiNotification.show(title: 'Logout tapped'), ), ), ], @@ -129,7 +135,9 @@ class SidebarNavigationLibraryVariant extends ComponentLibraryVariant SidebarNavigationLibraryPrimaryInputs(); + SidebarNavigationLibraryPrimaryInputs inputs() => + SidebarNavigationLibraryPrimaryInputs(); } -class SidebarNavigationLibraryPrimaryInputs extends SidebarNavigationLibraryInputs {} +class SidebarNavigationLibraryPrimaryInputs + extends SidebarNavigationLibraryInputs {} diff --git a/lib/src/components/button/button.dart b/lib/src/components/button/button.dart index b1b8bfbd..ae3c9fda 100644 --- a/lib/src/components/button/button.dart +++ b/lib/src/components/button/button.dart @@ -88,7 +88,9 @@ class _ImpaktfullUiButtonState extends State { child: Padding( padding: _getPadding(componentTheme), child: ImpaktfullUiAutoLayout.horizontal( - mainAxisSize: widget.fullWidth ? MainAxisSize.max : MainAxisSize.min, + mainAxisSize: widget.fullWidth + ? MainAxisSize.max + : MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, spacing: 4, children: [ @@ -131,7 +133,8 @@ class _ImpaktfullUiButtonState extends State { duration: theme.durations.short, curve: Curves.easeInOut, child: ImpaktfullUiAutoLayout.horizontal( - mainAxisSize: widget.fullWidth ? MainAxisSize.max : MainAxisSize.min, + mainAxisSize: + widget.fullWidth ? MainAxisSize.max : MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, spacing: 4, children: [ @@ -139,7 +142,9 @@ class _ImpaktfullUiButtonState extends State { flex: widget.fullWidth ? 1 : 0, child: SizedBox( height: _getLoadingSize(), - child: _isLoading ? ImpaktfullUiLoadingIndicator(color: color) : const SizedBox(), + child: _isLoading + ? ImpaktfullUiLoadingIndicator(color: color) + : const SizedBox(), ), ), ], diff --git a/lib/src/components/pagination/pagination.dart b/lib/src/components/pagination/pagination.dart index 0f7b03e3..2be8ac30 100644 --- a/lib/src/components/pagination/pagination.dart +++ b/lib/src/components/pagination/pagination.dart @@ -9,7 +9,8 @@ export 'pagination_style.dart'; part 'pagination.describe.dart'; -class ImpaktfullUiPagination extends StatelessWidget with ComponentDescriptorMixin { +class ImpaktfullUiPagination extends StatelessWidget + with ComponentDescriptorMixin { final int page; final int itemsPerPage; final int amountOfItems; @@ -17,7 +18,7 @@ class ImpaktfullUiPagination extends StatelessWidget with ComponentDescriptorMix final ImpaktfullUiPaginationTheme? theme; int get amountOfPages => (amountOfItems / itemsPerPage).ceil(); - bool get isFinalPage => page == amountOfPages; + bool get isFinalPage => page >= amountOfPages; const ImpaktfullUiPagination({ required this.page, @@ -32,7 +33,8 @@ class ImpaktfullUiPagination extends StatelessWidget with ComponentDescriptorMix Widget build(BuildContext context) { return ImpaktfullUiComponentThemeBuidler( overrideComponentTheme: theme, - builder: (context, theme, componentTheme) => ImpaktfullUiAutoLayout.horizontal( + builder: (context, theme, componentTheme) => + ImpaktfullUiAutoLayout.horizontal( spacing: 8, crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/src/components/pagination/pagination.describe.dart b/lib/src/components/pagination/pagination.describe.dart index 61e33c83..2356935e 100644 --- a/lib/src/components/pagination/pagination.describe.dart +++ b/lib/src/components/pagination/pagination.describe.dart @@ -1,7 +1,8 @@ part of 'pagination.dart'; -String _describeInstance(BuildContext context, ImpaktfullUiPagination instance) { +String _describeInstance( + BuildContext context, ImpaktfullUiPagination instance) { final descriptor = ComponentDescriptor(); descriptor.add('theme', instance.theme); return descriptor.describe(); -} \ No newline at end of file +} diff --git a/lib/src/components/pagination/pagination_style.dart b/lib/src/components/pagination/pagination_style.dart index dde5e27b..0966ac78 100644 --- a/lib/src/components/pagination/pagination_style.dart +++ b/lib/src/components/pagination/pagination_style.dart @@ -15,7 +15,8 @@ class ImpaktfullUiPaginationTheme extends ImpaktfullUiComponentTheme { required this.textStyles, }); - static ImpaktfullUiPaginationTheme of(BuildContext context) => ImpaktfullUiTheme.of(context).components.pagination; + static ImpaktfullUiPaginationTheme of(BuildContext context) => + ImpaktfullUiTheme.of(context).components.pagination; } class ImpaktfullUiPaginationAssetsTheme { diff --git a/lib/src/theme/asset_theme.dart b/lib/src/theme/asset_theme.dart index 6c8384b7..127bd11f 100644 --- a/lib/src/theme/asset_theme.dart +++ b/lib/src/theme/asset_theme.dart @@ -52,7 +52,8 @@ class ImpaktfullUiAssetTheme { error: ImpaktfullUiAsset.icon(PhosphorIcons.warningDiamond()), home: ImpaktfullUiAsset.icon(PhosphorIcons.houseSimple()), info: ImpaktfullUiAsset.icon(PhosphorIcons.info()), - lineVertical: ImpaktfullUiAsset.icon(PhosphorIcons.lineVertical()), + lineVertical: + ImpaktfullUiAsset.icon(PhosphorIcons.lineVertical()), list: ImpaktfullUiAsset.icon(PhosphorIcons.list()), logout: ImpaktfullUiAsset.icon(PhosphorIcons.signOut()), minus: ImpaktfullUiAsset.icon(PhosphorIcons.minus()), diff --git a/lib/src/theme/component_theme.dart b/lib/src/theme/component_theme.dart index 72522328..4e6e04e3 100644 --- a/lib/src/theme/component_theme.dart +++ b/lib/src/theme/component_theme.dart @@ -182,7 +182,8 @@ class ImpaktfullUiComponentsTheme { pagination: pagination ?? this.pagination, refreshIndicator: refreshIndicator ?? this.refreshIndicator, sidebarNavigation: sidebarNavigation ?? this.sidebarNavigation, - sidebarNavigationItem: sidebarNavigationItem ?? this.sidebarNavigationItem, + sidebarNavigationItem: + sidebarNavigationItem ?? this.sidebarNavigationItem, simpleListItem: simpleListItem ?? this.simpleListItem, snackyConfigurator: snackyConfigurator ?? this.snackyConfigurator, switchTheme: switchTheme ?? this.switchTheme, @@ -243,7 +244,7 @@ class ImpaktfullUiComponentsTheme { return ImpaktfullUiNotificationBadgeTheme.of(context) as T; } else if (T == ImpaktfullUiPaginationTheme) { return ImpaktfullUiPaginationTheme.of(context) as T; - } else if (T == ImpaktfullUiRefreshIndicatorTheme) { + } else if (T == ImpaktfullUiRefreshIndicatorTheme) { return ImpaktfullUiRefreshIndicatorTheme.of(context) as T; } else if (T == ImpaktfullUiSidebarNavigationTheme) { return ImpaktfullUiSidebarNavigationTheme.of(context) as T; diff --git a/lib/src/theme/theme_default.dart b/lib/src/theme/theme_default.dart index 56171410..ac8668fb 100644 --- a/lib/src/theme/theme_default.dart +++ b/lib/src/theme/theme_default.dart @@ -94,11 +94,13 @@ class DefaultTheme { destructive: destructive ?? const Color(0xFFBD0D00), ); final dimens = ImpaktfullUiDimensTheme( - borderRadiusExtraSmall: borderRadiusExtraSmall ?? BorderRadius.circular(4), + borderRadiusExtraSmall: + borderRadiusExtraSmall ?? BorderRadius.circular(4), borderRadiusSmall: borderRadiusSmall ?? BorderRadius.circular(6), borderRadius: borderRadiusSmall ?? BorderRadius.circular(8), borderRadiusLarge: borderRadiusLarge ?? BorderRadius.circular(12), - borderRadiusExtraLarge: borderRadiusExtraLarge ?? BorderRadius.circular(16), + borderRadiusExtraLarge: + borderRadiusExtraLarge ?? BorderRadius.circular(16), borderRadiusCircle: BorderRadius.circular(99999999), ); final textStyles = ImpaktfullUiTextStylesTheme( @@ -256,7 +258,8 @@ class DefaultTheme { alternative: textStyles.onCardPrimary.text.small.bold, grey: textStyles.onCard.text.small.bold, destructivePrimary: textStyles.onDestructive.text.small.bold, - destructiveAlternative: textStyles.onCardDestructive.text.small.bold, + destructiveAlternative: + textStyles.onCardDestructive.text.small.bold, ), ), card: ImpaktfullUiCardTheme( @@ -375,8 +378,9 @@ class DefaultTheme { ), textStyles: ImpaktfullUiInputFieldTextStylesTheme( text: textStyles.onCard.text.medium, - hint: textStyles.onCardSecondary.text.medium - .copyWith(color: textStyles.onCardTertiary.text.medium.color?.withOpacity(0.5)), + hint: textStyles.onCardSecondary.text.medium.copyWith( + color: textStyles.onCardTertiary.text.medium.color + ?.withOpacity(0.5)), label: textStyles.onCard.text.small.medium, ), ), @@ -487,7 +491,8 @@ class DefaultTheme { ), ), refreshIndicator: ImpaktfullUiRefreshIndicatorTheme( - colors: ImpaktfullUiRefreshIndicatorColorTheme(loadingIndicator: colors.accent), + colors: ImpaktfullUiRefreshIndicatorColorTheme( + loadingIndicator: colors.accent), ), sidebarNavigation: ImpaktfullUiSidebarNavigationTheme( assets: const ImpaktfullUiSidebarNavigationAssetsTheme(),