mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
add unique keys to each button so they aren't reused
flutter would reuse widgets which would cause weird behavior like removing "Support" and "About" instead of "Swap" and "Buy crypto", and/or adding additional "Support" and "About" items upon hot reload
This commit is contained in:
parent
a080e65ee5
commit
1e9775eded
1 changed files with 22 additions and 7 deletions
|
@ -168,7 +168,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
ref.read(currentDesktopMenuItemProvider.state).state =
|
ref.read(currentDesktopMenuItemProvider.state).state =
|
||||||
DesktopMenuItemId.settings;
|
DesktopMenuItemId.settings;
|
||||||
ref.watch(selectedSettingsMenuItemStateProvider.state).state =
|
ref.read(selectedSettingsMenuItemStateProvider.state).state =
|
||||||
4;
|
4;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -186,6 +186,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('myStack'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopMyStackIcon(),
|
icon: const DesktopMyStackIcon(),
|
||||||
label: "My ${AppConfig.prefix}",
|
label: "My ${AppConfig.prefix}",
|
||||||
|
@ -193,10 +194,13 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
onChanged: updateSelectedMenuItem,
|
onChanged: updateSelectedMenuItem,
|
||||||
controller: controllers[0],
|
controller: controllers[0],
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
if (AppConfig.hasFeature(AppFeature.swap) &&
|
||||||
const SizedBox(height: 2),
|
showExchange) ...[
|
||||||
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('swap'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopExchangeIcon(),
|
icon: const DesktopExchangeIcon(),
|
||||||
label: "Swap",
|
label: "Swap",
|
||||||
|
@ -204,10 +208,14 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
onChanged: updateSelectedMenuItem,
|
onChanged: updateSelectedMenuItem,
|
||||||
controller: controllers[1],
|
controller: controllers[1],
|
||||||
),
|
),
|
||||||
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
],
|
||||||
const SizedBox(height: 2),
|
if (AppConfig.hasFeature(AppFeature.buy) &&
|
||||||
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
showExchange) ...[
|
||||||
|
const SizedBox(
|
||||||
|
height: 2,
|
||||||
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('buy'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopBuyIcon(),
|
icon: const DesktopBuyIcon(),
|
||||||
label: "Buy crypto",
|
label: "Buy crypto",
|
||||||
|
@ -215,10 +223,12 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
onChanged: updateSelectedMenuItem,
|
onChanged: updateSelectedMenuItem,
|
||||||
controller: controllers[2],
|
controller: controllers[2],
|
||||||
),
|
),
|
||||||
|
],
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('notifications'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopNotificationsIcon(),
|
icon: const DesktopNotificationsIcon(),
|
||||||
label: "Notifications",
|
label: "Notifications",
|
||||||
|
@ -230,6 +240,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('addressBook'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopAddressBookIcon(),
|
icon: const DesktopAddressBookIcon(),
|
||||||
label: "Address Book",
|
label: "Address Book",
|
||||||
|
@ -241,6 +252,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('settings'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopSettingsIcon(),
|
icon: const DesktopSettingsIcon(),
|
||||||
label: "Settings",
|
label: "Settings",
|
||||||
|
@ -252,6 +264,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('support'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopSupportIcon(),
|
icon: const DesktopSupportIcon(),
|
||||||
label: "Support",
|
label: "Support",
|
||||||
|
@ -263,6 +276,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('about'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
icon: const DesktopAboutIcon(),
|
icon: const DesktopAboutIcon(),
|
||||||
label: "About",
|
label: "About",
|
||||||
|
@ -273,6 +287,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (!Platform.isIOS)
|
if (!Platform.isIOS)
|
||||||
DesktopMenuItem(
|
DesktopMenuItem(
|
||||||
|
key: ValueKey('exit'),
|
||||||
duration: duration,
|
duration: duration,
|
||||||
labelLength: 123,
|
labelLength: 123,
|
||||||
icon: const DesktopExitIcon(),
|
icon: const DesktopExitIcon(),
|
||||||
|
|
Loading…
Reference in a new issue