drawer ui

null-safety-migration
suvaissov 2021-07-30 14:28:25 +06:00
parent fe99db18b4
commit cc2493ba2e
5 changed files with 70 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.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';
@ -17,11 +18,14 @@ class AppDrawer extends StatelessWidget {
padding: EdgeInsets.zero,
children: <Widget>[
_createHeader(),
_createDrawerItem(icon: Icons.contacts, text: 'Касса', onTap: () {
Navigator.of(context).pop();
Redux.store!.dispatch(navigateDrawer(WorkView));
}),
Divider(),
_createDrawerItem(
icon: Icons.contacts,
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),
@ -44,18 +48,24 @@ class AppDrawer extends StatelessWidget {
Navigator.of(context).pop();
},
),
],
],
),
_createDrawerItem(icon: Icons.settings, text: 'Настройки', onTap: () {
Navigator.of(context).pop();
Redux.store!.dispatch(navigateDrawer(SettingsView));
}),
_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);
}),
_createDrawerItem(
icon: Icons.exit_to_app,
text: 'Выйти из аккаунта',
onTap: () async {
Redux.store!.dispatch(logout);
}),
ListTile(
title: Text('0.0.1'),
),
@ -65,32 +75,50 @@ class AppDrawer extends StatelessWidget {
}
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)
)
),
]));
return SizedBox(
height: 180.h,
child: DrawerHeader(
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage('assets/images/drawer/background.png'))),
child: Stack(children: <Widget>[
Positioned(
bottom: 12.0,
left: 16.0,
child: Row(
children: [
SizedBox(
height: 40,
width: 40,
child: Container(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
'assets/images/drawer/user.png')))),
),
horizontalSpaceSmall,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('Хайруллин Тимур',
style: TextStyle(fontSize: 16.0)),
Text('Продавец', style: TextStyle(fontSize: 12)),
],
),
],
)),
])),
);
}
Widget _createDrawerItem(
{required IconData icon, required String text, GestureTapCallback? onTap}) {
{required IconData icon,
required String text,
GestureTapCallback? onTap}) {
return ListTile(
title: Row(
children: <Widget>[
@ -104,5 +132,4 @@ class AppDrawer extends StatelessWidget {
onTap: onTap,
);
}
}

View File

@ -330,14 +330,14 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.2"
version: "8.1.4+2"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.0"
version: "3.6.1"
platform:
dependency: transitive
description:

View File

@ -27,7 +27,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
cupertino_icons: ^1.0.3
redux: ^5.0.0
flutter_redux: ^0.8.2
redux_thunk: ^0.4.0
@ -55,7 +55,7 @@ dependencies:
uuid: ^3.0.4
charset_converter: ^2.0.0
ai_barcode: ^3.0.1
permission_handler: ^8.1.2
permission_handler: ^8.1.4+2
dev_dependencies:
flutter_test:
sdk: flutter
@ -76,6 +76,7 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/images/drawer/
- assets/lang/en.json
- assets/lang/ru.json
- assets/google_fonts/