From 0a2cb22042dfe36225d4bcbd2e44a1928429e24c Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 9 Sep 2020 13:13:50 +0300 Subject: [PATCH] design issues fixed --- lib/pages/MyAppointments/MyAppointments.dart | 205 ++++++++------- .../widgets/AppointmentCardView.dart | 5 +- lib/pages/family/my-family.dart | 245 +++++++++--------- lib/pages/landing/home_page.dart | 23 +- .../family_files/family_files_provider.dart | 8 +- .../others/app_expandable_notifier.dart | 68 ++++- 6 files changed, 299 insertions(+), 255 deletions(-) diff --git a/lib/pages/MyAppointments/MyAppointments.dart b/lib/pages/MyAppointments/MyAppointments.dart index dc6fc65c..aa0e7d98 100644 --- a/lib/pages/MyAppointments/MyAppointments.dart +++ b/lib/pages/MyAppointments/MyAppointments.dart @@ -216,87 +216,91 @@ class _MyAppointmentsState extends State Widget getBookedAppointments() { return Container( - child: widget.bookedAppoList.length != 0 - ? new ListView.builder( - itemCount: widget.bookedAppoList.length, - itemBuilder: (context, i) { - return AppointmentCard( - appo: widget.bookedAppoList[i], - onReloadAppointmentHistory: getPatientAppointmentHistory, - ); - }, - ) - : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noBookedAppointments, - style: TextStyle( - fontSize: 16.0, - )), - ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Container( - child: widget.bookedAppoList.length != 0 - ? SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - ...List.generate( - widget._patientBookedAppointmentListHospital.length, + child: widget.bookedAppoList.length != 0 + ? new ListView.builder( + itemCount: widget.bookedAppoList.length, + itemBuilder: (context, i) { + return AppointmentCard( + appo: widget.bookedAppoList[i], + onReloadAppointmentHistory: getPatientAppointmentHistory, + ); + }, + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Image.asset( + // "assets/images/new-design/noAppointmentIcon.png"), + // Container( + // margin: EdgeInsets.only(top: 10.0), + // child: Text(TranslationBase.of(context).noBookedAppointments, + // style: TextStyle( + // fontSize: 16.0, + // )), + // ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Container( + child: widget.bookedAppoList.length != 0 + ? SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + ...List.generate( + widget._patientBookedAppointmentListHospital + .length, (index) => AppExpandableNotifier( - title: widget - ._patientBookedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientBookedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - )), - ) - ], - ), - ) - : Container( - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Image.asset( - "assets/images/new-design/noAppointmentIcon.png"), - Container( - margin: EdgeInsets.only(top: 10.0), - child: Text("No Booked Appointments", - style: TextStyle( - fontSize: 16.0, - )), + title: widget + ._patientBookedAppointmentListHospital[ + index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: widget + ._patientBookedAppointmentListHospital[ + index] + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + )), + ) + ], + ), + ) + : Container( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/images/new-design/noAppointmentIcon.png"), + Container( + margin: EdgeInsets.only(top: 10.0), + child: Text("No Booked Appointments", + style: TextStyle( + fontSize: 16.0, + )), + ), + ], ), - ], + ), ), - ), - ), - ), - ) - ], - - )))); + ), + ) + ], + )))); } Widget getConfirmedAppointments() { @@ -341,7 +345,8 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noConfirmedAppointments , + child: Text( + TranslationBase.of(context).noConfirmedAppointments, style: TextStyle( fontSize: 16.0, )), @@ -363,23 +368,24 @@ class _MyAppointmentsState extends State ...List.generate( widget._patientArrivedAppointmentListHospital.length, (index) => AppExpandableNotifier( - title: widget + title: widget + ._patientArrivedAppointmentListHospital[index] + .filterName, + bodyWidget: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: widget ._patientArrivedAppointmentListHospital[index] - .filterName, - bodyWidget: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget - ._patientArrivedAppointmentListHospital[index] - .patientDoctorAppointmentList - .map((doctor) { - return AppointmentCard( - appo: doctor, - onReloadAppointmentHistory: - getPatientAppointmentHistory, - ); - }).toList(), - )), + .patientDoctorAppointmentList + .map((doctor) { + return AppointmentCard( + appo: doctor, + onReloadAppointmentHistory: + getPatientAppointmentHistory, + ); + }).toList(), + ), + ), ) ], ), @@ -394,10 +400,11 @@ class _MyAppointmentsState extends State Image.asset("assets/images/new-design/noAppointmentIcon.png"), Container( margin: EdgeInsets.only(top: 10.0), - child: Text(TranslationBase.of(context).noArrivedAppointments, - style: TextStyle( - fontSize: 16.0, - )), + child: + Text(TranslationBase.of(context).noArrivedAppointments, + style: TextStyle( + fontSize: 16.0, + )), ), ], ), diff --git a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart index b64bd232..a0bb7f40 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentCardView.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentCardView.dart @@ -24,7 +24,7 @@ class _ApointmentCardState extends State { navigateToAppointmentDetails(context, widget.appo); }, child: Card( - margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), + // margin: EdgeInsets.fromLTRB(20.0, 16.0, 20.0, 8.0), color: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), @@ -95,7 +95,8 @@ class _ApointmentCardState extends State { emptyIcon: Icons.star, ), Container( - transform: Matrix4.translationValues(15.0, -40.0, 0.0), + transform: + Matrix4.translationValues(15.0, -40.0, 0.0), child: Image.asset( "assets/images/new-design/arrow.png", width: 25.0, diff --git a/lib/pages/family/my-family.dart b/lib/pages/family/my-family.dart index 8a9ff531..698a6c75 100644 --- a/lib/pages/family/my-family.dart +++ b/lib/pages/family/my-family.dart @@ -106,7 +106,7 @@ class _MyFamily extends State with TickerProviderStateMixin { child: Column( children: [ Expanded( - flex:4, + flex: 4, child: FutureBuilder( future: getFamilyFiles(), // async work builder: (BuildContext context, @@ -192,7 +192,7 @@ class _MyFamily extends State with TickerProviderStateMixin { ), ), Expanded( - flex:1, + flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ @@ -269,55 +269,52 @@ class _MyFamily extends State with TickerProviderStateMixin { )), ], ), - Column( - - children: [ - Row(children: [ - Expanded(flex:3,child:AppText('Name')), - Expanded(flex:1,child:AppText('Allow')), - Expanded(flex:1,child:AppText('Reject')), - ]), - Column(children: snapshot + Column(children: [ + Row(children: [ + Expanded(flex: 3, child: AppText('Name')), + Expanded(flex: 1, child: AppText('Allow')), + Expanded(flex: 1, child: AppText('Reject')), + ]), + Column( + children: snapshot .data['GetAllPendingRecordsList'] .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Text( - result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.check_circle, - color: Colors.black, - ), - onPressed: () { - acceptRequest( - result, context); - }, - )), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteRequest( - result, context); - }, - )) - ], - )); - - }).toList()) - ] - ) + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: + Text(result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.check_circle, + color: Colors.black, + ), + onPressed: () { + acceptRequest( + result, context); + }, + )), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )) + ], + )); + }).toList()) + ]) ], ); } @@ -334,8 +331,9 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ FutureBuilder( future: getSentRequest(), // async work - builder: - (BuildContext context, AsyncSnapshot snapshot) { + builder: (BuildContext context, + AsyncSnapshot + snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding( @@ -345,32 +343,33 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text(snapshot.error)); + child: Text('No data found..')); else - return SingleChildScrollView( - child: Container( - height: SizeConfig.screenHeight *.3, - child: ListView( - children: snapshot - .data.getAllSharedRecordsByStatusList - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Text( - result.patientName)), - Expanded( - flex: 2, - child: AppText(result.statusDescription, color: Colors.red,)), - - ], - )); - - }).toList(), - ))); + return SingleChildScrollView( + child: Container( + height: SizeConfig.screenHeight * .3, + child: ListView( + children: snapshot + .data.getAllSharedRecordsByStatusList + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: + Text(result.patientName)), + Expanded( + flex: 2, + child: AppText( + result.statusDescription, + color: Colors.red, + )), + ], + )); + }).toList(), + ))); } }) ], @@ -384,8 +383,8 @@ class _MyFamily extends State with TickerProviderStateMixin { children: [ FutureBuilder( future: getUserViewRequest(), // async work - builder: (BuildContext context, - AsyncSnapshot snapshot) { + builder: + (BuildContext context, AsyncSnapshot snapshot) { switch (snapshot.connectionState) { case ConnectionState.waiting: return Padding( @@ -395,69 +394,62 @@ class _MyFamily extends State with TickerProviderStateMixin { if (snapshot.hasError) return Padding( padding: EdgeInsets.all(10), - child: Text(snapshot.error)); + child: Text('No data found..')); else return Column( children: [ Row( mainAxisAlignment: - MainAxisAlignment.spaceBetween, + MainAxisAlignment.spaceBetween, children: [ Expanded( flex: 3, - child: Text(TranslationBase.of(context) - .request)), + child: Text( + TranslationBase.of(context).request)), Expanded( flex: 2, child: Text( - TranslationBase.of(context) - .switchUser, + TranslationBase.of(context).switchUser, )), Expanded( flex: 1, child: Text( - TranslationBase.of(context) - .deleteView, + TranslationBase.of(context).deleteView, )), ], ), - Column( - - children: [ - Row(children: [ - Expanded(flex:3,child:AppText('Name')), - Expanded(flex:1,child:AppText('Delete')), - ]), - Column(children: snapshot - .data['GetAllPendingRecordsList'] - .map((result) { - return Padding( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - flex: 3, - child: Text( - result.patientName)), - Expanded( - flex: 1, - child: IconButton( - icon: Icon( - Icons.delete, - color: Colors.black, - ), - onPressed: () { - deleteRequest( - result, context); - }, - )), - - ], - )); - - }).toList()) - ] - ) + Column(children: [ + Row(children: [ + Expanded(flex: 3, child: AppText('Name')), + Expanded(flex: 1, child: AppText('Delete')), + ]), + Column( + children: snapshot + .data['GetAllPendingRecordsList'] + .map((result) { + return Padding( + padding: EdgeInsets.all(10), + child: Row( + children: [ + Expanded( + flex: 3, + child: Text(result.patientName)), + Expanded( + flex: 1, + child: IconButton( + icon: Icon( + Icons.delete, + color: Colors.black, + ), + onPressed: () { + deleteRequest( + result, context); + }, + )), + ], + )); + }).toList()) + ]) ], ); } @@ -539,10 +531,7 @@ class _MyFamily extends State with TickerProviderStateMixin { HOME, ); } - deleteRequest(result, context){ - } - acceptRequest(result, context){ - - } + deleteRequest(result, context) {} + acceptRequest(result, context) {} } diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index da9d9348..7d7138d0 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -468,7 +468,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.9, ) ], ), @@ -500,7 +500,7 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.9, ) ], ), @@ -515,8 +515,12 @@ class _HomePageState extends State { Container( width: MediaQuery.of(context).size.width * 0.29, child: InkWell( - onTap: ()=>Navigator.push(context, - FadePage(page: ErOptions(isAppbar: true,))), + onTap: () => Navigator.push( + context, + FadePage( + page: ErOptions( + isAppbar: true, + ))), child: Center( child: Padding( padding: const EdgeInsets.all(15.0), @@ -531,11 +535,12 @@ class _HomePageState extends State { height: 15, ), Texts( - TranslationBase.of(context).emergencyServices, + TranslationBase.of(context) + .emergencyServices, textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 2.0, + fontSize: SizeConfig.textMultiplier * 1.9, ) ], ), @@ -598,9 +603,9 @@ class _HomePageState extends State { context, FadePage(page: AllHabibMedicalService())), ), DashboardItem( - onTap: (){ - Navigator.push(context, FadePage(page: FeedbackHomePage())); - + onTap: () { + Navigator.push( + context, FadePage(page: FeedbackHomePage())); }, child: Container( width: double.infinity, diff --git a/lib/services/family_files/family_files_provider.dart b/lib/services/family_files/family_files_provider.dart index 1fcaefd2..f5a06df9 100644 --- a/lib/services/family_files/family_files_provider.dart +++ b/lib/services/family_files/family_files_provider.dart @@ -73,8 +73,7 @@ class FamilyFilesProvider with ChangeNotifier { onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { - AppToast.showErrorToast(message: error); - throw error; + return Future.value(error); }, body: request); sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( @@ -94,8 +93,9 @@ class FamilyFilesProvider with ChangeNotifier { onSuccess: (dynamic response, int statusCode) { localRes = response; }, onFailure: (String error, int statusCode) { - AppToast.showErrorToast(message: error); - throw error; + return Future.value(error); + //AppToast.showErrorToast(message: error); + //throw error; }, body: request); sharedPref.setObject(FAMILY_FILE, localRes); return Future.value( diff --git a/lib/widgets/others/app_expandable_notifier.dart b/lib/widgets/others/app_expandable_notifier.dart index 353846e1..55cc7bee 100644 --- a/lib/widgets/others/app_expandable_notifier.dart +++ b/lib/widgets/others/app_expandable_notifier.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:expandable/expandable.dart'; import 'package:flutter/material.dart'; @@ -6,48 +7,89 @@ import 'package:flutter/material.dart'; /// [bodyWidget] widget want to show in the body /// [title] the widget title /// [collapsed] The widget shown in the collapsed state -class AppExpandableNotifier extends StatelessWidget { +class AppExpandableNotifier extends StatefulWidget { final Widget headerWidget; final Widget bodyWidget; final String title; final Widget collapsed; - + bool expandFlag = false; + var controller = new ExpandableController(); AppExpandableNotifier( {this.headerWidget, this.bodyWidget, this.title, this.collapsed}); + _AppExpandableNotifier createState() => _AppExpandableNotifier(); +} +class _AppExpandableNotifier extends State { @override Widget build(BuildContext context) { return ExpandableNotifier( child: Padding( - padding: const EdgeInsets.only(left: 10,right: 10,top: 4), + padding: const EdgeInsets.only(left: 10, right: 10, top: 4), child: Card( clipBehavior: Clip.antiAlias, child: Column( children: [ SizedBox( - child: headerWidget, + child: widget.headerWidget, ), ScrollOnExpand( scrollOnExpand: true, scrollOnCollapse: false, child: ExpandablePanel( + hasIcon: false, theme: const ExpandableThemeData( headerAlignment: ExpandablePanelHeaderAlignment.center, tapBodyToCollapse: true, ), - header: Padding( - padding: EdgeInsets.all(10), - child: Text( - title?? 'Details', - style: TextStyle(fontWeight: FontWeight.bold,fontSize: 22,), - ), - ), - collapsed: collapsed ?? Container(), - expanded: bodyWidget, + header: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Text( + widget.title ?? 'Details', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: SizeConfig.textMultiplier * 2, + ), + ), + ), + new IconButton( + icon: new Container( + height: 28.0, + width: 30.0, + decoration: new BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + child: new Center( + child: new Icon( + widget.expandFlag + ? Icons.keyboard_arrow_up + : Icons.keyboard_arrow_down, + color: Colors.white, + size: 30.0, + ), + ), + ), + onPressed: () { + setState(() { + widget.expandFlag = !widget.expandFlag; + if (widget.expandFlag == true) { + widget.controller.expanded = true; + } else { + widget.controller.expanded = false; + } + }); + }), + ]), + collapsed: widget.collapsed ?? Container(), + expanded: widget.bodyWidget, builder: (_, collapsed, expanded) { return Padding( padding: EdgeInsets.only(left: 5, right: 5, bottom: 5), child: Expandable( + controller: widget.controller, collapsed: collapsed, expanded: expanded, theme: const ExpandableThemeData(crossFadePoint: 0),