mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-24 03:15:50 +00:00
desktop popup edit tokens view
This commit is contained in:
parent
1305b9f37c
commit
6beb4ec859
1 changed files with 190 additions and 116 deletions
|
@ -22,10 +22,14 @@ 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/background.dart';
|
import 'package:stackwallet/widgets/background.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_app_bar.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||||
|
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.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';
|
||||||
|
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||||
|
@ -36,10 +40,12 @@ class EditWalletTokensView extends ConsumerStatefulWidget {
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.walletId,
|
required this.walletId,
|
||||||
this.contractsToMarkSelected,
|
this.contractsToMarkSelected,
|
||||||
|
this.isDesktopPopup = false,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final String walletId;
|
final String walletId;
|
||||||
final List<String>? contractsToMarkSelected;
|
final List<String>? contractsToMarkSelected;
|
||||||
|
final bool isDesktopPopup;
|
||||||
|
|
||||||
static const routeName = "/editWalletTokens";
|
static const routeName = "/editWalletTokens";
|
||||||
|
|
||||||
|
@ -173,7 +179,9 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
.select((value) => value.getManager(widget.walletId).walletName));
|
.select((value) => value.getManager(widget.walletId).walletName));
|
||||||
|
|
||||||
if (isDesktop) {
|
if (isDesktop) {
|
||||||
return DesktopScaffold(
|
return ConditionalParent(
|
||||||
|
condition: !widget.isDesktopPopup,
|
||||||
|
builder: (child) => DesktopScaffold(
|
||||||
appBar: DesktopAppBar(
|
appBar: DesktopAppBar(
|
||||||
isCompactHeight: false,
|
isCompactHeight: false,
|
||||||
leading: const AppBarBackButton(),
|
leading: const AppBarBackButton(),
|
||||||
|
@ -181,7 +189,17 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
? const ExitToMyStackButton()
|
? const ExitToMyStackButton()
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: SizedBox(
|
||||||
|
width: 480,
|
||||||
|
child: RoundedWhiteContainer(
|
||||||
|
radiusMultiplier: 2,
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 20,
|
||||||
|
top: 20,
|
||||||
|
right: 20,
|
||||||
|
bottom: 0,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
AddTokenText(
|
AddTokenText(
|
||||||
isDesktop: true,
|
isDesktop: true,
|
||||||
|
@ -191,15 +209,91 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
height: 16,
|
height: 16,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: child,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 26,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
width: 480,
|
width: 480,
|
||||||
child: RoundedWhiteContainer(
|
child: PrimaryButton(
|
||||||
radiusMultiplier: 2,
|
label: widget.contractsToMarkSelected != null
|
||||||
|
? "Save"
|
||||||
|
: "Next",
|
||||||
|
onPressed: onNextPressed,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: ConditionalParent(
|
||||||
|
condition: widget.isDesktopPopup,
|
||||||
|
builder: (child) => DesktopDialog(
|
||||||
|
maxHeight: 670,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 20,
|
left: 32,
|
||||||
top: 20,
|
),
|
||||||
right: 20,
|
child: Text(
|
||||||
bottom: 0,
|
"Edit tokens",
|
||||||
|
style: STextStyles.desktopH3(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const DesktopDialogCloseButton(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 32,
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 32,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SecondaryButton(
|
||||||
|
label: "Add custom token",
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
onPressed: _addToken,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: PrimaryButton(
|
||||||
|
label: "Done",
|
||||||
|
buttonHeight: ButtonHeight.l,
|
||||||
|
onPressed: onNextPressed,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -217,8 +311,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
_searchTerm = value;
|
_searchTerm = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
style:
|
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||||
STextStyles.desktopTextMedium(context).copyWith(
|
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
decoration: standardInputDecoration(
|
decoration: standardInputDecoration(
|
||||||
|
@ -256,8 +349,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_searchFieldController.text =
|
_searchFieldController.text = "";
|
||||||
"";
|
|
||||||
_searchTerm = "";
|
_searchTerm = "";
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -277,7 +369,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
child: AddTokenList(
|
child: AddTokenList(
|
||||||
walletId: widget.walletId,
|
walletId: widget.walletId,
|
||||||
items: filter(_searchTerm, tokenEntities),
|
items: filter(_searchTerm, tokenEntities),
|
||||||
addFunction: _addToken,
|
addFunction: widget.isDesktopPopup ? null : _addToken,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
|
@ -286,24 +378,6 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 26,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 70,
|
|
||||||
width: 480,
|
|
||||||
child: PrimaryButton(
|
|
||||||
label: widget.contractsToMarkSelected != null ? "Save" : "Next",
|
|
||||||
onPressed: onNextPressed,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 32,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Background(
|
return Background(
|
||||||
|
|
Loading…
Reference in a new issue