From f8c14a88eedb7cde1cd1dc8dc948415c847b5533 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 28 Mar 2021 17:59:37 +0300 Subject: [PATCH 1/3] fix schedule --- lib/util/date-utils.dart | 10 ++ lib/widgets/doctor/my_schedule_widget.dart | 115 ++++++++++++-------- lib/widgets/shared/card_with_bg_widget.dart | 2 +- 3 files changed, 81 insertions(+), 46 deletions(-) diff --git a/lib/util/date-utils.dart b/lib/util/date-utils.dart index 51089567..9396c2f0 100644 --- a/lib/util/date-utils.dart +++ b/lib/util/date-utils.dart @@ -284,4 +284,14 @@ class DateUtils { } return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; } + + static bool isToday(DateTime dateTime){ + + DateTime todayDate = DateTime.now().toUtc(); + if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) { + return true; + } + return false; + + } } diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 34ec97db..bc681a94 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -1,8 +1,9 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart'; +import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,58 +17,82 @@ class MyScheduleWidget extends StatelessWidget { List workingHours = Helpers.getWorkingHours( workingHoursTable.workingHours, ); - return CardWithBgWidgetNew( - widget: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - children: [ - Divider( - height: 1, - color: Colors.grey, - thickness: 1.0, - ), - ], + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + AppText( + workingHoursTable.dayName, + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + // fontSize: 18 ), SizedBox( height: 10, ), - Row( - children: [ - AppText( - workingHoursTable.dayName, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - AppText( - ' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}', - fontSize: 2.2 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ), - ], + AppText( + ' ${workingHoursTable.date.day} ${(DateUtils.getMonth(workingHoursTable.date.month).toString().substring(0, 3))}', + fontSize: 2.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w700, + + fontFamily: 'Poppins', + // fontSize: 18 ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: workingHours.map((work) { - return Container( - child: Column( - children: [ - SizedBox( - height: 5, - ), - AppText( - work.from + ' - ' + work.to, - fontSize: 2.0 * SizeConfig.textMultiplier, - fontWeight: FontWeight.w300, - ) - ], + ], + ), + Container( + width: MediaQuery.of(context).size.width * 0.55, + child: CardWithBgWidget( + bgColor: DateUtils.isToday(workingHoursTable.date) + ? Colors.green[500] + : Colors.transparent, + hasBorder: false, + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (DateUtils.isToday(workingHoursTable.date)) + AppText( + "Today", + fontSize: 2.5 * SizeConfig.textMultiplier, + fontFamily: 'Poppins', + color: Colors.green[500], + // fontSize: 18 + ), + SizedBox( + height: 10, ), - ); - }).toList(), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: workingHours.map((work) { + return Container( + child: Column( + children: [ + SizedBox( + height: 5, + ), + AppText( + work.from + ' - ' + work.to, + fontSize: 2.0 * SizeConfig.textMultiplier, + fontWeight: FontWeight.w300, + ) + ], + ), + ); + }).toList(), + ), + ], + ), ), - ], + ), ), - ), + ], ); } } diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index 4a274529..b4da8d28 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -24,7 +24,7 @@ class CardWithBgWidget extends StatelessWidget { ProjectViewModel projectProvider = Provider.of(context); return Container( margin: EdgeInsets.symmetric(vertical: 10.0), - width: double.infinity, + // width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), From c1868d98a46611c9f6f8c4caf3ef8e9ed3ab0539 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 28 Mar 2021 18:04:08 +0300 Subject: [PATCH 2/3] small fix --- lib/widgets/doctor/my_schedule_widget.dart | 2 +- lib/widgets/shared/card_with_bg_widget.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index bc681a94..25e794cf 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -52,7 +52,7 @@ class MyScheduleWidget extends StatelessWidget { bgColor: DateUtils.isToday(workingHoursTable.date) ? Colors.green[500] : Colors.transparent, - hasBorder: false, + // hasBorder: false, widget: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index b4da8d28..3b65bba5 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -31,7 +31,7 @@ class CardWithBgWidget extends StatelessWidget { ), border: Border.all( color: hasBorder ? HexColor('#707070') : Colors.transparent, - width: hasBorder ? 2.0 : 0), + width: hasBorder ? 0.30 : 0), ), child: Material( borderRadius: BorderRadius.all(Radius.circular(10.0)), From 8beab7d84f5411221ef76d3c32a4b97e3a186231 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 29 Mar 2021 15:23:30 +0300 Subject: [PATCH 3/3] finish drawer --- lib/widgets/doctor/my_schedule_widget.dart | 1 + lib/widgets/shared/app_drawer_widget.dart | 246 ++++++++++----------- lib/widgets/shared/drawer_item_widget.dart | 24 +- 3 files changed, 137 insertions(+), 134 deletions(-) diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart index 25e794cf..c28cc8d3 100644 --- a/lib/widgets/doctor/my_schedule_widget.dart +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -23,6 +23,7 @@ class MyScheduleWidget extends StatelessWidget { children: [ Column( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 84144f49..100e8c1d 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -31,14 +31,6 @@ class _AppDrawerState extends State { Helpers helpers = new Helpers(); ProjectViewModel projectsProvider; - // @override - // void didChangeDependencies() { - // super.didChangeDependencies(); - // // if (_isInit) { - // getDocProfile(); // TODO: Refactor this code to prevent errors in the cosole. - // // } - // _isInit = false; - // } @override Widget build(BuildContext context) { @@ -47,127 +39,112 @@ class _AppDrawerState extends State { return RoundedContainer( child: Container( color: Colors.white, - // margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 2), 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: InkWell( - child: DrawerHeader( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - child: Image.asset( - 'assets/images/logo.png', - ), - margin: EdgeInsets.only(top: 10, bottom: 15), - ), - SizedBox( - height: 1, - child: Container( - color: Colors.black26, - ), - ), - SizedBox(height: 15), - InkWell( - onTap: () { - Navigator.of(context) - .pushNamed(PROFILE, arguments: { - 'title': authProvider.doctorProfile.doctorName, - "doctorProfileall": authProvider.doctorProfile - }); - }, - child: Column( - children: [ - authProvider.doctorProfile != null - ? CircleAvatar( - radius: - SizeConfig.imageSizeMultiplier * 12, - // radius: (52) - child: ClipRRect( - borderRadius: BorderRadius.circular(50), - child: Image.network( - authProvider - .doctorProfile.doctorImageURL, - fit: BoxFit.fill, - width: 700, - ), - ), - backgroundColor: Colors.transparent, - ) - : SizedBox(), - authProvider.doctorProfile != null - ? Padding( - padding: EdgeInsets.only(top: 10), - child: AppText( - TranslationBase.of(context).dr + - authProvider - .doctorProfile?.doctorName, - fontWeight: FontWeight.bold, - color: Colors.black, - fontSize: SizeConfig.textMultiplier * 2, - )) - : SizedBox(), - ], - ), - ), - RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(18.0), - side: BorderSide(color: Colors.red)), - child: AppText( - TranslationBase.of(context).logout, - color: Colors.white, - ), - onPressed: () async { - Navigator.pop(context); - await helpers.logout(); - projectsProvider.isLogin = false; - }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Image.asset( + 'assets/images/dr_app_logo.png', + ), + margin: EdgeInsets.only(top: 10, bottom: 15), + ), + SizedBox(height: 15), + 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: SizeConfig.textMultiplier * 2.5, + ), + ), + Padding( + padding: EdgeInsets.only(top: 5), + child: AppText( + authProvider.doctorProfile?.clinicDescription, + fontWeight: FontWeight.w600, + color: Color(0xFF2E303A), + fontSize: SizeConfig.textMultiplier * 2, + fontFamily: 'Poppins', + )) + ], ), - ], + ), + SizedBox(height: 15), + InkWell( + child: DrawerItem( + TranslationBase.of(context).rescheduleLeaves, + // " or " + + // TranslationBase.of(context).leaves, + + DoctorApp.leaves, + // subTitle: , + ), + onTap: () { + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AddRescheduleLeavScreen(), + // MyReferredPatient(), + )); + }, ), - ), + ], ), ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).settings, Icons.settings), - onTap: () { - Navigator.pop(context); - Navigator.of(context).pushNamed(SETTINGS); - }, + SizedBox( + height: 40, ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).reschedule, - DoctorApp.leaves, - subTitle: TranslationBase.of(context).leaves, + Container( + margin: EdgeInsets.symmetric(horizontal: 20), + child: Column( + children: [ + InkWell( + child: DrawerItem( + TranslationBase.of(context).logout, Icons.settings), + onTap: () async { + Navigator.pop(context); + await helpers.logout(); + projectsProvider.isLogin = false; + }, + ), + 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'); + }, + ), + ], ), - onTap: () { - Navigator.pop(context); - - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AddRescheduleLeavScreen(), - // MyReferredPatient(), - )); - }, - ), - InkWell( - child: DrawerItem( - TranslationBase.of(context).qr + - TranslationBase.of(context).reader, - DoctorApp.qr_code), - onTap: () { - Navigator.pop(context); - Navigator.of(context).pushNamed(QR_READER); - }, ), ]), ), @@ -179,14 +156,35 @@ class _AppDrawerState extends State { child: Align( alignment: FractionalOffset.bottomCenter, child: Container( - child: Column( - children: [ - Text("Powered by"), - Image.asset( - 'assets/images/cs_logo_container.png', - width: SizeConfig.imageSizeMultiplier * 30, - ) - ], + 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, + ) + ], )))) ])) ])), diff --git a/lib/widgets/shared/drawer_item_widget.dart b/lib/widgets/shared/drawer_item_widget.dart index 83afb860..84691f7f 100644 --- a/lib/widgets/shared/drawer_item_widget.dart +++ b/lib/widgets/shared/drawer_item_widget.dart @@ -26,7 +26,7 @@ class _DrawerItemState extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), + margin: EdgeInsets.only(top: 5, bottom: 5, left: 0, right: 0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -39,15 +39,19 @@ class _DrawerItemState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - AppText( - widget.title, - color: widget.color ?? Colors.black, - textOverflow: TextOverflow.ellipsis, - // fontWeight: FontWeight.bold, - // margin: 5, - marginLeft: 5, - marginRight: 5, - fontSize: SizeConfig.textMultiplier * 2.3, + Container( + width: MediaQuery.of(context).size.width *0.45, + child: Expanded( + child: AppText( + widget.title, + marginLeft: 5, + marginRight: 5, + color:widget.color ??Color(0xFF2E303A), + fontSize: SizeConfig.textMultiplier * 2.0, + fontFamily: 'Poppins', + fontWeight: FontWeight.bold, + ), + ), ), AppText( widget.subTitle,