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