import 'package:doctor_app_flutter/core/viewModel/auth_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:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:provider/provider.dart'; import '../../config/size_config.dart'; import '../../routes.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(); // OWNER : Ibrahim albitar // DATE : 06-04-2020 // DESCRIPTION : Custom App Drawer for app. class AppDrawer extends StatefulWidget { @override _AppDrawerState createState() => _AppDrawerState(); } class _AppDrawerState extends State { bool _isInit = true; Helpers helpers = new Helpers(); ProjectViewModel projectsProvider; @override Widget build(BuildContext context) { AuthViewModel authProvider = Provider.of(context); projectsProvider = Provider.of(context); return RoundedContainer( child: Container( color: Colors.white, child: Drawer( child: Column(children: [ Expanded( flex: 4, child: ListView(padding: EdgeInsets.zero, children: [ Container( margin: EdgeInsets.symmetric(horizontal: 20), // height: SizeConfig.heightMultiplier * 50, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Image.asset( 'assets/images/dr_app_logo.png', ), margin: EdgeInsets.only(top: 10, bottom: 10), ), SizedBox(height: 10), if (authProvider.doctorProfile != null) InkWell( onTap: () { 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 + authProvider.doctorProfile?.doctorName, fontWeight: FontWeight.bold, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontSize: 17, ), ), Padding( padding: EdgeInsets.only(top: 5), child: AppText( authProvider.doctorProfile?.clinicDescription, fontWeight: FontWeight.w600, color: Color(0xFF2E303A), fontSize: 15, fontFamily: 'Poppins', )) ], ), ), SizedBox(height: 10), InkWell( child: DrawerItem( TranslationBase.of(context).rescheduleLeaves, // " or " + // TranslationBase.of(context).leaves, DoctorApp.reschedule__1, // subTitle: , ), onTap: () { Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (context) => AddRescheduleLeavScreen(), // MyReferredPatient(), )); }, ), SizedBox(height: 10), InkWell( child: DrawerItem( 'My QR Code', // " or " + // TranslationBase.of(context).leaves, DoctorApp.qr_code_3, // subTitle: , ), ), InkWell( child: Container( height: 80, child: Image.asset('assets/images/qr_code.png'), ), onTap: () { }, ), ], ), ), SizedBox( height: 40, ), Container( margin: EdgeInsets.symmetric(horizontal: 20), child: Column( children: [ InkWell( child: DrawerItem( projectsProvider.isArabic ? TranslationBase.of(context).lanEnglish : TranslationBase.of(context).lanArabic, DoctorApp.qr_code), onTap: () { if (projectsProvider.isArabic) projectsProvider.changeLanguage('en'); else projectsProvider.changeLanguage('ar'); }, ), InkWell( child: DrawerItem( TranslationBase.of(context).logout, DoctorApp.logout_1), onTap: () async { Navigator.pop(context); await helpers.logout(); projectsProvider.isLogin = false; }, ), ], ), ), ]), ), Expanded( flex: 1, child: Column(children: [ Container( // This align moves the children to the bottom child: Align( alignment: FractionalOffset.bottomCenter, child: Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ 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.textMultiplier * 2, fontFamily: 'Poppins',), children: [ TextSpan(text: ' Cloud Solutions', style: TextStyle( color: Color(0xFF2E303A), fontSize: SizeConfig.textMultiplier * 2, fontFamily: 'Poppins',), ) ] ),), ), // Text("Powered by"), Image.asset( 'assets/images/cs_logo_container.png', width: SizeConfig.imageSizeMultiplier * 20, ) ], )))) ])) ])), ), width: SizeConfig.realScreenWidth * 0.60, margin: 0, customCornerRaduis: false, // topRight: 30, // bottomRight: 30, backgroundColor: Colors.white, ); } drawerNavigator(context, routeName) { Navigator.of(context).pushNamed(routeName); } }