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