stack_wallet/lib/pages_desktop_specific/home/desktop_home_view.dart

74 lines
1.9 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu.dart';
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart';
2022-10-05 17:41:41 +00:00
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/settings_menu.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
class DesktopHomeView extends ConsumerStatefulWidget {
const DesktopHomeView({Key? key}) : super(key: key);
static const String routeName = "/desktopHome";
@override
ConsumerState<DesktopHomeView> createState() => _DesktopHomeViewState();
}
class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
2022-09-16 17:26:12 +00:00
int currentViewIndex = 0;
final List<Widget> contentViews = [
const Navigator(
2022-10-13 17:55:04 +00:00
key: Key("desktopStackHomeKey"),
onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: MyStackView.routeName,
),
2022-09-16 17:26:12 +00:00
Container(
color: Colors.green,
),
Container(
color: Colors.red,
),
Container(
color: Colors.orange,
),
2022-10-05 17:41:41 +00:00
const Navigator(
2022-10-13 17:55:04 +00:00
key: Key("desktopSettingHomeKey"),
2022-10-05 17:41:41 +00:00
onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: SettingsMenu.routeName,
2022-09-16 17:26:12 +00:00
),
Container(
color: Colors.blue,
),
Container(
color: Colors.pink,
),
Container(
color: Colors.purple,
),
];
void onMenuSelectionChanged(int newIndex) {
setState(() {
currentViewIndex = newIndex;
});
}
@override
Widget build(BuildContext context) {
return Material(
color: Theme.of(context).extension<StackColors>()!.background,
child: Row(
children: [
2022-09-16 17:26:12 +00:00
DesktopMenu(
onSelectionChanged: onMenuSelectionChanged,
),
2022-09-16 23:54:46 +00:00
Expanded(
child: contentViews[currentViewIndex],
),
],
),
);
}
}