Bug Fix: 873, 878 to 881

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

@ -27,34 +27,35 @@ class COCItem {
String statusAr;
dynamic statusEn;
COCItem(
{this.appointment,
this.appointmentClinicName,
this.appointmentDate,
this.appointmentProjectName,
this.cOCID,
this.cOCTitle,
this.channel,
this.clinic,
this.clinicID,
this.date,
this.detail,
this.doctor,
this.doctorID,
this.formType,
this.formTypeID,
this.identificationNo,
this.itemID,
this.mobileNo,
this.naturename,
this.patientID,
this.patientName,
this.project,
this.projectID,
this.solution,
this.status,
this.statusAr,
this.statusEn});
COCItem({
this.appointment,
this.appointmentClinicName,
this.appointmentDate,
this.appointmentProjectName,
this.cOCID,
this.cOCTitle,
this.channel,
this.clinic,
this.clinicID,
this.date,
this.detail,
this.doctor,
this.doctorID,
this.formType,
this.formTypeID,
this.identificationNo,
this.itemID,
this.mobileNo,
this.naturename,
this.patientID,
this.patientName,
this.project,
this.projectID,
this.solution,
this.status,
this.statusAr,
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,10 +89,9 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners();
}
setPrivilegeModelList(
{List<PrivilegeModel> privilege}) {
setPrivilegeModelList({List<PrivilegeModel> privilege}) {
this.isLoginChild = isLoginChild;
privilegeRootUser = privilege;
privilegeRootUser = privilege;
notifyListeners();
}
@ -113,18 +112,18 @@ class ProjectViewModel extends BaseViewModel {
notifyListeners();
}
setIsLoginChild({@required bool isLoginChild}){
setIsLoginChild({@required bool isLoginChild}) {
this.isLoginChild = isLoginChild;
notifyListeners();
}
bool havePrivilege(int id) {
bool isHavePrivilege = false;
if(isLoginChild)
if (isLoginChild)
privilegeChildUser.forEach((element) {
if (element.iD == id) isHavePrivilege = element.privilege;
});
else{
if (element.iD == id) isHavePrivilege = element.privilege;
});
else {
privilegeRootUser.forEach((element) {
if (element.iD == id) isHavePrivilege = element.privilege;
});

@ -36,7 +36,7 @@ class MyApp extends StatefulWidget {
class _MyApp extends State<MyApp> {
@override
void initState(){
void initState() {
// ProjectViewModel projectProvider;
// projectProvider = Provider.of(context);
// var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans';
@ -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({}),

@ -33,10 +33,10 @@ class _BaseViewState<T extends BaseViewModel> extends State<BaseView<T>> {
@override
void initState() {
if(widget.allowAny && widget.onModelReady != null){
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,41 +447,39 @@ 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) {
GifLoaderDialogUtils.showMyDialog(context);
model
.sendCOCItem(
title: titleController.text,
attachment: images.length > 0 ? images[0] : "",
details: messageController.text,
cOCTypeName: getCOCName(),
appointHistory: messageType ==
MessageType.ComplaintOnAnAppointment
? appointHistory
: null)
.then((value) {
if (value) {
setState(() {
titleController.text = "";
messageController.text = "";
images = [];
});
setMessageType(MessageType.NON);
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(
message: TranslationBase.of(context).yourFeedback);
} else {
AppToast.showErrorToast(message: model.error);
GifLoaderDialogUtils.hideDialog(context);
}
});
} else {
AppToast.showErrorToast(
message: TranslationBase.of(context).selectPart);
if (form.validate()) {
GifLoaderDialogUtils.showMyDialog(context);
model
.sendCOCItem(
title: titleController.text,
attachment: images.length > 0 ? images[0] : "",
details: messageController.text,
cOCTypeName: getCOCName(),
appointHistory: messageType ==
MessageType.ComplaintOnAnAppointment
? appointHistory
: null)
.then((value) {
if (value) {
setState(() {
titleController.text = "";
messageController.text = "";
images = [];
});
setMessageType(MessageType.NON);
GifLoaderDialogUtils.hideDialog(context);
AppToast.showSuccessToast(
message: TranslationBase.of(context).yourFeedback);
} else {
AppToast.showErrorToast(message: model.error);
GifLoaderDialogUtils.hideDialog(context);
}
});
}
},
),
@ -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,15 +156,23 @@ class _HomePageState extends State<HomePage> {
onPressed: () {
navigateToCovidDriveThru();
},
child: Texts(
TranslationBase.of(
context)
.bookNow,
fontWeight:
FontWeight
.w700,
color: Colors
.white,
child: Center(
child: Center(
child: Center(
child: Center(
child: Texts(
TranslationBase.of(
context)
.bookNow,
fontWeight:
FontWeight
.w700,
color: Colors
.white,
),
),
),
),
),
),
),

@ -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,40 +78,41 @@ class _AddWeightPageState extends State<AddWeightPage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons:widget.isUpdate? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.deleteWeightResult(lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(
message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
)
]:null,
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.deleteWeightResult(lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
)
]
: 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(),
weightUnit: weightUnit,
lineItemNo: widget.lineItemNo
)
widget.model
.updateWeightResult(
weightDate:
'${dayWeightDate.year}-${dayWeightDate.month}-${dayWeightDate.day} ${timeWeightDate.hour}:${timeWeightDate.minute}:00',
weightMeasured:
_weightValueController.text.toString(),
weightUnit: weightUnit,
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;
});
}
}
}

@ -29,7 +29,7 @@ class AddBloodPressurePage extends StatefulWidget {
{Key key,
this.bloodSugarDate,
this.measureTimeSelectedType,
this.isUpdate=false,
this.isUpdate = false,
this.lineItemNo,
this.model,
this.bloodSystolicValue,
@ -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,38 +84,42 @@ class _AddBloodPressurePageState extends State<AddBloodPressurePage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons: widget.isUpdate?[
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
GifLoaderDialogUtils.showMyDialog(context);
widget.model
.deactivateDiabeticStatus(
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.model.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.model.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
cancelFunction: () => {});
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,14 +272,15 @@ 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);
if (widget.model.state == ViewState.BusyLocal)
AppToast.showErrorToast(message: widget.model.error);
else
Navigator.pop(context);
;
}).catchError((e){
Navigator.pop(context);
;
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
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,40 +98,44 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
appBarTitle: widget.isUpdate
? TranslationBase.of(context).update
: TranslationBase.of(context).add,
appBarIcons: widget.isUpdate?[
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
appBarIcons: widget.isUpdate
? [
IconButton(
icon: Icon(Icons.delete),
color: Colors.white,
onPressed: () {
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: 'Remove this measure',
okText: TranslationBase.of(context).ok,
cancelText: TranslationBase.of(context).cancel,
okFunction: () async {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
widget.bloodSugarViewMode
.deactivateDiabeticStatus(lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
});
GifLoaderDialogUtils.showMyDialog(context);
widget.bloodSugarViewMode
.deactivateDiabeticStatus(
lineItemNo: widget.lineItemNo)
.then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (widget.bloodSugarViewMode.state ==
ViewState.ErrorLocal)
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
else
Navigator.pop(context);
}).catchError((e) {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(
message: widget.bloodSugarViewMode.error);
});
},
cancelFunction: () => {});
dialog.showAlertDialog(context);
},
cancelFunction: () => {});
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 "";

@ -62,21 +62,21 @@ class _AnimatedButtonState extends State<AnimatedButton>
_buttonOpacityAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(CurvedAnimation(
parent: widget.controller,
curve: Threshold(.65),
));
parent: widget.controller,
curve: Threshold(.65),
));
_ringThicknessAnimation =
Tween<double>(begin: _loadingCircleRadius, end: _loadingCircleThickness)
.animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(.65, .85),
));
parent: widget.controller,
curve: Interval(.65, .85),
));
_ringOpacityAnimation =
Tween<double>(begin: 1.0, end: 0.0).animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(.85, 1.0),
));
parent: widget.controller,
curve: Interval(.85, 1.0),
));
widget.controller.addStatusListener(handleStatusChanged);
}
@ -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(
@ -279,15 +282,14 @@ class Ring extends StatelessWidget {
child: thickness == 0
? null
: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(color),
strokeWidth: thickness,
value: value,
),
valueColor: AlwaysStoppedAnimation<Color>(color),
strokeWidth: thickness,
value: value,
),
);
}
}
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();
@ -370,7 +371,7 @@ class _AnimatedTextState extends State<AnimatedText>
if (kIsWeb) {
return Matrix4.identity();
}
return Matrix4.identity()..setEntry(3, 2, .006);
return Matrix4.identity()..setEntry(3, 2, .006);
}
Matrix4 _getFrontSideUp(double value) {
@ -452,12 +453,14 @@ 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