Merge branch 'development_new_design_2.0' into haroon-new-design

# Conflicts:
#	lib/pages/MyAppointments/SchedulePage.dart
merge-update-with-lab-changes
haroon amjad 4 years ago
commit 3f3ddd7af0

@ -45,7 +45,7 @@ class PrescriptionsViewModel extends BaseViewModel {
setState(ViewState.Error); setState(ViewState.Error);
} else { } else {
_filterList(); _filterList();
await getPrescriptionsOrders(); // await getPrescriptionsOrders();
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }

@ -1,13 +1,17 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/insert_user_activity_request_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:percent_indicator/circular_percent_indicator.dart'; import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
@ -17,13 +21,27 @@ import 'package:wave/wave.dart';
import 'Dialog/confirm_add_amount_dialog.dart'; import 'Dialog/confirm_add_amount_dialog.dart';
import 'add_custom_amount.dart'; import 'add_custom_amount.dart';
class TodayPage extends StatelessWidget { class TodayPage extends StatefulWidget {
TodayPage({Key key}) : super(key: key);
@override
_TodayPageState createState() {
return _TodayPageState();
}
}
class _TodayPageState extends State<TodayPage> {
TextEditingController _h20AmountController = TextEditingController();
bool isUnitML = true;
Future<bool> readPrefs() async { Future<bool> readPrefs() async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
return (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false; isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false;
return isUnitML;
} }
bool canShowAddButton = false;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<H2OViewModel>( return BaseView<H2OViewModel>(
@ -46,7 +64,6 @@ class TodayPage extends StatelessWidget {
child: FutureBuilder<bool>( child: FutureBuilder<bool>(
future: readPrefs(), future: readPrefs(),
builder: (context, data) { builder: (context, data) {
var isUnitML = true;
String unit; String unit;
if (data.connectionState == ConnectionState.done) { if (data.connectionState == ConnectionState.done) {
isUnitML = data.data; isUnitML = data.data;
@ -152,8 +169,6 @@ class TodayPage extends StatelessWidget {
_circularButton(context, 330, model), _circularButton(context, 330, model),
SizedBox(height: 8), SizedBox(height: 8),
_circularButton(context, 200, model), _circularButton(context, 200, model),
// SizedBox(height: 8),
// _circularButton(context, 0, model, isCustom: true),
SizedBox(height: 8), SizedBox(height: 8),
InkWell( InkWell(
onTap: () => undoVolume(context, model), onTap: () => undoVolume(context, model),
@ -175,24 +190,114 @@ class TodayPage extends StatelessWidget {
), ),
), ),
SizedBox(height: 40), SizedBox(height: 40),
// Text( Text(
// TranslationBase.of(context).addCustomAmount, TranslationBase.of(context).addCustomAmount,
// style: TextStyle( style: TextStyle(
// fontSize: 14, fontSize: 14,
// height: 21 / 14, height: 21 / 14,
// fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
// color: Color(0xff2B353E), color: Color(0xff2B353E),
// letterSpacing: -0.56, letterSpacing: -0.56,
// ), ),
// ), ),
SizedBox(height: 12),
Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
border: Border.all(
color: Color(0xffefefef),
width: 1,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Expanded(
flex: 3,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context).amount,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.44,
),
),
TextField(
controller: _h20AmountController,
keyboardType: TextInputType.number,
onChanged: (value) {
double _value = 0;
if (value.length > 0) _value = double.parse(value);
if (value.length > 0) {
if (canShowAddButton) {
return;
}
canShowAddButton = true;
setState(() {});
} else {
canShowAddButton = false;
setState(() {});
}
},
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
],
style: TextStyle(
color: Color(0xff575757),
letterSpacing: -0.56,
),
decoration: InputDecoration(
isDense: true,
hintText: "0",
hintStyle: TextStyle(
fontSize: 14,
height: 21 / 14,
fontWeight: FontWeight.w400,
color: Color(0xff575757),
letterSpacing: -0.56,
),
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
),
),
],
),
),
if (canShowAddButton)
Expanded(
flex: 1,
child: DefaultButton(
TranslationBase.of(context).add,
() async {
await showConfirmMessage(context, int.parse(_h20AmountController.text), model);
_h20AmountController.text = "";
canShowAddButton = false;
SystemChannels.textInput.invokeMethod('TextInput.hide');
setState(() {});
},
),
),
],
),
],
),
),
], ],
), ),
), ),
// floatingActionButton: H20FloatingActionButton(
// // controller: _controller,
// model: model,
// ),
), ),
); );
} }
@ -252,12 +357,19 @@ class TodayPage extends StatelessWidget {
); );
} }
void showConfirmMessage(context, int amount, H2OViewModel model) { Future showConfirmMessage(context, int amount, H2OViewModel model) async {
showDialog( String title = "${TranslationBase.of(context).areyousure} $amount ${(isUnitML ? TranslationBase.of(context).ml : TranslationBase.of(context).l).toLowerCase()} ?";
await showDialog(
context: context, context: context,
child: ConfirmAddAmountDialog( child: ConfirmWithMessageDialog(
model: model, message: title,
amount: amount, onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: amount);
await model.insertUserActivity(insertUserActivityRequestModel);
GifLoaderDialogUtils.hideDialog(context);
FocusManager.instance.primaryFocus.unfocus();
},
), ),
); );
} }

