mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-24 04:19:23 +00:00
desktop layout
This commit is contained in:
parent
805beb109f
commit
930bdfca5e
1 changed files with 462 additions and 189 deletions
|
@ -15,7 +15,9 @@ import 'package:stackwallet/utilities/format.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/secondary_button.dart';
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/copy_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/copy_icon.dart';
|
||||||
|
@ -57,7 +59,103 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
|
|
||||||
return MasterScaffold(
|
return MasterScaffold(
|
||||||
isDesktop: isDesktop,
|
isDesktop: isDesktop,
|
||||||
appBar: AppBar(
|
appBar: isDesktop
|
||||||
|
? DesktopAppBar(
|
||||||
|
isCompactHeight: true,
|
||||||
|
background: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
|
leading: Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 24,
|
||||||
|
right: 20,
|
||||||
|
),
|
||||||
|
child: AppBarIconButton(
|
||||||
|
size: 32,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultBG,
|
||||||
|
shadows: const [],
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.svg.arrowLeft,
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.topNavIconPrimary,
|
||||||
|
),
|
||||||
|
onPressed: Navigator.of(context).pop,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.user,
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"PayNym",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
trailing: Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 22),
|
||||||
|
child: MouseRegion(
|
||||||
|
cursor: SystemMouseCursors.click,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pushNamed(
|
||||||
|
AddNewPaynymFollowView.routeName,
|
||||||
|
arguments: widget.walletId,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(10.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.plus,
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 8,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Follow",
|
||||||
|
style:
|
||||||
|
STextStyles.desktopButtonSecondaryEnabled(
|
||||||
|
context)
|
||||||
|
.copyWith(
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: AppBar(
|
||||||
leading: AppBarBackButton(
|
leading: AppBarBackButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
@ -79,7 +177,9 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
Assets.svg.circlePlusFilled,
|
Assets.svg.circlePlusFilled,
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pushNamed(
|
Navigator.of(context).pushNamed(
|
||||||
|
@ -99,7 +199,9 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
Assets.svg.circleQuestion,
|
Assets.svg.circleQuestion,
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 20,
|
height: 20,
|
||||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// todo info ?
|
// todo info ?
|
||||||
|
@ -112,11 +214,21 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: ConditionalParent(
|
||||||
|
condition: !isDesktop,
|
||||||
|
builder: (child) => SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment:
|
||||||
|
isDesktop ? CrossAxisAlignment.start : CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
if (!isDesktop)
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -150,7 +262,10 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
ref.watch(myPaynymAccountStateProvider.state).state!.nymName,
|
ref
|
||||||
|
.watch(myPaynymAccountStateProvider.state)
|
||||||
|
.state!
|
||||||
|
.nymName,
|
||||||
style: STextStyles.desktopMenuItemSelected(context),
|
style: STextStyles.desktopMenuItemSelected(context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -256,11 +371,152 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(24),
|
||||||
|
child: RoundedWhiteContainer(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
width: 4,
|
||||||
|
),
|
||||||
|
GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
secretCount++;
|
||||||
|
if (secretCount > 5) {
|
||||||
|
debugPrint(
|
||||||
|
"My Account: ${ref.read(myPaynymAccountStateProvider.state).state}");
|
||||||
|
debugPrint(
|
||||||
|
"My Account: ${ref.read(myPaynymAccountStateProvider.state).state!.following}");
|
||||||
|
secretCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer ??= Timer(
|
||||||
|
const Duration(milliseconds: 1500),
|
||||||
|
() {
|
||||||
|
secretCount = 0;
|
||||||
|
timer = null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: PayNymBot(
|
||||||
|
paymentCodeString: ref
|
||||||
|
.watch(myPaynymAccountStateProvider.state)
|
||||||
|
.state!
|
||||||
|
.codes
|
||||||
|
.first
|
||||||
|
.code,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
ref
|
||||||
|
.watch(myPaynymAccountStateProvider.state)
|
||||||
|
.state!
|
||||||
|
.nymName,
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 4,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
Format.shorten(
|
||||||
|
ref
|
||||||
|
.watch(myPaynymAccountStateProvider.state)
|
||||||
|
.state!
|
||||||
|
.codes
|
||||||
|
.first
|
||||||
|
.code,
|
||||||
|
12,
|
||||||
|
5),
|
||||||
|
style:
|
||||||
|
STextStyles.desktopTextExtraExtraSmall(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
SecondaryButton(
|
||||||
|
label: "Copy",
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
width: 160,
|
||||||
|
icon: CopyIcon(
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
await Clipboard.setData(
|
||||||
|
ClipboardData(
|
||||||
|
text: ref
|
||||||
|
.read(myPaynymAccountStateProvider.state)
|
||||||
|
.state!
|
||||||
|
.codes
|
||||||
|
.first
|
||||||
|
.code,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
unawaited(
|
||||||
|
showFloatingFlushBar(
|
||||||
|
type: FlushBarType.info,
|
||||||
|
message: "Copied to clipboard",
|
||||||
|
iconAsset: Assets.svg.copy,
|
||||||
|
context: context,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
SecondaryButton(
|
||||||
|
label: "Address",
|
||||||
|
width: 160,
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
icon: QrCodeIcon(
|
||||||
|
width: 18,
|
||||||
|
height: 18,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => PaynymQrPopup(
|
||||||
|
paynymAccount: ref
|
||||||
|
.read(myPaynymAccountStateProvider.state)
|
||||||
|
.state!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (!isDesktop)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 24,
|
height: 24,
|
||||||
),
|
),
|
||||||
SizedBox(
|
ConditionalParent(
|
||||||
height: 40,
|
condition: isDesktop,
|
||||||
|
builder: (child) => Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 24),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
child: SizedBox(
|
||||||
|
height: isDesktop ? 56 : 40,
|
||||||
|
width: isDesktop ? 490 : null,
|
||||||
child: Toggle(
|
child: Toggle(
|
||||||
onColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
onColor: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
onText: "Following",
|
onText: "Following",
|
||||||
|
@ -275,29 +531,46 @@ class _PaynymHomeViewState extends ConsumerState<PaynymHomeView> {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.blue,
|
color: Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 16,
|
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
SizedBox(
|
||||||
|
height: isDesktop ? 20 : 16,
|
||||||
|
),
|
||||||
|
ConditionalParent(
|
||||||
|
condition: isDesktop,
|
||||||
|
builder: (child) => Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 24),
|
||||||
|
child: SizedBox(
|
||||||
|
width: 490,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: RoundedWhiteContainer(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"Your PayNym contacts will appear here",
|
"Your PayNym contacts will appear here",
|
||||||
style: STextStyles.label(context),
|
style: isDesktop
|
||||||
|
? STextStyles.desktopTextExtraExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textSubtitle1,
|
||||||
|
)
|
||||||
|
: STextStyles.label(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue