app_drawer.dart release

null-safety-migration
suvaissov 2021-08-05 12:03:25 +06:00
parent 55e276b189
commit a4e9beacda
1 changed files with 59 additions and 64 deletions

View File

@ -14,63 +14,39 @@ class AppDrawer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Drawer( return Drawer(
child: Container(
decoration: const BoxDecoration(color: backgroundColor),
child: ListView( child: ListView(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: <Widget>[ children: <Widget>[
_createHeader(), _createHeader(),
_createDrawerSectionTitle(text: 'СПРАВОЧНИКИ'),
_createDrawerItem( _createDrawerItem(
icon: Icons.contacts, icon: Icons.list,
text: 'Касса', text: 'Категории',
onTap: () { onTap: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
Redux.store!.dispatch(navigateDrawer(WorkView)); Redux.store!.dispatch(navigateDrawer(WorkView));
}), }),
const Divider(), _createDrawerItem(icon: Icons.production_quantity_limits, text: 'Товары'),
ExpansionTile( _createDrawerItem(icon: Icons.people, text: 'Контрагенты'),
title: Text('Справочники'), // ignore: prefer_const_constructors _createDrawerSectionTitle(text: 'РАЗДЕЛ'),
childrenPadding: const EdgeInsets.only(left: 18.0), _createDrawerItem(icon: Icons.check, text: 'Инвентаризация'),
children: <Widget>[ _createDrawerSectionTitle(text: 'ИНФОРМАЦИЯ'),
ListTile( _createDrawerItem(icon: Icons.question_answer, text: 'Справочник'),
title: const Text('Категории'), _createDrawerSectionTitle(text: 'ПРОЧЕЕ'),
onTap: () { _createDrawerItem(icon: Icons.settings, text: 'Настройки'),
Navigator.of(context).pop(); _createDrawerItem(icon: Icons.next_plan, text: 'Перейти на сайт'),
},
),
ListTile(
title: const Text('Товары'),
onTap: () {
Navigator.of(context).pop();
},
),
ListTile(
title: const 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( _createDrawerItem(
icon: Icons.exit_to_app, icon: Icons.exit_to_app,
text: 'Выйти из аккаунта', text: 'Выйти из аккаунта',
onTap: () async { onTap: () async {
Redux.store!.dispatch(logout); Redux.store!.dispatch(logout);
}), }),
ListTile( _createDrawerSectionTitle(text: ''),
title: Text('0.0.1'),
),
], ],
), ),
),
); );
} }
@ -119,8 +95,16 @@ class AppDrawer extends StatelessWidget {
{required IconData icon, {required IconData icon,
required String text, required String text,
GestureTapCallback? onTap}) { GestureTapCallback? onTap}) {
return ListTile( return Container(
title: Row( decoration: const BoxDecoration(color: whiteColor),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0),
child: Row(
children: <Widget>[ children: <Widget>[
Icon(icon), Icon(icon),
Padding( Padding(
@ -129,7 +113,18 @@ class AppDrawer extends StatelessWidget {
) )
], ],
), ),
onTap: onTap, ),
),
),
); );
} }
Widget _createDrawerSectionTitle({required String text}) {
return Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
text,
style: const TextStyle(fontSize: 10.0, color: placeholderColor),
));
}
} }