mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-31 06:35:53 +00:00
fix attempt to toggle enableExchange while desktop menu minimized
This commit is contained in:
parent
38defea3d1
commit
a066f77639
2 changed files with 23 additions and 11 deletions
|
@ -61,6 +61,7 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
|||
late final DMIController torButtonController;
|
||||
|
||||
double _width = expandedWidth;
|
||||
bool _isMinimized = false;
|
||||
|
||||
void updateSelectedMenuItem(DesktopMenuItemId idKey) {
|
||||
widget.onSelectionWillChange?.call(idKey);
|
||||
|
@ -81,24 +82,25 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
|
|||
|
||||
setState(() {
|
||||
_width = expanded ? minimizedWidth : expandedWidth;
|
||||
_isMinimized = !_isMinimized;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
controllers = [
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
DMIController(isMinimized: _isMinimized),
|
||||
];
|
||||
|
||||
torButtonController = DMIController();
|
||||
torButtonController = DMIController(isMinimized: _isMinimized);
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,10 @@ import 'desktop_menu.dart';
|
|||
|
||||
class DMIController {
|
||||
VoidCallback? toggle;
|
||||
final bool isMinimized;
|
||||
|
||||
DMIController({required this.isMinimized});
|
||||
|
||||
void dispose() {
|
||||
toggle = null;
|
||||
}
|
||||
|
@ -287,11 +291,17 @@ class _DesktopMenuItemState<T> extends ConsumerState<DesktopMenuItem<T>>
|
|||
labelLength = widget.labelLength;
|
||||
controller = widget.controller;
|
||||
|
||||
_iconOnly = controller?.isMinimized ?? false;
|
||||
controller?.toggle = toggle;
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: duration,
|
||||
)..forward();
|
||||
);
|
||||
if (_iconOnly) {
|
||||
animationController.reverse();
|
||||
} else {
|
||||
animationController.forward();
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue