medium desktop buttons

This commit is contained in:
julian 2022-10-27 11:05:23 -06:00
parent d365614533
commit 51b6a95390
4 changed files with 62 additions and 30 deletions

View file

@ -191,7 +191,7 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
),
if (coin != Coin.epicCash)
SecondaryButton(
height: 56,
desktopMed: true,
onPressed: generateNewAddress,
label: "Generate new address",
),

View file

@ -1173,7 +1173,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
height: 36,
),
PrimaryButton(
height: 56,
desktopMed: true,
label: "Preview send",
enabled: ref.watch(previewTxButtonStateProvider.state).state,
onPressed: ref.watch(previewTxButtonStateProvider.state).state

View file

@ -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<StackColors>()!.buttonTextPrimary
: Theme.of(context)
.extension<StackColors>()!
.buttonTextPrimaryDisabled,
);
} else {
return enabled
? STextStyles.desktopButtonEnabled(context)
: STextStyles.desktopButtonDisabled(context);
}
} else {
return STextStyles.button(context).copyWith(
color: enabled
? Theme.of(context).extension<StackColors>()!.buttonTextPrimary
: Theme.of(context)
.extension<StackColors>()!
.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<StackColors>()!
.buttonTextPrimary
: Theme.of(context)
.extension<StackColors>()!
.buttonTextPrimaryDisabled,
),
style: getStyle(isDesktop, context),
),
],
),

View file

@ -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<StackColors>()!.buttonTextSecondary
: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondaryDisabled,
);
} else {
return enabled
? STextStyles.desktopButtonSecondaryEnabled(context)
: STextStyles.desktopButtonSecondaryDisabled(context);
}
} else {
return STextStyles.button(context).copyWith(
color: enabled
? Theme.of(context).extension<StackColors>()!.buttonTextSecondary
: Theme.of(context)
.extension<StackColors>()!
.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<StackColors>()!
.buttonTextSecondary
: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondaryDisabled,
),
style: getStyle(isDesktop, context),
),
],
),