mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
desktop layout
This commit is contained in:
parent
f4729526e6
commit
73c94f9927
1 changed files with 95 additions and 34 deletions
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.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/dialogs/claiming_paynym_dialog.dart';
|
||||||
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
import 'package:stackwallet/pages/paynym/paynym_home_view.dart';
|
||||||
import 'package:stackwallet/pages/wallet_view/wallet_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/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.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/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/desktop_scaffold.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
|
|
||||||
|
@ -40,22 +43,54 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
|
|
||||||
return MasterScaffold(
|
return MasterScaffold(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
appBar: AppBar(
|
appBar: isDesktop
|
||||||
leading: AppBarBackButton(
|
? DesktopAppBar(
|
||||||
onPressed: () {
|
isCompactHeight: true,
|
||||||
Navigator.of(context).pop();
|
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,
|
child: ConditionalParent(
|
||||||
title: Text(
|
condition: isDesktop,
|
||||||
"PayNym",
|
builder: (child) => SizedBox(
|
||||||
style: STextStyles.navBarTitle(context),
|
width: 328,
|
||||||
overflow: TextOverflow.ellipsis,
|
child: child,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
body: SafeArea(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Spacer(
|
const Spacer(
|
||||||
|
@ -72,15 +107,27 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"You do not have a PayNym yet.\nClaim yours now!",
|
"You do not have a PayNym yet.\nClaim yours now!",
|
||||||
style: STextStyles.baseXS(context).copyWith(
|
style: isDesktop
|
||||||
color:
|
? STextStyles.desktopSubtitleH2(context).copyWith(
|
||||||
Theme.of(context).extension<StackColors>()!.textSubtitle1,
|
color: Theme.of(context)
|
||||||
),
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.baseXS(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
const Spacer(
|
if (isDesktop)
|
||||||
flex: 2,
|
const SizedBox(
|
||||||
),
|
height: 30,
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
|
const Spacer(
|
||||||
|
flex: 2,
|
||||||
|
),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
label: "Claim",
|
label: "Claim",
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -93,7 +140,7 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
).then((value) => shouldCancel = value == true),
|
).then((value) => shouldCancel = value == true),
|
||||||
);
|
);
|
||||||
|
|
||||||
// ghet wallet to access paynym calls
|
// get wallet to access paynym calls
|
||||||
final wallet = ref
|
final wallet = ref
|
||||||
.read(walletsChangeNotifierProvider)
|
.read(walletsChangeNotifierProvider)
|
||||||
.getManager(widget.walletId)
|
.getManager(widget.walletId)
|
||||||
|
@ -113,11 +160,16 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
// payment code already claimed
|
// payment code already claimed
|
||||||
debugPrint("pcode already claimed!!");
|
debugPrint("pcode already claimed!!");
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
Navigator.of(context).popUntil(
|
if (isDesktop) {
|
||||||
ModalRoute.withName(
|
Navigator.of(context, rootNavigator: true).pop();
|
||||||
WalletView.routeName,
|
Navigator.of(context).pop();
|
||||||
),
|
} else {
|
||||||
);
|
Navigator.of(context).popUntil(
|
||||||
|
ModalRoute.withName(
|
||||||
|
WalletView.routeName,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -141,21 +193,30 @@ class _PaynymClaimViewState extends ConsumerState<PaynymClaimView> {
|
||||||
ref.read(myPaynymAccountStateProvider.state).state =
|
ref.read(myPaynymAccountStateProvider.state).state =
|
||||||
account.value!;
|
account.value!;
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
Navigator.of(context).popUntil(
|
if (isDesktop) {
|
||||||
ModalRoute.withName(
|
Navigator.of(context, rootNavigator: true).pop();
|
||||||
WalletView.routeName,
|
Navigator.of(context).pop();
|
||||||
),
|
} else {
|
||||||
);
|
Navigator.of(context).popUntil(
|
||||||
|
ModalRoute.withName(
|
||||||
|
WalletView.routeName,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
await Navigator.of(context).pushNamed(
|
await Navigator.of(context).pushNamed(
|
||||||
PaynymHomeView.routeName,
|
PaynymHomeView.routeName,
|
||||||
arguments: widget.walletId,
|
arguments: widget.walletId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (mounted && !shouldCancel) {
|
} else if (mounted && !shouldCancel) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const Spacer(
|
||||||
|
flex: 2,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue