From 51b6a953903b0dc1ca18447c5e6c47ddcb08e469 Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 27 Oct 2022 11:05:23 -0600 Subject: [PATCH] medium desktop buttons --- .../wallet_view/receive/desktop_receive.dart | 2 +- .../wallet_view/send/desktop_send.dart | 2 +- lib/widgets/desktop/primary_button.dart | 44 +++++++++++++------ lib/widgets/desktop/secondary_button.dart | 44 +++++++++++++------ 4 files changed, 62 insertions(+), 30 deletions(-) diff --git a/lib/pages_desktop_specific/home/my_stack_view/wallet_view/receive/desktop_receive.dart b/lib/pages_desktop_specific/home/my_stack_view/wallet_view/receive/desktop_receive.dart index 79e3b81cf..71f708e35 100644 --- a/lib/pages_desktop_specific/home/my_stack_view/wallet_view/receive/desktop_receive.dart +++ b/lib/pages_desktop_specific/home/my_stack_view/wallet_view/receive/desktop_receive.dart @@ -191,7 +191,7 @@ class _DesktopReceiveState extends ConsumerState { ), if (coin != Coin.epicCash) SecondaryButton( - height: 56, + desktopMed: true, onPressed: generateNewAddress, label: "Generate new address", ), diff --git a/lib/pages_desktop_specific/home/my_stack_view/wallet_view/send/desktop_send.dart b/lib/pages_desktop_specific/home/my_stack_view/wallet_view/send/desktop_send.dart index b084603b6..116262d23 100644 --- a/lib/pages_desktop_specific/home/my_stack_view/wallet_view/send/desktop_send.dart +++ b/lib/pages_desktop_specific/home/my_stack_view/wallet_view/send/desktop_send.dart @@ -1173,7 +1173,7 @@ class _DesktopSendState extends ConsumerState { height: 36, ), PrimaryButton( - height: 56, + desktopMed: true, label: "Preview send", enabled: ref.watch(previewTxButtonStateProvider.state).state, onPressed: ref.watch(previewTxButtonStateProvider.state).state diff --git a/lib/widgets/desktop/primary_button.dart b/lib/widgets/desktop/primary_button.dart index 6034cc08b..f3c900c34 100644 --- a/lib/widgets/desktop/primary_button.dart +++ b/lib/widgets/desktop/primary_button.dart @@ -13,6 +13,7 @@ class PrimaryButton extends StatelessWidget { this.icon, this.onPressed, this.enabled = true, + this.desktopMed = false, }) : super(key: key); final double? width; @@ -21,13 +22,40 @@ class PrimaryButton extends StatelessWidget { final VoidCallback? onPressed; final bool enabled; final Widget? icon; + final bool desktopMed; + + TextStyle getStyle(bool isDesktop, BuildContext context) { + if (isDesktop) { + if (desktopMed) { + return STextStyles.desktopTextExtraSmall(context).copyWith( + color: enabled + ? Theme.of(context).extension()!.buttonTextPrimary + : Theme.of(context) + .extension()! + .buttonTextPrimaryDisabled, + ); + } else { + return enabled + ? STextStyles.desktopButtonEnabled(context) + : STextStyles.desktopButtonDisabled(context); + } + } else { + return STextStyles.button(context).copyWith( + color: enabled + ? Theme.of(context).extension()!.buttonTextPrimary + : Theme.of(context) + .extension()! + .buttonTextPrimaryDisabled, + ); + } + } @override Widget build(BuildContext context) { final isDesktop = Util.isDesktop; return CustomTextButtonBase( - height: height, + height: desktopMed ? 56 : height, width: width, textButton: TextButton( onPressed: enabled ? onPressed : null, @@ -49,19 +77,7 @@ class PrimaryButton extends StatelessWidget { if (label != null) Text( label!, - style: isDesktop - ? enabled - ? STextStyles.desktopButtonEnabled(context) - : STextStyles.desktopButtonDisabled(context) - : STextStyles.button(context).copyWith( - color: enabled - ? Theme.of(context) - .extension()! - .buttonTextPrimary - : Theme.of(context) - .extension()! - .buttonTextPrimaryDisabled, - ), + style: getStyle(isDesktop, context), ), ], ), diff --git a/lib/widgets/desktop/secondary_button.dart b/lib/widgets/desktop/secondary_button.dart index 2a88e548d..8d5eae0ce 100644 --- a/lib/widgets/desktop/secondary_button.dart +++ b/lib/widgets/desktop/secondary_button.dart @@ -13,6 +13,7 @@ class SecondaryButton extends StatelessWidget { this.icon, this.onPressed, this.enabled = true, + this.desktopMed = false, }) : super(key: key); final double? width; @@ -21,13 +22,40 @@ class SecondaryButton extends StatelessWidget { final VoidCallback? onPressed; final bool enabled; final Widget? icon; + final bool desktopMed; + + TextStyle getStyle(bool isDesktop, BuildContext context) { + if (isDesktop) { + if (desktopMed) { + return STextStyles.desktopTextExtraSmall(context).copyWith( + color: enabled + ? Theme.of(context).extension()!.buttonTextSecondary + : Theme.of(context) + .extension()! + .buttonTextSecondaryDisabled, + ); + } else { + return enabled + ? STextStyles.desktopButtonSecondaryEnabled(context) + : STextStyles.desktopButtonSecondaryDisabled(context); + } + } else { + return STextStyles.button(context).copyWith( + color: enabled + ? Theme.of(context).extension()!.buttonTextSecondary + : Theme.of(context) + .extension()! + .buttonTextSecondaryDisabled, + ); + } + } @override Widget build(BuildContext context) { final isDesktop = Util.isDesktop; return CustomTextButtonBase( - height: height, + height: desktopMed ? 56 : height, width: width, textButton: TextButton( onPressed: enabled ? onPressed : null, @@ -49,19 +77,7 @@ class SecondaryButton extends StatelessWidget { if (label != null) Text( label!, - style: isDesktop - ? enabled - ? STextStyles.desktopButtonSecondaryEnabled(context) - : STextStyles.desktopButtonSecondaryDisabled(context) - : STextStyles.button(context).copyWith( - color: enabled - ? Theme.of(context) - .extension()! - .buttonTextSecondary - : Theme.of(context) - .extension()! - .buttonTextSecondaryDisabled, - ), + style: getStyle(isDesktop, context), ), ], ),