app_drawer.dart improvement

null-safety-migration
suvaissov 2021-08-05 12:47:35 +06:00
parent a4e9beacda
commit b7be7ba4e4
1 changed files with 16 additions and 4 deletions

View File

@ -28,7 +28,8 @@ class AppDrawer extends StatelessWidget {
Navigator.of(context).pop(); Navigator.of(context).pop();
Redux.store!.dispatch(navigateDrawer(WorkView)); Redux.store!.dispatch(navigateDrawer(WorkView));
}), }),
_createDrawerItem(icon: Icons.production_quantity_limits, text: 'Товары'), _createDrawerItem(
icon: Icons.production_quantity_limits, text: 'Товары'),
_createDrawerItem(icon: Icons.people, text: 'Контрагенты'), _createDrawerItem(icon: Icons.people, text: 'Контрагенты'),
_createDrawerSectionTitle(text: 'РАЗДЕЛ'), _createDrawerSectionTitle(text: 'РАЗДЕЛ'),
_createDrawerItem(icon: Icons.check, text: 'Инвентаризация'), _createDrawerItem(icon: Icons.check, text: 'Инвентаризация'),
@ -40,6 +41,7 @@ class AppDrawer extends StatelessWidget {
_createDrawerItem( _createDrawerItem(
icon: Icons.exit_to_app, icon: Icons.exit_to_app,
text: 'Выйти из аккаунта', text: 'Выйти из аккаунта',
isDanger: true,
onTap: () async { onTap: () async {
Redux.store!.dispatch(logout); Redux.store!.dispatch(logout);
}), }),
@ -94,7 +96,8 @@ class AppDrawer extends StatelessWidget {
Widget _createDrawerItem( Widget _createDrawerItem(
{required IconData icon, {required IconData icon,
required String text, required String text,
GestureTapCallback? onTap}) { GestureTapCallback? onTap,
bool isDanger = false}) {
return Container( return Container(
decoration: const BoxDecoration(color: whiteColor), decoration: const BoxDecoration(color: whiteColor),
child: Material( child: Material(
@ -106,10 +109,19 @@ class AppDrawer extends StatelessWidget {
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0), const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon(icon), Icon(
icon,
size: 20.0,
color: isDanger ? dangerColor : textColor,
),
Padding( Padding(
padding: EdgeInsets.only(left: 8.0), padding: EdgeInsets.only(left: 8.0),
child: Text(text), child: Text(
text,
style: TextStyle(
fontSize: 14.0,
color: isDanger ? dangerColor : textColor),
),
) )
], ],
), ),