drawer design updated

merge-requests/125/head
Sultan Khan 6 years ago
parent 79c2de3f96
commit b26e750abb

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@ -9,7 +9,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
class LandingPage extends StatefulWidget { class LandingPage extends StatefulWidget {
@override @override
_LandingPageState createState() => _LandingPageState(); _LandingPageState createState() => _LandingPageState();
@ -39,7 +38,8 @@ class _LandingPageState extends State<LandingPage> {
elevation: 0, elevation: 0,
backgroundColor: Hexcolor('#515B5D'), backgroundColor: Hexcolor('#515B5D'),
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), headline6:
TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
title: Text(getText(currentTab).toUpperCase()), title: Text(getText(currentTab).toUpperCase()),
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
@ -51,14 +51,8 @@ class _LandingPageState extends State<LandingPage> {
}, },
), ),
centerTitle: true, centerTitle: true,
),
drawer: Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.transparent,
),
child: SafeArea(child: AppDrawer()),
), ),
drawer: SafeArea(child: AppDrawer()),
extendBody: true, extendBody: true,
body: PageView( body: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
@ -71,7 +65,6 @@ class _LandingPageState extends State<LandingPage> {
], ],
), ),
bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab),
); );
} }
@ -85,7 +78,6 @@ class _LandingPageState extends State<LandingPage> {
return "SCHEDULE"; return "SCHEDULE";
case 3: case 3:
return 'SERVICES'; return 'SERVICES';
} }
} }
} }

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/presentation/doctor_app_icons.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -31,7 +32,7 @@ class _AppDrawerState extends State<AppDrawer> {
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
// if (_isInit) { // if (_isInit) {
getDocProfile();// TODO: Refactor this code to prevent errors in the cosole. getDocProfile(); // TODO: Refactor this code to prevent errors in the cosole.
// } // }
_isInit = false; _isInit = false;
} }
@ -40,7 +41,7 @@ class _AppDrawerState extends State<AppDrawer> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
// doctorProfile = DoctorProfileModel.fromJson(profile); // doctorProfile = DoctorProfileModel.fromJson(profile);
setState(() { setState(() {
doctorProfile = DoctorProfileModel.fromJson(profile); doctorProfile = DoctorProfileModel.fromJson(profile);
}); });
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
@ -51,75 +52,118 @@ class _AppDrawerState extends State<AppDrawer> {
// var x = getDocProfile(); // var x = getDocProfile();
return RoundedContainer( return RoundedContainer(
child: Container( child: Container(
margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 9), color: Colors.white,
// margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2),
child: Drawer( child: Drawer(
child: Column(children: <Widget>[
Expanded(
flex: 4,
child: ListView(padding: EdgeInsets.zero, children: <Widget>[ child: ListView(padding: EdgeInsets.zero, children: <Widget>[
Container( Container(
height: SizeConfig.heightMultiplier * 30, height: SizeConfig.heightMultiplier * 50,
child: InkWell( child: InkWell(
child: DrawerHeader( child: DrawerHeader(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
CircleAvatar( Container(
radius: SizeConfig.imageSizeMultiplier * 12, child: Image.asset('assets/images/logo.png'),
backgroundImage: margin: EdgeInsets.only(top: 10, bottom: 15),
NetworkImage(doctorProfile.doctorImageURL), ),
backgroundColor: Colors.transparent, SizedBox(
height: 1,
child: Container(
color: Colors.black26,
),
),
SizedBox(height: 15),
CircleAvatar(
radius: SizeConfig.imageSizeMultiplier * 12,
backgroundImage:
NetworkImage(doctorProfile.doctorImageURL),
backgroundColor: Colors.white,
),
Padding(
padding: EdgeInsets.only(top: 10),
child: AppText(
doctorProfile.doctorName,
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: SizeConfig.textMultiplier * 2,
)),
AppText(
"Director of medical records", //TODO: Make The Dr Title Dynamic and check overflow issue.
fontWeight: FontWeight.normal,
color: Colors.black87),
RaisedButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
side: BorderSide(color: Colors.red)),
child: AppText(
'Logout',
color: Colors.white,
),
onPressed: () async {
await Helpers.clearSharedPref();
Navigator.pop(context);
Navigator.of(context).pushNamed(LOGIN);
},
),
],
), ),
Padding( ),
padding: EdgeInsets.only(top: 10), onTap: () {
child: AppText( //Navigator.of(context).pushNamed(PROFILE);
doctorProfile.doctorName, Navigator.of(context).pushNamed(PROFILE, arguments: {
'title': doctorProfile.doctorName,
fontWeight: FontWeight.bold, "doctorProfileall": doctorProfile
color: Colors.white, });
fontSize: SizeConfig.textMultiplier * 2, },
)),
AppText("Director of medical records",//TODO: Make The Dr Title Dynamic and check overflow issue.
fontWeight: FontWeight.normal, color: Colors.white)
],
), ),
), ),
onTap: () { InkWell(
//Navigator.of(context).pushNamed(PROFILE); child: DrawerItem("Settings", Icons.settings),
Navigator.of(context).pushNamed(PROFILE, arguments: {'title':doctorProfile.doctorName, onTap: () {
"doctorProfileall": doctorProfile Navigator.pop(context);
}); Navigator.of(context).pushNamed(SETTINGS);
},
}, ),
), InkWell(
), child: DrawerItem("QR Reader", DoctorApp.qr_code),
InkWell( onTap: () {
child: DrawerItem("Settings", Icons.settings), Navigator.pop(context);
onTap: () { Navigator.of(context).pushNamed(QR_READER);
Navigator.pop(context); },
Navigator.of(context).pushNamed(SETTINGS); ),
}, ]),
),
InkWell(
child: DrawerItem("QR Reader", Icons.search),
onTap: () {
Navigator.pop(context);
Navigator.of(context).pushNamed(QR_READER);
},
),
InkWell(
child: DrawerItem("lOGOUT", Icons.exit_to_app),
onTap: () async {
await Helpers.clearSharedPref();
Navigator.pop(context);
Navigator.of(context).pushNamed(LOGIN);
},
), ),
Expanded(
flex: 1,
child: Column(children: <Widget>[
Container(
// This align moves the children to the bottom
child: Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
child: Column(
children: <Widget>[
Text("Powered by"),
Image.asset(
'assets/images/cs_logo_container.png',
width: SizeConfig.imageSizeMultiplier * 30,
)
],
))))
]))
])), ])),
), ),
width: SizeConfig.realScreenWidth * 0.55, width: SizeConfig.realScreenWidth * 0.60,
margin: 0, margin: 0,
customCornerRaduis: true,
topRight: 30, customCornerRaduis: false,
bottomRight: 30, // topRight: 30,
backgroundColor: Color(0xff58434F), // bottomRight: 30,
backgroundColor: Colors.white,
); );
} }

@ -11,15 +11,13 @@ import '../shared/app_texts_widget.dart';
// DESCRIPTION : Custom Drawer item for app. // DESCRIPTION : Custom Drawer item for app.
class DrawerItem extends StatefulWidget { class DrawerItem extends StatefulWidget {
final String title; final String title;
final String subTitle; final String subTitle;
final IconData icon; final IconData icon;
final Color color; final Color color;
DrawerItem(this.title, this.icon, {this.color, this.subTitle = ''});
DrawerItem(this.title, this.icon,{this.color, this.subTitle = ''});
@override @override
_DrawerItemState createState() => _DrawerItemState(); _DrawerItemState createState() => _DrawerItemState();
} }
@ -34,26 +32,26 @@ class _DrawerItemState extends State<DrawerItem> {
children: <Widget>[ children: <Widget>[
Icon( Icon(
widget.icon, widget.icon,
color: widget.color??Colors.white, color: widget.color ?? Colors.black87,
size: SizeConfig.imageSizeMultiplier * 7, size: SizeConfig.imageSizeMultiplier * 5,
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
AppText( AppText(
widget.title, widget.title,
color: widget.color??Colors.white, color: widget.color ?? Colors.black,
fontWeight: FontWeight.bold, // fontWeight: FontWeight.bold,
margin: 5, margin: 5,
fontSize: SizeConfig.textMultiplier * 2.3,
),
AppText(
widget.subTitle,
visibility: !widget.subTitle.isNullOrEmpty(),
color: widget.color ?? Colors.black,
marginLeft: 5,
fontSize: SizeConfig.textMultiplier * 2.5, fontSize: SizeConfig.textMultiplier * 2.5,
), ),
AppText(
widget.subTitle,
visibility: !widget.subTitle.isNullOrEmpty(),
color: widget.color??Colors.white,
marginLeft: 5,
fontSize: SizeConfig.textMultiplier * 2.5,
),
], ],
), ),
], ],

Loading…
Cancel
Save