WIP: centralize button heights

This commit is contained in:
julian 2022-11-17 12:01:52 -06:00
parent 9e7c1ccf9d
commit 1d238c29f0
11 changed files with 52 additions and 101 deletions

View file

@ -562,7 +562,7 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
Consumer(builder: (context, ref, __) {
return PrimaryButton(
width: 183,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
label: "Create backup",
enabled: shouldEnableCreate,
onPressed: !shouldEnableCreate
@ -780,7 +780,7 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
),
SecondaryButton(
width: 183,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
label: "Cancel",
onPressed: () {},
),

View file

@ -389,7 +389,7 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
children: [
PrimaryButton(
width: 183,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
label: "Restore",
enabled: !(passwordController.text.isEmpty ||
fileLocationController.text.isEmpty),
@ -566,7 +566,7 @@ class _RestoreFromFileViewState extends ConsumerState<RestoreFromFileView> {
),
SecondaryButton(
width: 183,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
label: "Cancel",
onPressed: () {},
),

View file

@ -411,7 +411,7 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
if (coin == Coin.firo)
SecondaryButton(
width: 180,
desktopMed: true,
buttonHeight: ButtonHeight.l,
label: "Anonymize funds",
onPressed: () async {
await showDialog<void>(
@ -441,7 +441,7 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
children: [
SecondaryButton(
width: 180,
desktopMed: true,
buttonHeight: ButtonHeight.l,
label: "Cancel",
onPressed: () {
Navigator.of(context).pop();
@ -450,7 +450,7 @@ class _DesktopWalletViewState extends ConsumerState<DesktopWalletView> {
const SizedBox(width: 20),
PrimaryButton(
width: 180,
desktopMed: true,
buttonHeight: ButtonHeight.l,
label: "Continue",
onPressed: () {
Navigator.of(context).pop();

View file

@ -8,6 +8,7 @@ import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'debug_info_dialog.dart';
@ -143,7 +144,21 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
),
],
),
const StackPrivacyButton(),
PrimaryButton(
label: "Change",
buttonHeight: ButtonHeight.xs,
width: 86,
onPressed: () async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const StackPrivacyDialog();
},
);
},
)
],
),
);
@ -172,7 +187,21 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
.textDark),
textAlign: TextAlign.left,
),
ShowLogsButton(),
PrimaryButton(
buttonHeight: ButtonHeight.xs,
label: "Show logs",
width: 101,
onPressed: () async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const DebugInfoDialog();
},
);
},
),
],
),
),
@ -184,81 +213,3 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
);
}
}
class StackPrivacyButton extends ConsumerWidget {
const StackPrivacyButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> changePrivacySettings() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return StackPrivacyDialog();
},
);
}
return SizedBox(
width: 84,
height: 37,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {
// Navigator.of(context).pushNamed(
// StackPrivacyCalls.routeName,
// arguments: false,
// );
changePrivacySettings();
},
child: Text(
"Change",
style: STextStyles.desktopTextExtraExtraSmall(context)
.copyWith(color: Colors.white),
),
),
);
}
}
class ShowLogsButton extends ConsumerWidget {
const ShowLogsButton({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context, WidgetRef ref) {
Future<void> viewDebugLogs() async {
await showDialog<dynamic>(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const DebugInfoDialog();
},
);
}
return SizedBox(
width: 101,
height: 37,
child: TextButton(
style: Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonColor(context),
onPressed: () {
viewDebugLogs();
},
child: Text(
"Show logs",
style: STextStyles.desktopTextExtraExtraSmall(context)
.copyWith(color: Colors.white),
),
),
);
}
}

View file

@ -422,7 +422,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
padding: const EdgeInsets.all(10),
child: !isEnabledAutoBackup
? PrimaryButton(
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
width: 200,
label: "Enable auto backup",
onPressed: () {
@ -467,7 +467,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
Row(
children: [
PrimaryButton(
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
width: 190,
label: "Disable auto backup",
onPressed: () {
@ -476,7 +476,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
),
const SizedBox(width: 16),
SecondaryButton(
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
width: 190,
label: "Edit auto backup",
onPressed: () {
@ -560,7 +560,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
child: CreateBackupView(),
)
: PrimaryButton(
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
width: 200,
label: "Create manual backup",
onPressed: () {
@ -642,7 +642,7 @@ class _BackupRestoreSettings extends ConsumerState<BackupRestoreSettings> {
child: RestoreFromFileView(),
)
: PrimaryButton(
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
width: 200,
label: "Restore backup",
onPressed: () {

View file

@ -108,7 +108,7 @@ class _CurrencySettings extends ConsumerState<CurrencySettings> {
),
child: PrimaryButton(
width: 210,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
enabled: true,
label: "Change currency",
onPressed: () {

View file

@ -80,12 +80,12 @@ class _LanguageOptionSettings extends ConsumerState<LanguageOptionSettings> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(
padding: const EdgeInsets.all(
10,
),
child: PrimaryButton(
width: 210,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
enabled: true,
label: "Change language",
onPressed: () {

View file

@ -503,7 +503,7 @@ class _SecuritySettings extends ConsumerState<SecuritySettings> {
)
: PrimaryButton(
width: 210,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
enabled: true,
label: "Set up new password",
onPressed: () {

View file

@ -83,7 +83,7 @@ class _SyncingPreferencesSettings
),
child: PrimaryButton(
width: 210,
buttonHeight: ButtonHeight.l,
buttonHeight: ButtonHeight.m,
enabled: true,
label: "Change preferences",
onPressed: () {},

View file

@ -81,9 +81,9 @@ class PrimaryButton extends StatelessWidget {
if (Util.isDesktop) {
switch (buttonHeight!) {
case ButtonHeight.xxs:
return 28;
case ButtonHeight.xs:
return 32;
case ButtonHeight.xs:
return 37;
case ButtonHeight.s:
return 40;
case ButtonHeight.m:

View file

@ -84,9 +84,9 @@ class SecondaryButton extends StatelessWidget {
if (Util.isDesktop) {
switch (buttonHeight!) {
case ButtonHeight.xxs:
return 28;
case ButtonHeight.xs:
return 32;
case ButtonHeight.xs:
return 37;
case ButtonHeight.s:
return 40;
case ButtonHeight.m: