Bug Fix: 873, 878 to 881

merge-requests/320/head
Mirza.Shafique 3 years ago
parent 81ce399e85
commit 58d5734f1a

@ -27,8 +27,8 @@ class COCItem {
String statusAr;
dynamic statusEn;
COCItem(
{this.appointment,
COCItem({
this.appointment,
this.appointmentClinicName,
this.appointmentDate,
this.appointmentProjectName,
@ -54,7 +54,8 @@ class COCItem {
this.solution,
this.status,
this.statusAr,
this.statusEn});
this.statusEn,
});
COCItem.fromJson(Map<String, dynamic> json) {
appointment = json['Appointment'];

@ -36,7 +36,6 @@ class ProjectViewModel extends BaseViewModel {
bool get isArabic => _isArabic;
bool isLoginChild = false;
List<PrivilegeModel> privilegeRootUser = List();
List<PrivilegeModel> privilegeChildUser = List();
@ -67,7 +66,8 @@ class ProjectViewModel extends BaseViewModel {
}
Future loadSharedPrefLanguage() async {
currentLanguage = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
currentLanguage =
await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar');
_appLocale = Locale(currentLanguage);
_isArabic = currentLanguage == 'ar';
notifyListeners();
@ -89,8 +89,7 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners();
}
setPrivilegeModelList(
{List<PrivilegeModel> privilege}) {
setPrivilegeModelList({List<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild;
privilegeRootUser = privilege;

@ -72,10 +72,7 @@ class _MyApp extends State<MyApp> {
value: SearchProvider(),
),
ChangeNotifierProvider<ThemeNotifier>(
create: (context) => ThemeNotifier(
defaultTheme()
)
),
create: (context) => ThemeNotifier(defaultTheme())),
StreamProvider.value(
value: RobotProvider().intStream(),
initialData: RobotProvider().setValue({}),

@ -35,8 +35,8 @@ class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
void initState() {
if (widget.allowAny && widget.onModelReady != null) {
widget.onModelReady(model);
}
else if (widget.onModelReady != null && Provider.of<ProjectViewModel>(context, listen: false).isLogin) {
} else if (widget.onModelReady != null &&
Provider.of<ProjectViewModel>(context, listen: false).isLogin) {
widget.onModelReady(model);
}
super.initState();
@ -60,7 +60,6 @@ class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
if (model != null) {
model = null;
}
super.dispose();
}
}

@ -44,6 +44,7 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
String getSelected(BuildContext context) {
switch (messageType) {
case MessageType.ComplaintOnAnAppointment:
@ -325,6 +326,9 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
fontSize: 13.5,
hintColor: Colors.black,
fontWeight: FontWeight.w600,
onChanged: (v){setState(() {
});},
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context).emptySubject;
@ -347,6 +351,9 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
onSuffixTap: () {
openSpeechReco();
},
onChanged: (v){setState(() {
});},
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context).emptyMessage;
@ -440,11 +447,11 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
label: TranslationBase.of(context).send,
textColor: Colors.white,
disabled: (titleController.text.toString().isEmpty ||
messageController.text.toString().isEmpty ||
messageType == MessageType.NON),
messageController.text.toString().isEmpty ),
onTap: () {
final form = formKey.currentState;
if (form.validate()) if (messageType != MessageType.NON) {
if (form.validate()) {
GifLoaderDialogUtils.showMyDialog(context);
model
.sendCOCItem(
@ -472,9 +479,7 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
GifLoaderDialogUtils.hideDialog(context);
}
});
} else {
AppToast.showErrorToast(
message: TranslationBase.of(context).selectPart);
}
},
),
@ -500,10 +505,10 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
return "4";
break;
case MessageType.Suggestion:
return "5";
return "6";
break;
case MessageType.NON:
return "";
return "5";
break;
}
return "";
@ -583,6 +588,7 @@ class FeedbackTypeDialogState extends State<FeedbackTypeDialog> {
setMessageDialogType(MessageType messageType) {
setState(() {
messageTypeDialog = messageType;
});
}

@ -156,6 +156,10 @@ class _HomePageState extends State<HomePage> {
onPressed: () {
navigateToCovidDriveThru();
},
child: Center(
child: Center(
child: Center(
child: Center(
child: Texts(
TranslationBase.of(
context)
@ -168,6 +172,10 @@ class _HomePageState extends State<HomePage> {
),
),
),
),
),
),
),
],
),
),