@ -164,11 +164,11 @@ class _SearchByDoctorState extends State<SearchByDoctor> {
getDoctorsList(context); getDoctorsList(context);
} }
Future navigateToSearchResults( navigateToSearchResults(
context, context,
List<DoctorList> docList, List<DoctorList> docList,
List<PatientDoctorAppointmentList> List<PatientDoctorAppointmentList>
patientDoctorAppointmentListHospital) async { patientDoctorAppointmentListHospital) {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(

@ -12,8 +12,7 @@ import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart' as list;
as list;
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart';
@ -53,15 +52,12 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
var userID; var userID;
TabController _tabController; TabController _tabController;
int _tabIndex = 0; int _tabIndex = 0;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>(); AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
AppointmentRateViewModel appointmentRateViewModel =
locator<AppointmentRateViewModel>();
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
AuthenticatedUser user; AuthenticatedUser user;
VitalSignService _vitalSignService = locator<VitalSignService>(); VitalSignService _vitalSignService = locator<VitalSignService>();
PharmacyModuleViewModel pharmacyModuleViewModel = PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
locator<PharmacyModuleViewModel>();
ToDoCountProviderModel toDoProvider; ToDoCountProviderModel toDoProvider;
var isVaiable = false; var isVaiable = false;
bool isSwitchUser = false; bool isSwitchUser = false;
@ -78,18 +74,12 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Widget build(BuildContext context) { Widget build(BuildContext context) {
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/0.png'),
); );
imagesInfo.add( imagesInfo.add(
ImagesInfo( ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/en/1.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/images-info-home/family-file/ar/1.png'),
); );
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
toDoProvider = Provider.of<ToDoCountProviderModel>(context); toDoProvider = Provider.of<ToDoCountProviderModel>(context);
@ -110,8 +100,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
labelColor: Color(0xff2B353E), labelColor: Color(0xff2B353E),
unselectedLabelColor: Color(0xff575757), unselectedLabelColor: Color(0xff575757),
labelPadding: labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle( labelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16, fontSize: 16,
@ -124,20 +113,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
), ),
tabs: [ tabs: [Text(TranslationBase.of(context).family), Text(TranslationBase.of(context).request)],
Text(TranslationBase.of(context).family),
Text(TranslationBase.of(context).request)
],
), ),
Expanded( Expanded(
child: (user != null && projectViewModel.isLogin) child: (user != null && projectViewModel.isLogin)
? TabBarView( ? TabBarView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: [ children: [myFamilyDetails(context), myFamilyRequest(context)],
myFamilyDetails(context),
myFamilyRequest(context)
],
) )
: Container(child: AppText('Loading..')), : Container(child: AppText('Loading..')),
), ),
@ -166,95 +149,47 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
flex: 4, flex: 4,
child: FutureBuilder( child: FutureBuilder(
future: getFamilyFiles(), // async work future: getFamilyFiles(), // async work
builder: (BuildContext context, builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) {
AsyncSnapshot<GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding( return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....'));
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding( return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
padding: EdgeInsets.all(10),
child: Text(
TranslationBase.of(context).noDataAvailable));
else else
return ListView.separated( return ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (snapshot if (snapshot.data.getAllSharedRecordsByStatusList[index].status == 3)
.data
.getAllSharedRecordsByStatusList[index]
.status ==
3)
return Card( return Card(
margin: EdgeInsets.all(10), margin: EdgeInsets.all(10),
shape: cardRadius(15), shape: cardRadius(15),
color: snapshot color: snapshot.data.getAllSharedRecordsByStatusList[index].gender == 1 ? Color(0xff6EA8FF) : Color(0xffFDA4B0),
.data
.getAllSharedRecordsByStatusList[
index]
.gender ==
1
? Color(0xff6EA8FF)
: Color(0xffFDA4B0),
elevation: 3, elevation: 3,
child: Container( child: Container(
// height: 130, // height: 130,
width: width: MediaQuery.of(context).size.width,
MediaQuery.of(context).size.width,
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Texts( Texts(
snapshot snapshot.data.getAllSharedRecordsByStatusList[index].patientName.toLowerCase().capitalizeFirstofEach,
.data
.getAllSharedRecordsByStatusList[
index]
.patientName
.toLowerCase()
.capitalizeFirstofEach,
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
), ),
Texts(TranslationBase.of(context).fileNumber + ': ' + snapshot.data.getAllSharedRecordsByStatusList[index].responseID.toString(),
fontSize: 12, color: Colors.white),
Texts( Texts(
TranslationBase.of(context) snapshot.data.getAllSharedRecordsByStatusList[index].age.toString() +
.fileNumber +
': ' +
snapshot
.data
.getAllSharedRecordsByStatusList[
index]
.responseID
.toString(),
fontSize: 12,
color: Colors.white),
Texts(
snapshot
.data
.getAllSharedRecordsByStatusList[
index]
.age
.toString() +
' ' + ' ' +
TranslationBase.of(context) TranslationBase.of(context).years +
.years +
', ' + ', ' +
snapshot snapshot.data.getAllSharedRecordsByStatusList[index].genderDescription,
.data
.getAllSharedRecordsByStatusList[
index]
.genderDescription,
fontSize: 12, fontSize: 12,
color: Colors.white), color: Colors.white),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
children: [ children: [
Row( Row(
children: [ children: [
@ -264,19 +199,11 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
setState(() { setState(() {
isSwitchUser = value; isSwitchUser = value;
}); });
if (isSwitchUser == if (isSwitchUser == true) switchUser(snapshot.data.getAllSharedRecordsByStatusList[index], context);
true)
switchUser(
snapshot.data
.getAllSharedRecordsByStatusList[
index],
context);
}, },
), ),
Texts( Texts(
TranslationBase.of( TranslationBase.of(context).switchUser,
context)
.switchUser,
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
) )
@ -284,18 +211,12 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
deleteFamily( deleteFamily(snapshot.data.getAllSharedRecordsByStatusList[index], context);
snapshot.data
.getAllSharedRecordsByStatusList[
index],
context);
}, },
child: Row( child: Row(
children: [ children: [
Texts( Texts(
TranslationBase.of( TranslationBase.of(context).delete,
context)
.delete,
color: Colors.white, color: Colors.white,
fontSize: 12, fontSize: 12,
), ),
@ -309,13 +230,13 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
) )
], ],
))); )));
else if (checkActive(snapshot.data.getAllSharedRecordsByStatusList) == 0)
return getNoDataWidget(context);
else else
return SizedBox.shrink(); return SizedBox(height: 0);
}, },
separatorBuilder: (context, index) => separatorBuilder: (context, index) => SizedBox(height: 0),
SizedBox(height: 0), itemCount: snapshot.data.getAllSharedRecordsByStatusList.length);
itemCount: snapshot
.data.getAllSharedRecordsByStatusList.length);
} }
}, },
), ),
@ -325,6 +246,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
)); ));
} }
int checkActive(List<GetAllSharedRecordsByStatusList> list) {
return list.where((o) => o.status == 3).toList().length;
}
Widget myFamilyRequest(context) { Widget myFamilyRequest(context) {
return //Padding( return //Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10.0), // padding: const EdgeInsets.symmetric(horizontal: 10.0),
@ -339,27 +264,18 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).userViewRequest, TranslationBase.of(context).userViewRequest,
style: TextStyle( style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black),
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getUserViewRequest(), // async work future: getUserViewRequest(), // async work
builder: (BuildContext context, builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding( return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....'));
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding( return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -372,60 +288,27 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded( Expanded(flex: 3, child: AppText(TranslationBase.of(context).name, fontWeight: FontWeight.w600)),
flex: 3, Expanded(flex: 1, child: AppText(TranslationBase.of(context).allow, fontWeight: FontWeight.w600)),
child: AppText( Expanded(flex: 1, child: AppText(TranslationBase.of(context).reject, fontWeight: FontWeight.w600)),
TranslationBase.of(
context)
.name,
fontWeight:
FontWeight.w600)),
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(
context)
.allow,
fontWeight:
FontWeight.w600)),
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(
context)
.reject,
fontWeight:
FontWeight.w600)),
])), ])),
Divider( Divider(color: Colors.black, height: 1),
color: Colors.black, height: 1),
Column( Column(
children: familyFileProvider children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) {
.allSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Container( return Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(flex: 3, child: Text(result.patientName)),
flex: 3,
child: Text(result
.patientName)),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons Icons.check_circle,
.check_circle, color: Colors.black,
color:
Colors.black,
), ),
onPressed: () { onPressed: () {
acceptRemoveRequest( acceptRemoveRequest(result.iD, 3, context);
result.iD,
3,
context);
}, },
)), )),
Expanded( Expanded(
@ -433,14 +316,10 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
Icons.delete, Icons.delete,
color: color: Colors.black,
Colors.black,
), ),
onPressed: () { onPressed: () {
acceptRemoveRequest( acceptRemoveRequest(result.iD, 4, context);
result.iD,
4,
context);
}, },
)) ))
], ],
@ -458,28 +337,18 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).sentRequest, TranslationBase.of(context).sentRequest,
style: TextStyle( style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black),
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getSentRequest(), // async work future: getSentRequest(), // async work
builder: (BuildContext context, builder: (BuildContext context, AsyncSnapshot<GetAllSharedRecordsByStatusResponse> snapshot) {
AsyncSnapshot<GetAllSharedRecordsByStatusResponse>
snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding( return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....'));
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding( return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -493,45 +362,22 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded( Expanded(flex: 3, child: AppText(TranslationBase.of(context).theName, fontWeight: FontWeight.w600)),
flex: 3, Expanded(flex: 2, child: AppText(TranslationBase.of(context).status, fontWeight: FontWeight.w600))
child: AppText(
TranslationBase.of(
context)
.theName,
fontWeight:
FontWeight.w600)),
Expanded(
flex: 2,
child: AppText(
TranslationBase.of(
context)
.status,
fontWeight:
FontWeight.w600))
])), ])),
Divider(color: Colors.black, height: 1), Divider(color: Colors.black, height: 1),
Column( Column(
children: snapshot.data children: snapshot.data.getAllSharedRecordsByStatusList.map<Widget>((result) {
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Padding( return Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(flex: 3, child: Text(result.patientName)),
flex: 3,
child: Text(result
.patientName)),
Expanded( Expanded(
flex: 2, flex: 2,
child: AppText( child: AppText(
result result.statusDescription,
.statusDescription, color: result.status == 3 ? Colors.green : Colors.red,
color:
result.status == 3
? Colors.green
: Colors.red,
)), )),
], ],
)); ));
@ -547,27 +393,18 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
child: ExpansionTile( child: ExpansionTile(
title: Text( title: Text(
TranslationBase.of(context).userView, TranslationBase.of(context).userView,
style: TextStyle( style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color: Colors.black),
fontSize: 16.0,
fontWeight: FontWeight.bold,
color: Colors.black),
), ),
children: <Widget>[ children: <Widget>[
FutureBuilder( FutureBuilder(
future: getUserViewRequest(), // async work future: getUserViewRequest(), // async work
builder: (BuildContext context, builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
AsyncSnapshot<dynamic> snapshot) {
switch (snapshot.connectionState) { switch (snapshot.connectionState) {
case ConnectionState.waiting: case ConnectionState.waiting:
return Padding( return Padding(padding: EdgeInsets.only(top: 50), child: Text('Loading....'));
padding: EdgeInsets.only(top: 50),
child: Text('Loading....'));
default: default:
if (snapshot.hasError) if (snapshot.hasError)
return Padding( return Padding(padding: EdgeInsets.all(10), child: Text(TranslationBase.of(context).noDataAvailable));
padding: EdgeInsets.all(10),
child: Text(TranslationBase.of(context)
.noDataAvailable));
else else
return Container( return Container(
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
@ -580,33 +417,17 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Padding( Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row(children: [ child: Row(children: [
Expanded( Expanded(flex: 3, child: AppText(TranslationBase.of(context).name)),
flex: 3, Expanded(flex: 1, child: AppText(TranslationBase.of(context).delete)),
child: AppText(
TranslationBase.of(
context)
.name)),
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(
context)
.delete)),
])), ])),
Divider(color: Colors.black), Divider(color: Colors.black),
Column( Column(
children: familyFileProvider children: familyFileProvider.allSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList.map<Widget>((result) {
.allSharedRecordsByStatusResponse
.getAllSharedRecordsByStatusList
.map<Widget>((result) {
return Padding( return Padding(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(flex: 3, child: AppText(result.patientName)),
flex: 3,
child: AppText(result
.patientName)),
Expanded( Expanded(
flex: 1, flex: 1,
child: IconButton( child: IconButton(
@ -615,10 +436,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
color: Colors.black, color: Colors.black,
), ),
onPressed: () { onPressed: () {
deactivateRequest( deactivateRequest(result.iD, 5, context);
result.iD,
5,
context);
}, },
)), )),
], ],
@ -648,10 +466,9 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async { Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async {
if (await sharedPref.getObject(FAMILY_FILE) != null) { if (await sharedPref.getObject(FAMILY_FILE) != null) {
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson( return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await sharedPref.getObject(FAMILY_FILE)));
await sharedPref.getObject(FAMILY_FILE)));
} else { } else {
return familyFileProvider.getSharedRecordByStatus().then((value) {}); return familyFileProvider.getSharedRecordByStatus();
} }
} }
@ -671,10 +488,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
confirmMessage: TranslationBase.of(context).removeFamilyMember, confirmMessage: TranslationBase.of(context).removeFamilyMember,
okText: TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => { okFunction: () => {ConfirmDialog.closeAlertDialog(context), removeFamily(family, context)},
ConfirmDialog.closeAlertDialog(context),
removeFamily(family, context)
},
cancelFunction: () => {}); cancelFunction: () => {});
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
@ -685,10 +499,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request['ID'] = this.userID; request['ID'] = this.userID;
request['IsActive'] = false; request['IsActive'] = false;
this this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context));
.familyFileProvider
.deativateActivateMemberFile(request)
.then((value) => refreshFamily(context));
} }
refreshFamily(context) { refreshFamily(context) {
@ -706,22 +517,16 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
// .then((value) => loginAfter(value, context)); // .then((value) => loginAfter(value, context));
// Utils.showProgressDialog(context); // Utils.showProgressDialog(context);
this this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) {
.familyFileProvider
.silentLoggin(user is AuthenticatedUser ? null : user,
mainUser: user is AuthenticatedUser)
.then((value) => loginAfter(value, context))
.catchError((err) {
print(err); print(err);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err.toString());
Navigator.of(context).pop(); Navigator.of(context).pop();
}); });
} }
loginAfter(result, context) async { loginAfter(result, context) async {
var currentLang = await sharedPref.getString(APP_LANGUAGE); var currentLang = await sharedPref.getString(APP_LANGUAGE);
Provider.of<ProjectViewModel>(context, listen: false) Provider.of<ProjectViewModel>(context, listen: false).setPrivilege(privilegeList: result, isLoginChild: true);
.setPrivilege(privilegeList: result, isLoginChild: true);
result = list.CheckActivationCode.fromJson(result); result = list.CheckActivationCode.fromJson(result);
var familyFile = await sharedPref.getObject(FAMILY_FILE); var familyFile = await sharedPref.getObject(FAMILY_FILE);
@ -742,10 +547,8 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
this.sharedPref.setString(TOKEN, result.authenticationTokenID); this.sharedPref.setString(TOKEN, result.authenticationTokenID);
await authenticatedUserObject.getUser(getUser: true); await authenticatedUserObject.getUser(getUser: true);
Provider.of<ProjectViewModel>(context, listen: false).user = Provider.of<ProjectViewModel>(context, listen: false).user = authenticatedUserObject.user;
authenticatedUserObject.user; Provider.of<ProjectViewModel>(context, listen: false).setUser(authenticatedUserObject.user);
Provider.of<ProjectViewModel>(context, listen: false)
.setUser(authenticatedUserObject.user);
appointmentRateViewModel appointmentRateViewModel
.getIsLastAppointmentRatedList() .getIsLastAppointmentRatedList()
@ -783,8 +586,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request["ID"] = ID; request["ID"] = ID;
request["Status"] = status; request["Status"] = status;
this.familyFileProvider.deactivateFamily(request).then((value) => this.familyFileProvider.deactivateFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
{GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
} }
acceptRemoveRequest(ID, status, context) { acceptRemoveRequest(ID, status, context) {
@ -792,17 +594,14 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
Map<String, dynamic> request = {}; Map<String, dynamic> request = {};
request["ID"] = ID; request["ID"] = ID;
request["Status"] = status; request["Status"] = status;
this.familyFileProvider.acceptRejectFamily(request).then((value) => this.familyFileProvider.acceptRejectFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
{GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)});
} }
checkUserData() async { checkUserData() async {
if (await this.sharedPref.getObject(USER_PROFILE) != null) { if (await this.sharedPref.getObject(USER_PROFILE) != null) {
var data = AuthenticatedUser.fromJson( var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE));
await this.sharedPref.getObject(USER_PROFILE));
var data2 = AuthenticatedUser.fromJson( var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER));
await this.sharedPref.getObject(MAIN_USER));
setState(() { setState(() {
this.user = data; this.user = data;
}); });
@ -815,8 +614,7 @@ class _MyFamily extends State<MyFamily> with TickerProviderStateMixin {
service.getActiveAppointmentNo(context).then((res) { service.getActiveAppointmentNo(context).then((res) {
print(res['AppointmentActiveNumber']); print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) { if (res['MessageStatus'] == 1 && res['AppointmentActiveNumber'] != null) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
toDoProvider.notificationsCount);
} else {} } else {}
}).catchError((err) { }).catchError((err) {
print(err); print(err);

@ -1,30 +1,33 @@
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/AppointmentDetails.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart';
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart'; import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
class SchedulePage extends StatefulWidget { class SchedulePage extends StatefulWidget {
DoctorList doctorList; DoctorList doctorList;
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
SchedulePage({ SchedulePage({
this.appo, this.appo,
this.doctorList, this.doctorList,
}); });
@override @override
_SchedulePageState createState() => _SchedulePageState(); _SchedulePageState createState() => _SchedulePageState();
} }
@ -42,7 +45,6 @@ class _SchedulePageState extends State<SchedulePage> {
bool isPageChange = false; bool isPageChange = false;
AppSharedPreferences sharedPref = AppSharedPreferences(); AppSharedPreferences sharedPref = AppSharedPreferences();
@override @override
void initState() { void initState() {
this.doctorList = widget.doctorList; this.doctorList = widget.doctorList;
@ -54,132 +56,169 @@ class _SchedulePageState extends State<SchedulePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<MedicalViewModel>( return BaseView<MedicalViewModel>(
onModelReady: (model) => model.getDoctorSchedule(doctorList), onModelReady: (model) => model.getDoctorSchedule(doctorList),
allowAny: true, allowAny: true,
builder: (_, model, widget) => BaseView<MedicalViewModel>( builder: (_, model, widget) => BaseView<MedicalViewModel>(
onModelReady: (model2) => model2.getFreeSlots(doctorList), onModelReady: (model2) => model2.getFreeSlots(doctorList),
allowAny: true, allowAny: true,
builder: (_, model2, widget2) { builder: (_, model2, widget2) {
if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) { if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) {
this.freeSlots = model2.freeSlots; this.freeSlots = model2.freeSlots;
this.doctorScheduleResponse = model.getDoctorScheduleList; this.doctorScheduleResponse = model.getDoctorScheduleList;
this.generateWeeksSchedules(); this.generateWeeksSchedules();
} else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) {
AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule);
Navigator.pop(context); Navigator.pop(context);
} }
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).schedule, appBarTitle: TranslationBase.of(context).schedule,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
isShowAppBar: true, isShowAppBar: true,
baseViewModel: model2, backgroundColor: Color(0xffF7F7F7),
isShowDecPage: false, baseViewModel: model2,
body: SizedBox( isShowDecPage: false,
height: MediaQuery.of(context).size.height, body: Column(
child: Stack( children: [
children: [ SizedBox(height: 21),
Container( PageViewIndicator(
margin: EdgeInsets.only(top: 40), isActive: true,
child: PageView.builder( currentPage: this.currentPage,
controller: _pageController, length: weeks.length,
itemCount: weeks.length, ),
onPageChanged: (index) { Expanded(
setState(() { child: PageView.builder(
isPageChange = true; controller: _pageController,
this.currentPage = index.toDouble(); itemCount: weeks.length,
}); onPageChanged: (index) {
}, setState(() {
itemBuilder: (context, index) { isPageChange = true;
return Container( this.currentPage = index.toDouble();
child: ListView.builder( });
itemCount: weeks[index].length, },
itemBuilder: (context, index2) => InkWell( itemBuilder: (context, index) {
onTap: () { return ListView.separated(
openBookAppointment(weeks[index][index2]); itemCount: weeks[index].length,
}, padding: EdgeInsets.all(21),
child: Row( separatorBuilder: (context, index) => SizedBox(height: 12),
children: [ itemBuilder: (context, index2) {
Expanded( bool isToday = DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10);
flex: 1, Color toDayColor = isToday ? Color(0xff359846) : Colors.white;
child: Padding(
padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), return InkWell(
child: Row(children: [ onTap: () {
Column( openBookAppointment(weeks[index][index2]);
children: [
Texts(
weeks[index][index2]['DayName'],
fontSize: 13,
fontWeight: projectViewModel.isArabic ? FontWeight.w600 : FontWeight.w500,
),
Texts(
getDayMonths(
DateUtil.convertStringToDate(
weeks[index][index2]['Date'],
),
),
fontWeight: FontWeight.bold,
fontSize: 18,
)
],
)
])),
),
Expanded(
flex: 3,
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(20.0)),
child: Container(
padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 20),
margin: EdgeInsets.only(left: 20, right: 20, top: 7, bottom: 7),
decoration: BoxDecoration(boxShadow: [
DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10)
? BoxShadow(color: Colors.green, offset: Offset(projectViewModel.isArabic ? 5 : -5, 0))
: BoxShadow(
color: Colors.grey[100],
blurRadius: 5,
spreadRadius: 4,
offset: Offset(0, 10),
),
], borderRadius: const BorderRadius.all(Radius.circular(10.0)), color: Colors.white),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10)
? Texts(
TranslationBase.of(context).today,
color: Colors.green,
fontWeight: FontWeight.w600,
fontSize: 12,
marginTop: 0,
)
: SizedBox(),
Row(
children: [
Expanded(
child: Text(
weeks[index][index2]['WorkingHours'],
style: TextStyle(
fontWeight: FontWeight.w600,
),
),
),
Icon(Icons.arrow_forward, size: 16.0),
],
)
]))),
),
],
))));
}, },
)), child: Row(
PageViewIndicator( crossAxisAlignment: CrossAxisAlignment.start,
isActive: true, children: [
currentPage: this.currentPage, Expanded(
length: weeks.length, flex: 1,
) child: Column(
], mainAxisSize: MainAxisSize.min,
))); crossAxisAlignment: CrossAxisAlignment.start,
})); children: [
Text(
weeks[index][index2]['DayName'],
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.52,
),
),
Text(
getDayMonths(DateUtil.convertStringToDate(weeks[index][index2]['Date'])),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
color: Color(0xff2E303A),
letterSpacing: -0.72,
),
),
],
),
),
Expanded(
flex: 3,
child: Container(
decoration: BoxDecoration(
color: toDayColor,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Container(
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.white, width: 1),
borderRadius: BorderRadius.only(
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
if (isToday)
Text(
TranslationBase.of(context).today,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: toDayColor,
letterSpacing: -0.48,
),
),
Row(
children: [
Expanded(
child: Text(
weeks[index][index2]['WorkingHours'],
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
),
],
)
]),
),
Icon(Icons.arrow_forward, color: Color(0xff2B353E)),
],
),
),
),
),
],
),
);
});
},
),
),
],
),
);
}),
);
} }
generateWeeksSchedules() { generateWeeksSchedules() {

@ -37,11 +37,11 @@ class PageViewIndicator extends StatelessWidget {
Widget circleBar(bool isActive) { Widget circleBar(bool isActive) {
return AnimatedContainer( return AnimatedContainer(
duration: Duration(milliseconds: 150), duration: Duration(milliseconds: 150),
margin: EdgeInsets.symmetric(horizontal: 3), margin: EdgeInsets.symmetric(horizontal: 4),
height: isActive ? 12 : 8, height: isActive ? 12 : 12,
width: isActive ? 12 : 8, width: isActive ? 12 : 12,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isActive ? Colors.red : Colors.grey, color: isActive ? Color(0xffD02127) : Color(0xffD0D0D0),
borderRadius: BorderRadius.all(Radius.circular(12))), borderRadius: BorderRadius.all(Radius.circular(12))),
); );
} }

@ -4,7 +4,7 @@ import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescriptions_h
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
@ -21,128 +21,130 @@ class PrescriptionsHistoryPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold( return BaseView<PrescriptionsViewModel>(
baseViewModel: prescriptionsViewModel, onModelReady: (model) => model.getPrescriptionsOrders(showLoading: true),
body: ListView.separated( builder: (_, model, widget) => AppScaffold(
physics: BouncingScrollPhysics(), baseViewModel: prescriptionsViewModel,
padding: EdgeInsets.all(21), body: ListView.separated(
separatorBuilder: (context, index) { physics: BouncingScrollPhysics(),
return SizedBox(height: 12); padding: EdgeInsets.all(21),
}, separatorBuilder: (context, index) {
itemBuilder: (context, index) { return SizedBox(height: 12);
int status = prescriptionsViewModel.prescriptionsHistory[index].status; },
String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description; itemBuilder: (context, index) {
Color _color; int status = prescriptionsViewModel.prescriptionsHistory[index].status;
if (status == 1) { String _statusDisp = projectViewModel.isArabic ? prescriptionsViewModel.prescriptionsHistory[index].descriptionN : prescriptionsViewModel.prescriptionsHistory[index].description;
//pending Color _color;
_color = Color(0xffCC9B14); if (status == 1) {
} else if (status == 2) { //pending
//processing _color = Color(0xffCC9B14);
_color = Color(0xff2E303A); } else if (status == 2) {
} else if (status == 3) { //processing
//completed _color = Color(0xff2E303A);
_color = Color(0xff359846); } else if (status == 3) {
} else if (status == 4) { //completed
//cancel // Rejected _color = Color(0xff359846);
_color = Color(0xffD02127); } else if (status == 4) {
} //cancel // Rejected
_color = Color(0xffD02127);
}
return InkWell( return InkWell(
onTap: () async { onTap: () async {
final result = await Navigator.push( final result = await Navigator.push(
context, context,
FadePage( FadePage(
page: PrescriptionsHistoryDetailsPage( page: PrescriptionsHistoryDetailsPage(
prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index], prescriptionsOrder: prescriptionsViewModel.prescriptionsHistory[index],
), ),
), ),
); );
if (result != null) { if (result != null) {
showOrderLog(); showOrderLog();
} }
}, },
child: Container( child: Container(
height: 65, height: 65,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),
), ),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Color(0xff000000).withOpacity(.05), color: Color(0xff000000).withOpacity(.05),
blurRadius: 27, blurRadius: 27,
offset: Offset(0, -3), offset: Offset(0, -3),
), ),
], ],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 6,
decoration: BoxDecoration(
color: _color,
borderRadius: BorderRadius.only(
topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
), ),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Container(
child: Column( width: 6,
mainAxisSize: MainAxisSize.min, decoration: BoxDecoration(
crossAxisAlignment: CrossAxisAlignment.start, color: _color,
children: [ borderRadius: BorderRadius.only(
Text( topLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
_statusDisp, bottomLeft: projectViewModel.isArabic ? Radius.circular(0.0) : Radius.circular(10.0),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10), topRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
), bottomRight: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0.0),
Text( ),
'${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
],
), ),
), ),
Column( Expanded(
mainAxisSize: MainAxisSize.min, child: Padding(
crossAxisAlignment: CrossAxisAlignment.end, padding: EdgeInsets.only(left: projectViewModel.isArabic ? 6 : 12, right: projectViewModel.isArabic ? 12 : 6),
children: [ child: Row(
Text( crossAxisAlignment: CrossAxisAlignment.start,
DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn), mainAxisSize: MainAxisSize.min,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10), children: [
), Expanded(
Text( child: Column(
DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false), mainAxisSize: MainAxisSize.min,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10), crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_statusDisp,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
),
Text(
'${TranslationBase.of(context).orderNo}. ${prescriptionsViewModel.prescriptionsHistory[index].iD}',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
],
),
),
Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
DateUtil.getDayMonthYearDateFormatted(prescriptionsViewModel.prescriptionsHistory[index].createdOn),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
),
Text(
DateUtil.formatDateToTimeLang(prescriptionsViewModel.prescriptionsHistory[index].createdOn, false),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
),
],
)
],
), ),
], ),
) ),
Icon(
Icons.arrow_forward,
size: 16,
),
mWidth(6),
], ],
), ),
), ));
), },
Icon( itemCount: prescriptionsViewModel.prescriptionsHistory.length,
Icons.arrow_forward, ),
size: 16, ));
),
mWidth(6),
],
),
));
},
itemCount: prescriptionsViewModel.prescriptionsHistory.length,
),
);
} }
} }

