mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-23 19:05:51 +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/util.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/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/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
import 'package:stackwallet/widgets/stack_text_field.dart';
|
||||
|
@ -36,10 +40,12 @@ class EditWalletTokensView extends ConsumerStatefulWidget {
|
|||
Key? key,
|
||||
required this.walletId,
|
||||
this.contractsToMarkSelected,
|
||||
this.isDesktopPopup = false,
|
||||
}) : super(key: key);
|
||||
|
||||
final String walletId;
|
||||
final List<String>? contractsToMarkSelected;
|
||||
final bool isDesktopPopup;
|
||||
|
||||
static const routeName = "/editWalletTokens";
|
||||
|
||||
|
@ -173,7 +179,9 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
.select((value) => value.getManager(widget.walletId).walletName));
|
||||
|
||||
if (isDesktop) {
|
||||
return DesktopScaffold(
|
||||
return ConditionalParent(
|
||||
condition: !widget.isDesktopPopup,
|
||||
builder: (child) => DesktopScaffold(
|
||||
appBar: DesktopAppBar(
|
||||
isCompactHeight: false,
|
||||
leading: const AppBarBackButton(),
|
||||
|
@ -181,7 +189,17 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
? const ExitToMyStackButton()
|
||||
: 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: [
|
||||
AddTokenText(
|
||||
isDesktop: true,
|
||||
|
@ -191,15 +209,91 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
height: 16,
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
child: child,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 26,
|
||||
),
|
||||
SizedBox(
|
||||
height: 70,
|
||||
width: 480,
|
||||
child: RoundedWhiteContainer(
|
||||
radiusMultiplier: 2,
|
||||
child: PrimaryButton(
|
||||
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(
|
||||
left: 20,
|
||||
top: 20,
|
||||
right: 20,
|
||||
bottom: 0,
|
||||
left: 32,
|
||||
),
|
||||
child: Text(
|
||||
"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(
|
||||
children: [
|
||||
|
@ -217,8 +311,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
_searchTerm = value;
|
||||
});
|
||||
},
|
||||
style:
|
||||
STextStyles.desktopTextMedium(context).copyWith(
|
||||
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||
height: 2,
|
||||
),
|
||||
decoration: standardInputDecoration(
|
||||
|
@ -256,8 +349,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
),
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
_searchFieldController.text =
|
||||
"";
|
||||
_searchFieldController.text = "";
|
||||
_searchTerm = "";
|
||||
});
|
||||
},
|
||||
|
@ -277,7 +369,7 @@ class _EditWalletTokensViewState extends ConsumerState<EditWalletTokensView> {
|
|||
child: AddTokenList(
|
||||
walletId: widget.walletId,
|
||||
items: filter(_searchTerm, tokenEntities),
|
||||
addFunction: _addToken,
|
||||
addFunction: widget.isDesktopPopup ? null : _addToken,
|
||||
),
|
||||
),
|
||||
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 {
|
||||
return Background(
|
||||
|
|
Loading…
Reference in a new issue