mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-02-02 19:26:37 +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,136 +179,204 @@ 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(
|
||||||
appBar: DesktopAppBar(
|
condition: !widget.isDesktopPopup,
|
||||||
isCompactHeight: false,
|
builder: (child) => DesktopScaffold(
|
||||||
leading: const AppBarBackButton(),
|
appBar: DesktopAppBar(
|
||||||
trailing: widget.contractsToMarkSelected == null
|
isCompactHeight: false,
|
||||||
? const ExitToMyStackButton()
|
leading: const AppBarBackButton(),
|
||||||
: null,
|
trailing: widget.contractsToMarkSelected == null
|
||||||
),
|
? const ExitToMyStackButton()
|
||||||
body: Column(
|
: null,
|
||||||
children: [
|
),
|
||||||
AddTokenText(
|
body: SizedBox(
|
||||||
isDesktop: true,
|
width: 480,
|
||||||
walletName: walletName,
|
child: RoundedWhiteContainer(
|
||||||
),
|
radiusMultiplier: 2,
|
||||||
const SizedBox(
|
padding: const EdgeInsets.only(
|
||||||
height: 16,
|
left: 20,
|
||||||
),
|
top: 20,
|
||||||
Expanded(
|
right: 20,
|
||||||
child: SizedBox(
|
bottom: 0,
|
||||||
width: 480,
|
),
|
||||||
child: RoundedWhiteContainer(
|
child: Column(
|
||||||
radiusMultiplier: 2,
|
children: [
|
||||||
padding: const EdgeInsets.only(
|
AddTokenText(
|
||||||
left: 20,
|
isDesktop: true,
|
||||||
top: 20,
|
walletName: walletName,
|
||||||
right: 20,
|
|
||||||
bottom: 0,
|
|
||||||
),
|
),
|
||||||
child: Column(
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 26,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
width: 480,
|
||||||
|
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: 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: [
|
children: [
|
||||||
ClipRRect(
|
Expanded(
|
||||||
borderRadius: BorderRadius.circular(
|
child: SecondaryButton(
|
||||||
Constants.size.circularBorderRadius,
|
label: "Add custom token",
|
||||||
),
|
buttonHeight: ButtonHeight.l,
|
||||||
child: TextField(
|
onPressed: _addToken,
|
||||||
autocorrect: Util.isDesktop ? false : true,
|
|
||||||
enableSuggestions: Util.isDesktop ? false : true,
|
|
||||||
controller: _searchFieldController,
|
|
||||||
focusNode: _searchFocusNode,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_searchTerm = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
style:
|
|
||||||
STextStyles.desktopTextMedium(context).copyWith(
|
|
||||||
height: 2,
|
|
||||||
),
|
|
||||||
decoration: standardInputDecoration(
|
|
||||||
"Search",
|
|
||||||
_searchFocusNode,
|
|
||||||
context,
|
|
||||||
).copyWith(
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 10,
|
|
||||||
),
|
|
||||||
prefixIcon: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
horizontal: 16,
|
|
||||||
// vertical: 20,
|
|
||||||
),
|
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.svg.search,
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.textFieldDefaultSearchIconLeft,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
suffixIcon: _searchFieldController.text.isNotEmpty
|
|
||||||
? Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 10),
|
|
||||||
child: UnconstrainedBox(
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
TextFieldIconButton(
|
|
||||||
child: const XIcon(
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
),
|
|
||||||
onTap: () async {
|
|
||||||
setState(() {
|
|
||||||
_searchFieldController.text =
|
|
||||||
"";
|
|
||||||
_searchTerm = "";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
width: 16,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: AddTokenList(
|
child: PrimaryButton(
|
||||||
walletId: widget.walletId,
|
label: "Done",
|
||||||
items: filter(_searchTerm, tokenEntities),
|
buttonHeight: ButtonHeight.l,
|
||||||
addFunction: _addToken,
|
onPressed: onNextPressed,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
|
||||||
height: 12,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(
|
||||||
|
Constants.size.circularBorderRadius,
|
||||||
|
),
|
||||||
|
child: TextField(
|
||||||
|
autocorrect: Util.isDesktop ? false : true,
|
||||||
|
enableSuggestions: Util.isDesktop ? false : true,
|
||||||
|
controller: _searchFieldController,
|
||||||
|
focusNode: _searchFocusNode,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
_searchTerm = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
|
decoration: standardInputDecoration(
|
||||||
|
"Search",
|
||||||
|
_searchFocusNode,
|
||||||
|
context,
|
||||||
|
).copyWith(
|
||||||
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10,
|
||||||
|
),
|
||||||
|
prefixIcon: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16,
|
||||||
|
// vertical: 20,
|
||||||
|
),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.svg.search,
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFieldDefaultSearchIconLeft,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
suffixIcon: _searchFieldController.text.isNotEmpty
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 10),
|
||||||
|
child: UnconstrainedBox(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
TextFieldIconButton(
|
||||||
|
child: const XIcon(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
setState(() {
|
||||||
|
_searchFieldController.text = "";
|
||||||
|
_searchTerm = "";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 12,
|
||||||
height: 26,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 70,
|
|
||||||
width: 480,
|
|
||||||
child: PrimaryButton(
|
|
||||||
label: widget.contractsToMarkSelected != null ? "Save" : "Next",
|
|
||||||
onPressed: onNextPressed,
|
|
||||||
),
|
),
|
||||||
),
|
Expanded(
|
||||||
const SizedBox(
|
child: AddTokenList(
|
||||||
height: 32,
|
walletId: widget.walletId,
|
||||||
),
|
items: filter(_searchTerm, tokenEntities),
|
||||||
],
|
addFunction: widget.isDesktopPopup ? null : _addToken,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue