You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/widgets/shared/app_drawer_widget.dart

277 lines
12 KiB
Dart

import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/screens/reschedule-leaves/add-rescheduleleave.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../widgets/shared/drawer_item_widget.dart';
import '../../widgets/shared/rounded_container_widget.dart';
import 'app_texts_widget.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class AppDrawer extends StatefulWidget {
@override
_AppDrawerState createState() => _AppDrawerState();
}
class _AppDrawerState extends State<AppDrawer> {
Helpers helpers = new Helpers();
ProjectViewModel projectsProvider;
@override
Widget build(BuildContext context) {
AuthenticationViewModel authenticationViewModel = Provider.of(context);
projectsProvider = Provider.of(context);
double drawerWidth = SizeConfig.realScreenWidth * 0.60;
return RoundedContainer(
child: Container(
color: Colors.white,
child: Drawer(
child: Column(children: <Widget>[
Expanded(
flex: 4,
child: ListView(padding: EdgeInsets.zero, children: <Widget>[
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
child: Image.asset(
'assets/images/dr_app_logo.png',
width: SizeConfig.getWidthMultiplier(
width: drawerWidth) * 30,
),
margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 1, bottom: SizeConfig.heightMultiplier * 0.5),
),
Container(
child: InkWell(
onTap: () {
Navigator.pop(context);
},
child: Icon(
DoctorApp.close_1,
size: SizeConfig.heightMultiplier * 3,
),
),
margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2, bottom: SizeConfig.heightMultiplier * 0.5),
)
],
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
SizedBox(height: SizeConfig.heightMultiplier * 0.5,),
if (authenticationViewModel.doctorProfile != null)
InkWell(
onTap: () {
// TODO: return it back when its needed
// Navigator.of(context).pushNamed(PROFILE, arguments: {
// 'title': authProvider.doctorProfile.doctorName,
// "doctorProfileall": authProvider.doctorProfile
// });
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 10),
child: AppText(
TranslationBase
.of(context)
.dr +
authenticationViewModel.doctorProfile
?.doctorName,
fontWeight: FontWeight.bold,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth(
width: drawerWidth) * 8,
),
),
Padding(
padding: EdgeInsets.only(top: 0),
child: AppText(
authenticationViewModel.doctorProfile
?.clinicDescription,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth(
width: drawerWidth) * 6,
fontFamily: 'Poppins',
))
],
),
),
SizedBox(height: SizeConfig.heightMultiplier * 4,),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.applyOrRescheduleLeave,
icon: DoctorApp.reschedule__1,
drawerWidth: drawerWidth,
// subTitle: ,
),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddRescheduleLeavScreen(),
// MyReferredPatient(),
));
},
),
SizedBox(height: SizeConfig.heightMultiplier *2),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.myQRCode,
icon: DoctorApp.qr_code_3,
drawerWidth: drawerWidth,
// subTitle: ,
),
),
SizedBox(height: SizeConfig.heightMultiplier *1.5),
InkWell(
child: Container(
// height: 80,
child: Image.asset('assets/images/qr_code.png',
width: SizeConfig.getWidthMultiplier(
width: drawerWidth) * 30,
),
),
onTap: () {},
),
],
),
),
SizedBox(
height: SizeConfig.heightMultiplier * 5,
),
Container(
margin: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: [
InkWell(
child: DrawerItem(
projectsProvider.isArabic
? TranslationBase
.of(context)
.lanEnglish
: TranslationBase
.of(context)
.lanArabic,
// icon: DoctorApp.qr_code,
assetLink: projectsProvider.isArabic
? 'assets/images/usa-flag.png'
: 'assets/images/saudi-arabia-flag.png',
drawerWidth: drawerWidth,
),
onTap: () {
if (projectsProvider.isArabic)
projectsProvider.changeLanguage('en');
else
projectsProvider.changeLanguage('ar');
},
),
SizedBox(height: SizeConfig.heightMultiplier *0.5 ),
InkWell(
child: DrawerItem(
TranslationBase
.of(context)
.logout,
icon: DoctorApp.logout_1,
drawerWidth: drawerWidth,
),
onTap: () async {
Navigator.pop(context);
GifLoaderDialogUtils.showMyDialog(context);
await authenticationViewModel.logout(isFromLogin: false);
// GifLoaderDialogUtils.showMyDialog(context);
},
),
],
),
),
]),
),
Expanded(
flex: 1,
child: Column(children: <Widget>[
Container(
child: Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width * 0.3,
child: RichText(
text: TextSpan(
text: 'Powered by',
style: TextStyle(
color: Color(0xFF989898),
fontWeight: FontWeight.bold,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth(
width: drawerWidth) * 6,
fontFamily: 'Poppins',
),
children: <TextSpan>[
TextSpan(
text: ' Cloud Solutions',
style: TextStyle(
color: Color(0xFF2E303A),
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth(
width: drawerWidth) * 7,
fontFamily: 'Poppins',
),
)
]),
),
),
Image.asset(
'assets/images/cs_logo_container.png',
width: SizeConfig.imageSizeMultiplier * 20,
)
],
))))
]))
])),
),
width: drawerWidth,
margin: EdgeInsets.all(0),
customCornerRaduis: false,
// topRight: 30,
// bottomRight: 30,
backgroundColor: Colors.white,
);
}
drawerNavigator(context, routeName) {
Navigator.of(context).pushNamed(routeName);
}
}