@ -1,101 +1,85 @@
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ConfirmWithMessageDialog extends StatelessWidget { class ConfirmWithMessageDialog extends StatelessWidget {
final String title;
final String message; final String message;
final String okTitle; final String okTitle;
final GestureTapCallback onTap; final VoidCallback onTap;
const ConfirmWithMessageDialog({Key key, this.message, this.okTitle, this.onTap}) : super(key: key); const ConfirmWithMessageDialog({Key key, this.title, @required this.message, this.okTitle, this.onTap}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return Dialog(
contentPadding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 12.0), backgroundColor: Colors.white,
children: [ shape: RoundedRectangleBorder(),
Column( insetPadding: EdgeInsets.only(left: 21, right: 21),
child: Padding(
padding: EdgeInsets.only(left: 20, right: 20, top: 18, bottom: 28),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Row(
TranslationBase.of(context).confirm, crossAxisAlignment: CrossAxisAlignment.start,
style: TextStyle( children: [
color: Colors.black, Expanded(
fontSize: 22, child: Padding(
letterSpacing: -0.94, padding: const EdgeInsets.only(top: 16.0),
fontWeight: FontWeight.bold, child: Text(
), title ?? TranslationBase.of(context).confirm,
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: Color(0xff2B353E), height: 35 / 24, letterSpacing: -0.96),
),
),
),
IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.close),
color: Color(0xff2B353E),
constraints: BoxConstraints(),
onPressed: () {
Navigator.pop(context);
},
)
],
), ),
Text( Text(
message, message,
style: TextStyle( style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff808080), letterSpacing: -0.48),
fontSize: 14,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
), ),
mHeight(20), SizedBox(height: 28),
Container( Row(
child: Row( mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ Expanded(
Expanded( child: DefaultButton(
child: InkWell( TranslationBase.of(context).cancel_nocaps,
onTap: () { () => Navigator.pop(context),
Navigator.pop(context); textColor: Color(0xff2B353E),
}, color: Color(0xffEAEAEA),
child: Container(
decoration: containerRadius(CustomColors.darkGreyColor, 6),
padding: EdgeInsets.all(6),
child: Center(
child: Text(
TranslationBase.of(context).cancel,
style: TextStyle(
color: Colors.black,
fontSize: 16,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
),
),
),
), ),
mWidth(12), ),
Expanded( SizedBox(width: 10),
child: InkWell( Expanded(
onTap: () { child: DefaultButton(
Navigator.pop(context); okTitle ?? TranslationBase.of(context).ok,
onTap(); () {
}, Navigator.pop(context);
child: Container( onTap();
decoration: containerRadius(CustomColors.accentColor, 6), },
padding: EdgeInsets.all(6),
child: Center(
child: Text(
okTitle,
style: TextStyle(
color: Colors.white,
fontSize: 16,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
),
),
),
), ),
], ),
), ],
), ),
], ],
) ),
], ),
); );
} }
} }

Loading…
Cancel
Save