mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 20:54:33 +00:00
medium desktop buttons
This commit is contained in:
parent
d365614533
commit
51b6a95390
4 changed files with 62 additions and 30 deletions
|
@ -191,7 +191,7 @@ class _DesktopReceiveState extends ConsumerState<DesktopReceive> {
|
|||
),
|
||||
if (coin != Coin.epicCash)
|
||||
SecondaryButton(
|
||||
height: 56,
|
||||
desktopMed: true,
|
||||
onPressed: generateNewAddress,
|
||||
label: "Generate new address",
|
||||
),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue