108 lines
3.3 KiB
Dart
108 lines
3.3 KiB
Dart
import 'package:flutter/cupertino.dart';
|
||
import 'package:flutter/material.dart';
|
||
import 'package:satu/core/redux/actions/nav_actions.dart';
|
||
import 'package:satu/core/redux/actions/user_actions.dart';
|
||
import 'package:satu/core/redux/store.dart';
|
||
|
||
import 'package:satu/shared/app_colors.dart';
|
||
import 'package:satu/shared/ui_helpers.dart';
|
||
import 'package:satu/views/settings/setting_view.dart';
|
||
import 'package:satu/views/work/work_view.dart';
|
||
|
||
class AppDrawer extends StatelessWidget {
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Drawer(
|
||
child: ListView(
|
||
padding: EdgeInsets.zero,
|
||
children: <Widget>[
|
||
_createHeader(),
|
||
_createDrawerItem(icon: Icons.contacts, text: 'Касса', onTap: () {
|
||
Navigator.of(context).pop();
|
||
Redux.store!.dispatch(navigateDrawer(WorkView));
|
||
}),
|
||
Divider(),
|
||
ExpansionTile(
|
||
title: Text("Справочники"),
|
||
childrenPadding: EdgeInsets.only(left: 18.0),
|
||
children: <Widget>[
|
||
ListTile(
|
||
title: Text('Категории'),
|
||
onTap: () {
|
||
Navigator.of(context).pop();
|
||
},
|
||
),
|
||
ListTile(
|
||
title: Text('Товары'),
|
||
onTap: () {
|
||
Navigator.of(context).pop();
|
||
},
|
||
),
|
||
ListTile(
|
||
title: Text('Контрагенты'),
|
||
onTap: () {
|
||
Navigator.of(context).pop();
|
||
},
|
||
),
|
||
],
|
||
),
|
||
_createDrawerItem(icon: Icons.settings, text: 'Настройки', onTap: () {
|
||
Navigator.of(context).pop();
|
||
Redux.store!.dispatch(navigateDrawer(SettingsView));
|
||
}),
|
||
Divider(),
|
||
_createDrawerItem(icon: Icons.bug_report, text: 'Сообщить об ошибке'),
|
||
verticalSpaceMedium,
|
||
_createDrawerItem(icon: Icons.exit_to_app, text: 'Выйти из аккаунта', onTap: () async {
|
||
Redux.store!.dispatch(logout);
|
||
}),
|
||
ListTile(
|
||
title: Text('0.0.1'),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
|
||
Widget _createHeader() {
|
||
return DrawerHeader(
|
||
margin: EdgeInsets.zero,
|
||
padding: EdgeInsets.zero,
|
||
decoration: BoxDecoration(
|
||
color: primaryColor
|
||
),
|
||
// decoration: BoxDecoration(
|
||
// image: DecorationImage(
|
||
// fit: BoxFit.fill,
|
||
// image: AssetImage('assets/images/halyk-bank.png'))),
|
||
child: Stack(children: <Widget>[
|
||
Positioned(
|
||
bottom: 12.0,
|
||
left: 16.0,
|
||
child: Text("Сату - онлайн касса",
|
||
style: TextStyle(
|
||
color: Colors.white,
|
||
fontSize: 20.0,
|
||
fontWeight: FontWeight.w500)
|
||
)
|
||
),
|
||
]));
|
||
}
|
||
|
||
Widget _createDrawerItem(
|
||
{required IconData icon, required String text, GestureTapCallback? onTap}) {
|
||
return ListTile(
|
||
title: Row(
|
||
children: <Widget>[
|
||
Icon(icon),
|
||
Padding(
|
||
padding: EdgeInsets.only(left: 8.0),
|
||
child: Text(text),
|
||
)
|
||
],
|
||
),
|
||
onTap: onTap,
|
||
);
|
||
}
|
||
|
||
} |