diff --git a/lib/models/list_doctor_working_hours_table_model.dart b/lib/models/list_doctor_working_hours_table_model.dart index d8ca8a04..cb103c8a 100644 --- a/lib/models/list_doctor_working_hours_table_model.dart +++ b/lib/models/list_doctor_working_hours_table_model.dart @@ -1,12 +1,14 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class ListDoctorWorkingHoursTable { - String date; + DateTime date; String dayName; String workingHours; ListDoctorWorkingHoursTable({this.date, this.dayName, this.workingHours}); ListDoctorWorkingHoursTable.fromJson(Map json) { - date = json['Date'] ; + date = Helpers.convertStringToDate(json['Date']) ; dayName = json['DayName']; workingHours = json['WorkingHours']; } @@ -19,3 +21,10 @@ class ListDoctorWorkingHoursTable { return data; } } + +class WorkingHours { + String from; + String to; + WorkingHours({this.from,this.to}); + +} diff --git a/lib/models/list_gt_my_pationents_question_model.dart b/lib/models/list_gt_my_pationents_question_model.dart index 8e7eac9c..b743ade6 100644 --- a/lib/models/list_gt_my_pationents_question_model.dart +++ b/lib/models/list_gt_my_pationents_question_model.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/util/helpers.dart'; + class ListGtMyPatientsQuestions { String setupID; int projectID; @@ -6,7 +8,7 @@ class ListGtMyPatientsQuestions { int patientID; int doctorID; int requestType; - String requestDate; + DateTime requestDate; String requestTime; String remarks; int status; @@ -58,7 +60,7 @@ class ListGtMyPatientsQuestions { patientID = json['PatientID']; doctorID = json['DoctorID']; requestType = json['RequestType']; - requestDate = json['RequestDate']; + requestDate = Helpers.convertStringToDate(json['RequestDate']) ; requestTime = json['RequestTime']; remarks = json['Remarks']; status = json['Status']; diff --git a/lib/models/request_doctor_reply.dart b/lib/models/request_doctor_reply.dart index e93850a2..fbbe4697 100644 --- a/lib/models/request_doctor_reply.dart +++ b/lib/models/request_doctor_reply.dart @@ -15,15 +15,15 @@ class RequestDoctorReply { bool patientOutSA; RequestDoctorReply( - {this.projectID , - this.doctorID , + {this.projectID =15 , + this.doctorID =70907 , this.transactionNo = TRANSACTION_NO, this.languageID = LANGUAGE_ID, this.stamp = STAMP, this.iPAdress = IP_ADDRESS, this.versionID = VERSION_ID, this.channel = CHANNEL, - this.tokenID , + this.tokenID ='@dm!n' , this.sessionID = SESSION_ID, this.isLoginForDoctorApp = IS_LOGIN_FOR_DOCTOR_APP, this.patientOutSA = PATIENT_OUT_SA}); diff --git a/lib/providers/doctor_reply_provider.dart b/lib/providers/doctor_reply_provider.dart index d28d12cd..1d2add69 100644 --- a/lib/providers/doctor_reply_provider.dart +++ b/lib/providers/doctor_reply_provider.dart @@ -27,13 +27,13 @@ class DoctorReplyProvider with ChangeNotifier { } getDoctorReply() async { - const url = BASE_URL + 'DoctorApplication.svc/REST/GtMyPatientsQuestions'; + const url = 'https://hmgwebservices.com/Services/DoctorApplication.svc/REST/GtMyPatientsQuestions'; Map profile = await sharedPref.getObj(DOCTOR_PROFILE); String token = await sharedPref.getString(TOKEN); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - _requestDoctorReply.doctorID = doctorProfile.doctorID; - _requestDoctorReply.projectID = doctorProfile.projectID; - _requestDoctorReply.tokenID = token; +// _requestDoctorReply.doctorID = doctorProfile.doctorID; +// _requestDoctorReply.projectID = doctorProfile.projectID; +// _requestDoctorReply.tokenID = token; try { if (await Helpers.checkConnection()) { final response = await client.post(url, diff --git a/lib/screens/QR_reader_screen.dart b/lib/screens/QR_reader_screen.dart index 4750b38e..bbbe327a 100644 --- a/lib/screens/QR_reader_screen.dart +++ b/lib/screens/QR_reader_screen.dart @@ -108,28 +108,6 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); ], ), ):Container(), - Column( - children: patientList.map((item) { - return InkWell( - onTap: (){ - Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": item, - }); - }, - child: AnimatedContainer( - duration: Duration(milliseconds: 200), - child: CardWithBgWidget( - widget: Container( - child: AppText( - '${item.firstName} ${item.lastName}', - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ), - ), - ); - }).toList() - ), ], ), @@ -172,11 +150,12 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); case "0": if (response['List_MyOutPatient'] != null) { setState(() { - patientList = ModelResponse - .fromJson(response['List_MyOutPatient']) - .list; + patientList = ModelResponse.fromJson(response['List_MyOutPatient']).list; isLoading = false; }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); } else { setState(() { isError = true; @@ -192,6 +171,9 @@ DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); isLoading = false; error = ""; }); + Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { + "patient": patientList[0], + }); } else { setState(() { error = 'No patient'; diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index 9f73feea..73585593 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -1,11 +1,16 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/providers/doctor_reply_provider.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/doctor/doctor_reply_widget.dart'; +import 'package:doctor_app_flutter/widgets/patients/profile/large_avatar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; @@ -40,81 +45,9 @@ class DoctorReplyScreen extends StatelessWidget { children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: _doctorReplyProvider.listDoctorWorkingHoursTable.map((reply) { - return CardWithBgWidget( - widget: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - reply.patientName, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 8, - ), - AppText( - reply.remarks, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).time, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - reply.requestTime, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).fileNo, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - '${reply.patientID}', - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - SizedBox( - height: 5, - ), - Row( - children: [ - AppText( - TranslationBase.of(context).mobileNo, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - Container( - margin: EdgeInsets.only(left: 10), - child: AppText( - reply.mobileNumber, - fontSize: 2.5 * SizeConfig.textMultiplier, - ), - ), - ], - ), - ], - ), - ), - ); + return DoctorReplyWidget( reply: reply); }).toList(), ) ], diff --git a/lib/screens/doctor/my_schedule_screen.dart b/lib/screens/doctor/my_schedule_screen.dart index b9f60889..711e2642 100644 --- a/lib/screens/doctor/my_schedule_screen.dart +++ b/lib/screens/doctor/my_schedule_screen.dart @@ -1,6 +1,9 @@ import 'package:doctor_app_flutter/providers/schedule_provider.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/doctor/my_schedule_widget.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/dr_app_circular_progress_Indeicator.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -49,9 +52,7 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - AppText(TranslationBase.of(context).mySchedule, - fontSize: - 2.5 * SizeConfig.textMultiplier), + scheduleListByDate(), // scheduleListByDate('Wednesday, 8 April '), ], @@ -74,40 +75,7 @@ class MyScheduleScreen extends StatelessWidget { Container( child: Column( children: scheduleProvider.listDoctorWorkingHoursTable.map((item) { - return CardWithBgWidget( - widget: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(item.dayName, - fontSize: 2.5 * SizeConfig.textMultiplier), - SizedBox( - height: 8, - ), - !item.workingHours.contains('and') - ? AppText(item.workingHours, - fontSize: 2.5 * SizeConfig.textMultiplier) - : Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - item.workingHours.substring( - 0, item.workingHours.indexOf('a')), - fontSize: 2.5 * SizeConfig.textMultiplier), - AppText( - item.workingHours.substring( - item.workingHours.indexOf('d') + 2, - ), - fontSize: 2.5 * SizeConfig.textMultiplier), - ], - ), - SizedBox( - width: 8, - ) - ], - ), - ), - ); + return MyScheduleWidget(workingHoursTable: item,); }).toList(), ), ), diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index de75f0ec..45ad043d 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -17,7 +18,8 @@ DrAppToastMsg toastMsg = DrAppToastMsg(); */ class Helpers { int cupertinoPickerIndex = 0; -/* + +/* *@author: Elham Rababah *@Date:12/4/2020 *@param: context, items, decKey, onSelectFun @@ -42,7 +44,8 @@ class Helpers { mainAxisAlignment: MainAxisAlignment.end, children: [ CupertinoButton( - child: Text('Cancel'.toUpperCase(), style: textStyle(context)), + child: Text('Cancel'.toUpperCase(), + style: textStyle(context)), onPressed: () { Navigator.pop(context); }, @@ -78,9 +81,9 @@ class Helpers { TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); -/* - *@author: Elham Rababah - *@Date:12/4/2020 +/* + *@author: Elham Rababah + *@Date:12/4/2020 *@param: context, List items, decKey, onSelectFun *@return: Container widget *@desc: buildPickerIterm this function will build the items of the cupertino @@ -88,7 +91,8 @@ class Helpers { buildPickerItems(context, List items, decKey, onSelectFun) { return CupertinoPicker( magnification: 1.5, - scrollController: FixedExtentScrollController(initialItem: cupertinoPickerIndex), + scrollController: + FixedExtentScrollController(initialItem: cupertinoPickerIndex), // backgroundColor: Colors.black87, children: items.map((item) { @@ -98,7 +102,8 @@ class Helpers { ); }).toList(), - itemExtent: 25, //height of each item + itemExtent: 25, + //height of each item looping: true, onSelectedItemChanged: (int index) { // selectitem =index; @@ -107,11 +112,11 @@ class Helpers { ); } -/* - *@author: Elham Rababah - *@Date:12/4/2020 +/* + *@author: Elham Rababah + *@Date:12/4/2020 *@param: msg - *@return: + *@return: *@desc: showErrorToast */ showErrorToast([msg = null]) { @@ -142,6 +147,127 @@ class Helpers { } } + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: date in String formatted + *@return: DateTime + *@desc: convert String to DateTime + */ + static DateTime convertStringToDate(String date) { + const start = "/Date("; + const end = "+0300)"; + final startIndex = date.indexOf(start); + final endIndex = date.indexOf(end, startIndex + start.length); + return DateTime.fromMillisecondsSinceEpoch( + int.parse( + date.substring(startIndex + start.length, endIndex), + ), + ); + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: month in int formatted + *@return: DateTime + *@desc: convert month in int to month name + */ + static getMonth(int month) { + switch (month) { + case 1: + return "Jan"; + case 2: + return "Feb"; + case 3: + return "Mar"; + case 4: + return "Apr"; + case 5: + return "May"; + case 6: + return "Jun"; + case 7: + return "Jul"; + case 8: + return "Aug"; + case 9: + return "Sep"; + case 10: + return "Oct"; + case 11: + return "Nov"; + case 12: + return "Dec"; + } + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: week day in int formatted + *@return: DateTime + *@desc: convert week day in int to week day name + */ + static getWeekDay(int weekDay) { + switch (weekDay) { + case 1: + return "Monday"; + case 2: + return "Tuesday"; + case 3: + return "Wednesday"; + case 4: + return "Thursday"; + case 5: + return "Friday"; + case 6: + return "Saturday "; + case 7: + return "Sunday"; + } + } + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: DateTime + *@return: data formatted like Apr 26,2020 + *@desc: convert DateTime to data formatted + */ + static String getDate(DateTime dateTime) { + print(dateTime); + if (dateTime != null) + return getMonth(dateTime.month) + + " " + + dateTime.day.toString() + + "," + + dateTime.year.toString(); + else + return ""; + } + + /* + *@author: Mohammad Aljammal + *@Date:26/5/2020 + *@param: String workingHours + *@return: List + *@desc: convert workingHours string to List + */ + static List getWorkingHours(String workingHours ){ + List myWorkingHours =[]; + List listOfHours = workingHours.split('a'); + + listOfHours.forEach((element) { + WorkingHours workingHours = WorkingHours(); + var from = element.substring(element.indexOf('m ') + 2 , element.indexOf('To')-2); + workingHours.from = from.trim(); + var to = element.substring(element.indexOf('To') + 2); + workingHours.to = to.trim(); + myWorkingHours.add(workingHours); + }); + return myWorkingHours; + } + /* *@author: Elham Rababah *@Date:12/5/2020 diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart new file mode 100644 index 00000000..5ec30858 --- /dev/null +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -0,0 +1,177 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/list_gt_my_pationents_question_model.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/patients/profile/large_avatar.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class DoctorReplyWidget extends StatefulWidget { + final ListGtMyPatientsQuestions reply; + bool isShowMore = false; + + DoctorReplyWidget({Key key, this.reply}); + + @override + _DoctorReplyWidgetState createState() => _DoctorReplyWidgetState(); +} + +class _DoctorReplyWidgetState extends State { + @override + Widget build(BuildContext context) { + return Stack( + children: [ + Container( + margin: EdgeInsets.symmetric(vertical: 10.0), + width: double.infinity, + decoration: BoxDecoration( + color: Hexcolor('#FFFFFF'), + borderRadius: BorderRadius.all( + Radius.circular(20.0), + ), + ), + child: Container( + margin: EdgeInsets.all(5), + child: Column( + children: [ + SizedBox(height: 18,), + Container( + margin: EdgeInsets.only(right: 15), + child: Row( + children: [ + SizedBox(width: 5,), + LargeAvatar(name: widget.reply.patientName,url: '',), + SizedBox(width: 15,), + Expanded( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText( + widget.reply.patientName, + fontSize: 1.5 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + SizedBox( + height: 5, + ), + + Row( + children: [ + AppText( + TranslationBase.of(context).fileNo, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Container( + margin: EdgeInsets.only(left: 5), + child: AppText( + '${widget.reply.patientID}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + children: [ + AppText( + TranslationBase.of(context).mobileNo, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + Container( + margin: EdgeInsets.only(left: 5), + child: AppText( + widget.reply.mobileNumber, + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + SizedBox( + height: 5, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 70, + height: 20, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(60.0)), + color: Colors.green[600] + ), + child: Center( + child: AppText( + widget.reply.requestTime, + fontSize: 1.5 * SizeConfig.textMultiplier, + color: Colors.white, + ), + ), + ), + Container( + + child: AppText( + '${Helpers.getDate(widget.reply.requestDate)}', + fontSize: 1.7 * SizeConfig.textMultiplier, + fontWeight: FontWeight.bold, + color: Colors.black, + ), + ), + ], + ), + + ], + ), + ), + ) + + ], + ), + ), + + !widget.isShowMore ? SizedBox(height: 18,) : + AnimatedContainer( + duration: Duration(milliseconds: 200), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Divider(color: Colors.grey), + SizedBox(height: 5,), + AppText( + widget.reply.remarks, + fontSize: 2.5 * SizeConfig.textMultiplier, + //fontWeight: FontWeight.bold, + ), + SizedBox(height: 10,) + ], + ), + ), + + ], + ), + ), + ), + Positioned( + right: 5, + top: 20, + child: InkWell( + onTap: (){ + setState(() { + widget.isShowMore = !widget.isShowMore; + }); + }, + child: Icon(widget.isShowMore? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down)), + ) + ], + + ); + } +} diff --git a/lib/widgets/doctor/my_schedule_widget.dart b/lib/widgets/doctor/my_schedule_widget.dart new file mode 100644 index 00000000..c37d09ad --- /dev/null +++ b/lib/widgets/doctor/my_schedule_widget.dart @@ -0,0 +1,79 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/models/list_doctor_working_hours_table_model.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:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class MyScheduleWidget extends StatelessWidget { + final ListDoctorWorkingHoursTable workingHoursTable; + + MyScheduleWidget({Key key, this.workingHoursTable}); + + @override + Widget build(BuildContext context) { + List workingHours = Helpers.getWorkingHours(workingHoursTable.workingHours); + return CardWithBgWidgetNew( + widget: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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,), + ], + ), + SizedBox( + height: 8, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: workingHours.map((work) { + return Container( + child: Column( + children: [ + Divider(color: Colors.grey), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('From',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + AppText(work.from,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + ], + ), + ), + Container(height: SizeConfig.realScreenWidth * 0.1 ,width: 0.8,color: Colors.grey, + margin: EdgeInsets.only(left: 15,right: 15),), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AppText('To',fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.bold,), + AppText(work.to,fontSize: 2.2 * SizeConfig.textMultiplier,fontWeight: FontWeight.w300,) + ], + ), + ), + ], + ) + + ], + ), + ); + }).toList(), + ), + SizedBox( + width: 8, + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/patients/profile/avatar_gradients.dart b/lib/widgets/patients/profile/avatar_gradients.dart new file mode 100644 index 00000000..a6cce98d --- /dev/null +++ b/lib/widgets/patients/profile/avatar_gradients.dart @@ -0,0 +1,42 @@ +import 'package:flutter/material.dart'; + +class AvatarGradients{ + static List getGradients (String name) { + + int code = (name?.length ?? 0) > 0 ? name.toUpperCase()[0].codeUnits[0] : 1; + code += (name?.length ?? 0) > 1 ? name.toUpperCase()[1].codeUnits[0] : 0; + + List> colors = [ + [ + Color.fromRGBO(150, 222, 218, 1.0), + Color.fromRGBO(80, 201, 195, 1.0), + ], + [ + Color.fromRGBO(102, 126, 254, 1.0), + Color.fromRGBO(148, 75, 192, 1.0), + ], + [ + Color.fromRGBO(255, 177, 153, 1.0), + Color.fromRGBO(255, 8, 68, 1.0), + ], + [ + Color.fromRGBO(100, 210, 255, 1.0), + Color.fromRGBO(10, 60, 255, 1.0), + ], + [ + Color.fromRGBO(83, 120, 149, 1.0), + Color.fromRGBO(9, 32, 63, 1.0), + ], + [ + Color.fromRGBO(48, 210, 190, 1.0), + Color.fromRGBO(53, 132, 167, 1.0), + ], + [ + Color.fromRGBO(255, 179, 169, 1.0), + Color.fromRGBO(245, 103, 144, 1.0), + ] + ]; + + return colors[code % colors.length]; + } +} \ No newline at end of file diff --git a/lib/widgets/patients/profile/large_avatar.dart b/lib/widgets/patients/profile/large_avatar.dart new file mode 100644 index 00000000..ab28b9fe --- /dev/null +++ b/lib/widgets/patients/profile/large_avatar.dart @@ -0,0 +1,74 @@ +import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'avatar_gradients.dart'; + +class LargeAvatar extends StatelessWidget { + LargeAvatar({Key key, this.name, this.url, this.disableProfileView: false}) + : super(key: key); + + final String name; + final String url; + final bool disableProfileView; + + Widget _getAvatar() { + if (url != null && url.isNotEmpty && Uri.parse(url).isAbsolute) { + return Center( + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(60.0)), + child: Image.network( + url.trim(), + fit: BoxFit.cover, + width: 90.0, + height: 90.0, + ), + ), + ); + } else if (name == null || name.isEmpty) { + return Center( + child: AppText( + 'DR', + color: Colors.white, + )); + } else { + return Center( + child: AppText( + name[0].toUpperCase(), + color: Colors.white,fontSize: 18,fontWeight: FontWeight.bold, + )); + } + } + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: disableProfileView + ? null + : () { + //TODO when we need that + }, + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment(-1, -1), + end: Alignment(1, 1), + colors: [ + Colors.grey[100], + Colors.grey[800], + ] + ), + boxShadow: [ + BoxShadow( + color: Color.fromRGBO(0, 0, 0, 0.08), + offset: Offset(0.0, 5.0), + blurRadius: 16.0) + ], + borderRadius: BorderRadius.all(Radius.circular(50.0)), + ), + width: 90.0, + height: 90.0, + child: _getAvatar()), + ); + } +} diff --git a/lib/widgets/shared/card_with_bgNew_widget.dart b/lib/widgets/shared/card_with_bgNew_widget.dart index b4991736..de8c3e82 100644 --- a/lib/widgets/shared/card_with_bgNew_widget.dart +++ b/lib/widgets/shared/card_with_bgNew_widget.dart @@ -26,36 +26,14 @@ class CardWithBgWidgetNew extends StatelessWidget { width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.all( - Radius.circular(10.0), + Radius.circular(20.0), ), - // border: Border.all(color: Hexcolor('#707070'), width: 2.0), ), child: Material( - borderRadius: BorderRadius.all(Radius.circular(10.0)), + borderRadius: BorderRadius.all(Radius.circular(20.0)), color: Hexcolor('#FFFFFF'), child: Stack( children: [ - if (projectProvider.isArabic) - Positioned( - child: Container( - width: 10, - color: Hexcolor('#FFFFFF'), - - ), - bottom: 0, - top: 0, - right: 0, - ) - else - Positioned( - child: Container( - width: 10, - color: Hexcolor('#FFFFFF'), - ), - bottom: 0, - top: 0, - left: 0, - ), Container( padding: EdgeInsets.all(15.0), margin: EdgeInsets.only(left: 10),