@ -74,7 +74,7 @@ class NewTextFields extends StatefulWidget {
this.fontWeight = FontWeight.w700,
this.autoValidate = false,
this.hintColor,
this.isEnabled = true})
this.isEnabled = true,this.counterText=""})
: super(key: key);
final String hintText;
@ -112,6 +112,7 @@ class NewTextFields extends StatefulWidget {
final bool borderOnlyError;
final Color hintColor;
final String initialValue;
final String counterText;
@override
_NewTextFieldsState createState() => _NewTextFieldsState();
}
@ -199,6 +200,7 @@ class _NewTextFieldsState extends State<NewTextFields> {
: widget.inputFormatters,
decoration: InputDecoration(
labelText: widget.hintText,
counterText: widget.counterText,
labelStyle:
TextStyle(color: Theme.of(context).textTheme.bodyText1.color),
errorBorder: OutlineInputBorder(

@ -51,6 +51,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
];
final List<String> measureUnitArList = ["كيلو جرام", "باوند"];
String measureTimeSelectedType;
bool isButtonDisabled = false;
@override
void initState() {
@ -64,6 +65,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
else if (measureUnitArList.contains(widget.measureTimeSelectedType))
weightUnit = measureUnitArList.indexOf(widget.measureTimeSelectedType);
_weightValueController.text = widget.weightValue;
validateForm();
}
}
@ -76,7 +78,8 @@ class _AddWeightPageState extends State<AddWeightPage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons:widget.isUpdate? [
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
@ -101,15 +104,15 @@ class _AddWeightPageState extends State<AddWeightPage> {
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(
message: widget.model.error);
AppToast.showErrorToast(message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
)
]:null,
]
: null,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
@ -123,6 +126,7 @@ class _AddWeightPageState extends State<AddWeightPage> {
hintText: TranslationBase.of(context).weightAdd,
controller: _weightValueController,
keyboardType: TextInputType.number,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
@ -235,16 +239,19 @@ class _AddWeightPageState extends State<AddWeightPage> {
loading: widget.model.state == ViewState.BusyLocal,
label: TranslationBase.of(context).save.toUpperCase(),
textColor: Colors.white,
color: isButtonDisabled ? Colors.grey[900] : Colors.grey,
onTap: () {
if (_weightValueController.text.isNotEmpty) {
if (widget.isUpdate) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model.updateWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
widget.model
.updateWeightResult(
weightDate:
'${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured:
_weightValueController.text.toString(),
weightUnit: weightUnit,
lineItemNo: widget.lineItemNo
)
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.Error)
@ -253,8 +260,10 @@ class _AddWeightPageState extends State<AddWeightPage> {
Navigator.pop(context);
});
} else
widget.model.addWeightResult(
weightDate: '${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
widget.model
.addWeightResult(
weightDate:
'${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured: _weightValueController.text.toString(),
weightUnit: weightUnit,
)
@ -291,9 +300,23 @@ class _AddWeightPageState extends State<AddWeightPage> {
setState(() {
measureTimeSelectedType = value;
weightUnit = list.indexOf(value);
validateForm();
});
},
),
);
}
void validateForm() {
if (_weightValueController.text.length > 0 &&
measureTimeSelectedType != null) {
setState(() {
isButtonDisabled = true;
});
} else {
setState(() {
isButtonDisabled = false;
});
}
}
}

@ -47,6 +47,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
DateTime bloodSugarDate = DateTime.now();
DateTime timeSugarDate = DateTime.now();
int measuredArm = 1;
bool isButtonDisabled = false;
final List<String> measureTimeEnList = [
'Left',
'Right',
@ -70,6 +71,7 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
measuredArm = measureTimeArList.indexOf(widget.measureTimeSelectedType);
_bloodSystolicValueController.text = widget.bloodSystolicValue;
_bloodDiastolicValueController.text = widget.bloodDiastolicValue;
validateForm();
}
}
@ -82,7 +84,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons: widget.isUpdate?[
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
@ -97,11 +100,13 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo)
.deactivateDiabeticStatus(
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.model.error);
AppToast.showErrorToast(
message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
@ -113,7 +118,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
dialog.showAlertDialog(context);
},
)
]:null,
]
: null,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
@ -127,6 +133,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
hintText: TranslationBase.of(context).systolicAdd,
controller: _bloodSystolicValueController,
keyboardType: TextInputType.number,
maxLength: 3,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
@ -135,6 +143,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
hintText: TranslationBase.of(context).diastolicAdd,
controller: _bloodDiastolicValueController,
keyboardType: TextInputType.number,
maxLength: 3,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
@ -244,12 +254,16 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
loading: widget.model.state == ViewState.BusyLocal,
label: TranslationBase.of(context).save.toUpperCase(),
textColor: Colors.white,
color: isButtonDisabled
? Colors.grey[900]
: Colors.grey,
onTap: () async {
if (_bloodSystolicValueController.text.isNotEmpty &&
_bloodDiastolicValueController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context);
widget.model.addORUpdateDiabtecResult(
widget.model
.addORUpdateDiabtecResult(
isUpdate: widget.isUpdate,
bloodPressureDate:
'${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
@ -258,7 +272,8 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
systolicePressure:
_bloodSystolicValueController.text.toString(),
measuredArm: measuredArm,
).then((value) {
)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.BusyLocal)
AppToast.showErrorToast(message: widget.model.error);
@ -295,9 +310,43 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
setState(() {
measureTimeSelectedType = value;
measuredArm = list.indexOf(value);
validateForm();
});
},
),
);
}
void validateForm() {
print("_bloodSystolicValueController "+_bloodSystolicValueController.text.length.toString());
if (measureTimeSelectedType != 'Left Arm' &&
_bloodSystolicValueController.text.length > 0 &&
_bloodDiastolicValueController.text.length > 0) {
setState(() {
isButtonDisabled = true;
});
} else {
setState(() {
isButtonDisabled = false;
});
}
// if(measureTimeSelectedType == 'Left Arm'){
// setState(() {
// isButtonDisabled = false;
// });
// }else if(_bloodSystolicValueController.text.length < 0){
// setState(() {
// isButtonDisabled = false;
// });
// }else if(_bloodDiastolicValueController.text.length < 0){
// setState(() {
// isButtonDisabled = false;
// });
// }else{
// setState(() {
// isButtonDisabled = true;
// });
// }
}
}

