desktop layout

This commit is contained in:
julian 2023-01-04 10:08:05 -06:00
parent f4729526e6
commit 73c94f9927

View file

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages/paynym/dialogs/claiming_paynym_dialog.dart';
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
@ -14,7 +15,9 @@ import 'package:stackwallet/utilities/assets.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/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/desktop/primary_button.dart';
@ -40,22 +43,54 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
return MasterScaffold(
isDesktop: isDesktop,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
Navigator.of(context).pop();
},
appBar: isDesktop
? DesktopAppBar(
isCompactHeight: true,
background: Theme.of(context).extension<StackColors>()!.popupBG,
leading: Row(
children: [
const AppBarBackButton(
isCompact: true,
),
SvgPicture.asset(
Assets.svg.user,
width: 42,
height: 42,
color: Theme.of(context).extension<StackColors>()!.textDark,
),
const SizedBox(
width: 10,
),
Text(
"PayNym",
style: STextStyles.desktopH3(context),
)
],
),
)
: AppBar(
leading: const AppBarBackButton(),
titleSpacing: 0,
title: Text(
"PayNym",
style: STextStyles.navBarTitle(context),
overflow: TextOverflow.ellipsis,
),
),
body: ConditionalParent(
condition: !isDesktop,
builder: (child) => SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: child,
),
),
titleSpacing: 0,
title: Text(
"PayNym",
style: STextStyles.navBarTitle(context),
overflow: TextOverflow.ellipsis,
),
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: ConditionalParent(
condition: isDesktop,
builder: (child) => SizedBox(
width: 328,
child: child,
),
child: Column(
children: [
const Spacer(
@ -72,15 +107,27 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
),
Text(
"You do not have a PayNym yet.\nClaim yours now!",
style: STextStyles.baseXS(context).copyWith(
color:
Theme.of(context).extension<StackColors>()!.textSubtitle1,
),
style: isDesktop
? STextStyles.desktopSubtitleH2(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
)
: STextStyles.baseXS(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
textAlign: TextAlign.center,
),
const Spacer(
flex: 2,
),
if (isDesktop)
const SizedBox(
height: 30,
),
if (!isDesktop)
const Spacer(
flex: 2,
),
PrimaryButton(
label: "Claim",
onPressed: () async {
@ -93,7 +140,7 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
).then((value) => shouldCancel = value == true),
);
// ghet wallet to access paynym calls
// get wallet to access paynym calls
final wallet = ref
.read(walletsChangeNotifierProvider)
.getManager(widget.walletId)
@ -113,11 +160,16 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
// payment code already claimed
debugPrint("pcode already claimed!!");
if (mounted) {
Navigator.of(context).popUntil(
ModalRoute.withName(
WalletView.routeName,
),
);
if (isDesktop) {
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).pop();
} else {
Navigator.of(context).popUntil(
ModalRoute.withName(
WalletView.routeName,
),
);
}
}
return;
}
@ -141,21 +193,30 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
ref.read(myPaynymAccountStateProvider.state).state =
account.value!;
if (mounted) {
Navigator.of(context).popUntil(
ModalRoute.withName(
WalletView.routeName,
),
);
if (isDesktop) {
Navigator.of(context, rootNavigator: true).pop();
Navigator.of(context).pop();
} else {
Navigator.of(context).popUntil(
ModalRoute.withName(
WalletView.routeName,
),
);
}
await Navigator.of(context).pushNamed(
PaynymHomeView.routeName,
arguments: widget.walletId,
);
}
} else if (mounted && !shouldCancel) {
Navigator.of(context).pop();
Navigator.of(context, rootNavigator: isDesktop).pop();
}
},
),
if (isDesktop)
const Spacer(
flex: 2,
),
],
),
),