From d37689e8551799e49754dec8d58f265bf712626d Mon Sep 17 00:00:00 2001 From: mike doornenbal Date: Tue, 2 Jul 2024 10:07:57 +0200 Subject: [PATCH] fix: button styling --- .../order_detail_configuration.dart | 6 +-- .../product_page_configuration.dart | 40 +++++++++------- .../widgets/default_order_succes_widget.dart | 31 +++++++++--- .../lib/src/widgets/shopping_cart_screen.dart | 47 +++++++++---------- 4 files changed, 71 insertions(+), 53 deletions(-) diff --git a/packages/flutter_order_details/lib/src/configuration/order_detail_configuration.dart b/packages/flutter_order_details/lib/src/configuration/order_detail_configuration.dart index 870d5cb..ab0d019 100644 --- a/packages/flutter_order_details/lib/src/configuration/order_detail_configuration.dart +++ b/packages/flutter_order_details/lib/src/configuration/order_detail_configuration.dart @@ -69,12 +69,12 @@ Widget _defaultNextButtonBuilder( "Choose date and time", "Next", "Next", - "Place another order", ]; + return Align( alignment: Alignment.bottomCenter, child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 48, vertical: 48), + padding: const EdgeInsets.symmetric(horizontal: 60, vertical: 32), child: SizedBox( width: double.infinity, child: FilledButton( @@ -90,7 +90,7 @@ Widget _defaultNextButtonBuilder( child: Padding( padding: const EdgeInsets.symmetric( horizontal: 16.0, - vertical: 8.0, + vertical: 12, ), child: Text( nextButtonTexts[currentStep], diff --git a/packages/flutter_product_page/lib/src/configuration/product_page_configuration.dart b/packages/flutter_product_page/lib/src/configuration/product_page_configuration.dart index 1d469d4..d3f440c 100644 --- a/packages/flutter_product_page/lib/src/configuration/product_page_configuration.dart +++ b/packages/flutter_product_page/lib/src/configuration/product_page_configuration.dart @@ -219,23 +219,29 @@ Widget _defaultNavigateToShoppingCartBuilder( return ListenableBuilder( listenable: notifier, - builder: (context, widget) => FilledButton( - onPressed: configuration.getProductsInShoppingCart?.call() != 0 - ? configuration.onNavigateToShoppingCart - : null, - style: theme.filledButtonTheme.style?.copyWith( - backgroundColor: WidgetStateProperty.all( - theme.colorScheme.primary, - ), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 8.0, - ), - child: Text( - configuration.localizations.navigateToShoppingCart, - style: theme.textTheme.displayLarge, + builder: (context, widget) => Padding( + padding: const EdgeInsets.symmetric(horizontal: 60), + child: SizedBox( + width: double.infinity, + child: FilledButton( + onPressed: configuration.getProductsInShoppingCart?.call() != 0 + ? configuration.onNavigateToShoppingCart + : null, + style: theme.filledButtonTheme.style?.copyWith( + backgroundColor: WidgetStateProperty.all( + theme.colorScheme.primary, + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 12, + ), + child: Text( + configuration.localizations.navigateToShoppingCart, + style: theme.textTheme.displayLarge, + ), + ), ), ), ), diff --git a/packages/flutter_shopping/lib/src/widgets/default_order_succes_widget.dart b/packages/flutter_shopping/lib/src/widgets/default_order_succes_widget.dart index b754054..d0b3cb2 100644 --- a/packages/flutter_shopping/lib/src/widgets/default_order_succes_widget.dart +++ b/packages/flutter_shopping/lib/src/widgets/default_order_succes_widget.dart @@ -92,13 +92,30 @@ class DefaultOrderSucces extends StatelessWidget { ), ), const Spacer(), - FilledButton( - onPressed: () { - configuration.onCompleteUserStory.call(context); - }, - child: Text( - "Place another order", - style: theme.textTheme.displayLarge, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 60), + child: SizedBox( + width: double.infinity, + child: FilledButton( + onPressed: () async { + configuration.onCompleteUserStory.call(context); + }, + style: theme.filledButtonTheme.style?.copyWith( + backgroundColor: WidgetStateProperty.all( + theme.colorScheme.primary, + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 12, + ), + child: Text( + "Place another order", + style: theme.textTheme.displayLarge, + ), + ), + ), ), ), ], diff --git a/packages/flutter_shopping_cart/lib/src/widgets/shopping_cart_screen.dart b/packages/flutter_shopping_cart/lib/src/widgets/shopping_cart_screen.dart index faa4ee9..4ffb093 100644 --- a/packages/flutter_shopping_cart/lib/src/widgets/shopping_cart_screen.dart +++ b/packages/flutter_shopping_cart/lib/src/widgets/shopping_cart_screen.dart @@ -159,34 +159,29 @@ class _DefaultConfirmOrderButton extends StatelessWidget { } return Padding( - padding: const EdgeInsets.symmetric(horizontal: 80), - child: Row( - children: [ - Expanded( - child: FilledButton( - style: theme.filledButtonTheme.style?.copyWith( - backgroundColor: WidgetStateProperty.all( - theme.colorScheme.primary, - ), - ), - onPressed: () => onConfirmOrderPressed( - configuration.productService.products, - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16.0, - vertical: 5.0, - ), - child: Text( - configuration.localizations.placeOrder, - style: theme.textTheme.displayLarge?.copyWith( - color: theme.colorScheme.onPrimary, - ), - ), - ), + padding: const EdgeInsets.symmetric(horizontal: 60), + child: SizedBox( + width: double.infinity, + child: FilledButton( + onPressed: () => onConfirmOrderPressed( + configuration.productService.products, + ), + style: theme.filledButtonTheme.style?.copyWith( + backgroundColor: WidgetStateProperty.all( + theme.colorScheme.primary, ), ), - ], + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16.0, + vertical: 12, + ), + child: Text( + configuration.localizations.placeOrder, + style: theme.textTheme.displayLarge, + ), + ), + ), ), ); }