@ -46,6 +46,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
DateTime timeSugarDate = DateTime.now();
String measureUnitSelectedType = 'mg/dlt';
int measuredTime = 1;
bool isButtonDisabled = false;
final List<String> measureUnitList = ['mg/dlt', 'mol/L'];
final List<String> measureTimeEnList = [
'Before Breakfast',
@ -85,6 +86,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
else if (measureTimeArList.contains(widget.measuredTime))
measuredTime = measureTimeArList.indexOf(widget.measuredTime);
_bloodSugarValueController.text = widget.bloodSugarValue;
validateForm();
}
}
@ -96,7 +98,8 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons: widget.isUpdate?[
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
@ -111,10 +114,12 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
GifLoaderDialogUtils.showMyDialog(context);
widget.bloodSugarViewMode
.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo)
.deactivateDiabeticStatus(
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
if (widget.bloodSugarViewMode.state ==
ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
else
@ -129,7 +134,8 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
dialog.showAlertDialog(context);
},
)
]:null,
]
: null,
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
@ -143,6 +149,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
hintText: TranslationBase.of(context).sugarAdd,
controller: _bloodSugarValueController,
keyboardType: TextInputType.number,
onChanged: (value) => validateForm(),
),
SizedBox(
height: 8,
@ -274,6 +281,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
child: SecondaryButton(
label: TranslationBase.of(context).save.toUpperCase(),
textColor: Colors.white,
color: isButtonDisabled ? Colors.grey[900] : Colors.grey,
onTap: () {
if (_bloodSugarValueController.text.isNotEmpty) {
if (widget.isUpdate) {
@ -289,7 +297,8 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
_bloodSugarValueController.text.toString())
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
if (widget.bloodSugarViewMode.state ==
ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
else
@ -360,4 +369,16 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
),
);
}
void validateForm() {
if (_bloodSugarValueController.text.length > 0) {
setState(() {
isButtonDisabled = true;
});
} else {
setState(() {
isButtonDisabled = false;
});
}
}
}

@ -393,7 +393,6 @@ class DateUtil {
break;
case DayOfWeek.Sunday:
return "Sunday";
break;
}
return "";

@ -161,7 +161,9 @@ class _AnimatedButtonState extends State<AnimatedButton>
// button width is min 120.0 and max 240.0
_width = textWidth > 120.0 && textWidth < 240.0
? textWidth
: textWidth >= 240.0 ? 240.0 : 120.0;
: textWidth >= 240.0
? 240.0
: 120.0;
_sizeAnimation = Tween<double>(begin: 1.0, end: _height / _width)
.animate(CurvedAnimation(
@ -191,13 +193,14 @@ class _AnimatedButtonState extends State<AnimatedButton>
animation: _colorAnimation,
builder: (context, child) => Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(_height/2)
),
borderRadius: BorderRadius.circular(_height / 2)),
color: _colorAnimation.value,
child: child,
shadowColor: _color,
elevation: !_isLoading
? (_hover ? buttonTheme.highlightElevation : buttonTheme.elevation)
? (_hover
? buttonTheme.highlightElevation
: buttonTheme.elevation)
: 0,
),
child: InkWell(
@ -287,7 +290,6 @@ class Ring extends StatelessWidget {
}
}
enum AnimatedTextRotation { up, down }
/// https://medium.com/flutter-community/flutter-challenge-3d-bottom-navigation-bar-48952a5fd996
@ -319,7 +321,6 @@ class _AnimatedTextState extends State<AnimatedText>
double get radius => _layoutHeight / 2;
@override
void initState() {
super.initState();
@ -452,10 +453,12 @@ class _AnimatedTextState extends State<AnimatedText>
);
}
// Helpers
double toRadian(double degree) => degree * pi / 180;
double lerp(double start, double end, double percent) => (start + percent * (end - start));
double lerp(double start, double end, double percent) =>
(start + percent * (end - start));
Size getWidgetSize(GlobalKey key) {
final RenderBox renderBox = key.currentContext?.findRenderObject();
return renderBox?.size;

Loading…
Cancel
Save