67 lines
2.0 KiB
Dart
67 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_redux/flutter_redux.dart';
|
|
import 'package:satu/core/redux/state/nav_state.dart';
|
|
import 'package:satu/core/redux/store.dart';
|
|
import 'package:satu/core/services/navigator_service.dart';
|
|
import 'package:satu/core/utils/locator.dart';
|
|
import 'package:satu/views/analytics/analytics_view.dart';
|
|
import 'package:satu/views/dictionaries/category/category_view.dart';
|
|
import 'package:satu/views/dictionaries/goods/goods_view.dart';
|
|
import 'package:satu/views/settings/setting_view.dart';
|
|
import 'package:satu/views/work/work_view.dart';
|
|
import 'package:satu/widgets/drawer/app_drawer.dart';
|
|
|
|
import '../dictionaries/contragents/contragents_view.dart';
|
|
|
|
class MainView extends StatefulWidget {
|
|
@override
|
|
_MainViewState createState() => _MainViewState();
|
|
}
|
|
|
|
class _MainViewState extends State<MainView> {
|
|
|
|
final NavigatorService _navigatorService = locator<NavigatorService>();
|
|
|
|
final _workView = const WorkView();
|
|
final _settingsView = SettingsView();
|
|
final _categoryDictView = CategoryDictionaryView();
|
|
final _goodDictView = GoodsDictionaryView();
|
|
final _contragentDictView = ContragentsDictionaryView();
|
|
final _analyticsView = const AnalyticsView();
|
|
|
|
Widget _body(Type viewClass) {
|
|
if(viewClass == WorkView) {
|
|
return _workView;
|
|
}
|
|
if(viewClass == SettingsView) {
|
|
return _settingsView;
|
|
}
|
|
if(viewClass == CategoryDictionaryView) {
|
|
return _categoryDictView;
|
|
}
|
|
if(viewClass == GoodsDictionaryView) {
|
|
return _goodDictView;
|
|
}
|
|
if(viewClass == ContragentsDictionaryView) {
|
|
return _contragentDictView;
|
|
}
|
|
if(viewClass == AnalyticsView) {
|
|
return _analyticsView;
|
|
}
|
|
return _workView;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
key: _navigatorService.scaffoldDrawerKey,
|
|
drawer: AppDrawer(),
|
|
body: StoreConnector<AppState, NavState>(
|
|
converter: (store) => store.state.navState!,
|
|
builder: (_, vm) {
|
|
return _body(vm.drawerViewClass!);
|
|
})
|
|
);
|
|
}
|
|
}
|