load buy data when clicking buy crypto item in desktop menu

This commit is contained in:
sneurlax 2023-01-12 14:13:29 -06:00
parent 8e8816fe05
commit dad7329a30

View file

@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart'; import 'package:stackwallet/pages_desktop_specific/desktop_menu_item.dart';
import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart'; import 'package:stackwallet/providers/desktop/current_desktop_menu_item.dart';
import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -43,6 +44,8 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
double _width = expandedWidth; double _width = expandedWidth;
final _buyDataLoadingService = BuyDataLoadingService();
void updateSelectedMenuItem(DesktopMenuItemId idKey) { void updateSelectedMenuItem(DesktopMenuItemId idKey) {
widget.onSelectionWillChange?.call(idKey); widget.onSelectionWillChange?.call(idKey);
@ -164,7 +167,9 @@ class _DesktopMenuState extends ConsumerState<DesktopMenu> {
icon: const DesktopBuyIcon(), icon: const DesktopBuyIcon(),
label: "Buy crypto", label: "Buy crypto",
value: DesktopMenuItemId.buy, value: DesktopMenuItemId.buy,
onChanged: updateSelectedMenuItem, onChanged: (_) {
_buyDataLoadingService.loadAll(ref);
},
controller: controllers[2], controller: controllers[2],
), ),
const SizedBox( const SizedBox(