From 9ed5a294ab3d443f27910d10d925cea77dd07437 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Tue, 16 Feb 2021 18:50:15 +0300 Subject: [PATCH] dashboard changes --- lib/screens/dashboard_screen.dart | 208 +++++++++++------- .../profile/profile-welcome-widget.dart | 14 +- 2 files changed, 133 insertions(+), 89 deletions(-) diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index b4f76ece..d2369e9d 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -62,6 +62,7 @@ class _DashboardScreenState extends State { bool isExpanded = false; String isInpatient = ""; var clinicName = []; + var clinicId = 1; void didChangeDependencies() async { super.didChangeDependencies(); if (_isInit) { @@ -140,90 +141,139 @@ class _DashboardScreenState extends State { Column( children: [ ProfileWelcomeWidget( - InkWell( - onTap: () async { - showCupertinoPicker( - decKey: '', - context: context, - actionList: projectsProvider.doctorClinicsList); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.start, + Container( + width: MediaQuery.of(context).size.width * .6, + // height: 100, + child: DropdownButtonHideUnderline( + child: DropdownButton( + dropdownColor: Colors.white, + iconEnabledColor: Colors.white, + isExpanded: true, + value: clinicId, + iconSize: 25, + elevation: 16, + selectedItemBuilder: (BuildContext context) { + return projectsProvider.doctorClinicsList + .map((item) { + return Row( + mainAxisSize: MainAxisSize.max, children: [ - SizedBox( - height: 4, - ), - InkWell( - onTap: () async { - showCupertinoPicker( - decKey: '', - context: context, - actionList: projectsProvider - .doctorClinicsList); - }, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Container( - child: AppText( - authProvider.selectedClinicName != - null - ? authProvider - .selectedClinicName - : authProvider.doctorProfile - .clinicDescription, - fontSize: - SizeConfig.textMultiplier * - 1.7, - color: Colors.white, - textAlign: TextAlign.center, - ), - alignment: projectsProvider.isArabic - ? Alignment.topRight - : Alignment.topLeft, - ), - Row( - mainAxisAlignment: - MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - InkWell( - child: Container( - margin: EdgeInsets.only( - left: 5, - top: projectsProvider - .isArabic - ? 0 - : 5, - right: 10, - bottom: projectsProvider - .isArabic - ? 15 - : 7), - child: Icon( - DoctorApp.sync_icon, - color: Colors.white, - size: SizeConfig - .textMultiplier * - 1.8, - )), - ), - ], - ), - ]), + AppText( + item.clinicName, + fontSize: SizeConfig.textMultiplier * 2.1, + color: Colors.white, ), ], + ); + }).toList(); + }, + onChanged: (newValue) { + clinicId = newValue; + changeClinic(newValue, context); + }, + items: projectsProvider.doctorClinicsList.map((item) { + return DropdownMenuItem( + child: Text( + item.clinicName, + textAlign: TextAlign.end, ), - ]), + value: item.clinicID, + ); + }).toList(), + )), ), ), + // InkWell( + // onTap: () async { + // showCupertinoPicker( + // decKey: '', + // context: context, + // actionList: projectsProvider.doctorClinicsList); + // }, + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: MainAxisAlignment.start, + // children: [ + // SizedBox( + // height: 4, + // ), + // InkWell( + // onTap: () async { + // // showCupertinoPicker( + // // decKey: '', + // // context: context, + // // actionList: projectsProvider + // // .doctorClinicsList); + // }, + // child: + // Container( + // alignment: projectsProvider.isArabic + // ? Alignment.topRight + // : Alignment.topLeft, + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + + // Container( + // child: AppText( + // authProvider.selectedClinicName != + // null + // ? authProvider + // .selectedClinicName + // : authProvider.doctorProfile + // .clinicDescription, + // fontSize: + // SizeConfig.textMultiplier * + // 1.7, + // color: Colors.white, + // textAlign: TextAlign.center, + // ), + // alignment: projectsProvider.isArabic + // ? Alignment.topRight + // : Alignment.topLeft, + // ), + // Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.max, + // crossAxisAlignment: + // CrossAxisAlignment.start, + // children: [ + // InkWell( + // child: Container( + // margin: EdgeInsets.only( + // left: 5, + // top: projectsProvider + // .isArabic + // ? 0 + // : 5, + // right: 10, + // bottom: + // projectsProvider + // .isArabic + // ? 15 + // : 7), + // child: Icon( + // Icons.arrow_drop_down, + // color: Colors.white, + // size: SizeConfig + // .textMultiplier * + // 3, + // )), + // ), + // ], + //), + // ])), + // ), + // ], + // ), + //]), + // ), + // ), Container( color: Colors.white, height: MediaQuery.of(context).size.height * 0.45, @@ -1522,7 +1572,7 @@ class _DashboardScreenState extends State { } changeClinic(clinicId, BuildContext context) async { - Navigator.pop(context); + // Navigator.pop(context); changeIsLoading(true); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile); diff --git a/lib/widgets/patients/profile/profile-welcome-widget.dart b/lib/widgets/patients/profile/profile-welcome-widget.dart index ac61f838..fe5a9c9b 100644 --- a/lib/widgets/patients/profile/profile-welcome-widget.dart +++ b/lib/widgets/patients/profile/profile-welcome-widget.dart @@ -7,9 +7,8 @@ import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; class ProfileWelcomeWidget extends StatelessWidget { - final Widget clinicWidget; -final double height; + final double height; ProfileWelcomeWidget(this.clinicWidget, {this.height = 140}); @@ -43,7 +42,7 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, children: [ AppText( - TranslationBase.of(context).dr + + TranslationBase.of(context).dr + ' ${authProvider.doctorProfile.doctorName}', fontWeight: FontWeight.bold, fontSize: SizeConfig.textMultiplier * 2.5, @@ -62,16 +61,12 @@ final double height; mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [ - CircleAvatar( - // radius: (52) child: ClipRRect( - borderRadius:BorderRadius.circular(10), - + borderRadius: BorderRadius.circular(10), child: Image.network( - authProvider - .doctorProfile.doctorImageURL, + authProvider.doctorProfile.doctorImageURL, fit: BoxFit.fill, width: 70, height: 60, @@ -79,7 +74,6 @@ final double height; ), backgroundColor: Colors.transparent, ) - ], ), ),