conditional and padding for wallet syncing options

This commit is contained in:
ryleedavis 2022-11-03 17:11:01 -06:00
parent e5f69700f7
commit 563492d4e8
2 changed files with 376 additions and 318 deletions

View file

@ -9,6 +9,8 @@ import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
class SyncingOptionsView extends ConsumerWidget {
@ -18,8 +20,9 @@ class SyncingOptionsView extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final isDesktop = Util.isDesktop;
return ConditionalParent(
condition: !Util.isDesktop,
condition: !isDesktop,
builder: (child) {
return Scaffold(
backgroundColor:
@ -54,8 +57,6 @@ class SyncingOptionsView extends ConsumerWidget {
),
);
},
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
RoundedWhiteContainer(
@ -341,8 +342,47 @@ class SyncingOptionsView extends ConsumerWidget {
),
),
onPressed: () {
Navigator.of(context).pushNamed(
WalletSyncingOptionsView.routeName);
!isDesktop
? Navigator.of(context).pushNamed(
WalletSyncingOptionsView.routeName)
: showDialog(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return DesktopDialog(
maxWidth: 600,
maxHeight: 800,
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Padding(
padding:
const EdgeInsets.all(
32),
child: Text(
"Select wallets to sync",
style: STextStyles
.desktopH3(context),
textAlign:
TextAlign.center,
),
),
const DesktopDialogCloseButton(),
],
),
const Expanded(
child:
WalletSyncingOptionsView(),
),
],
),
);
});
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -365,7 +405,6 @@ class SyncingOptionsView extends ConsumerWidget {
),
],
),
),
);
}
}

View file

@ -10,7 +10,9 @@ import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/animated_text.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_buttons/draggable_switch_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -25,8 +27,13 @@ class WalletSyncingOptionsView extends ConsumerWidget {
final managers = ref
.watch(walletsChangeNotifierProvider.select((value) => value.managers));
final isDesktop = Util.isDesktop;
return ConditionalParent(
condition: !isDesktop,
builder: (child) {
return Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@ -41,14 +48,26 @@ class WalletSyncingOptionsView extends ConsumerWidget {
),
),
),
body: LayoutBuilder(builder: (context, constraints) {
return Padding(
body: Padding(
padding: const EdgeInsets.only(
left: 12,
top: 12,
right: 12,
),
child: SingleChildScrollView(
child: child,
),
);
},
child: ConditionalParent(
condition: isDesktop,
builder: (child) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 32),
child: child,
);
},
child: LayoutBuilder(builder: (context, constraints) {
return SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight - 24,
@ -208,9 +227,9 @@ class WalletSyncingOptionsView extends ConsumerWidget {
),
),
),
),
);
}),
),
);
}
}