|
|
|
|
@ -8,8 +8,8 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/RadioStringDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/radio_selection_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
@ -41,6 +41,8 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
|
|
|
|
|
String measureUnitSelectedType = 'mg/dlt';
|
|
|
|
|
int measuredTime = 1;
|
|
|
|
|
bool isButtonDisabled = true;
|
|
|
|
|
|
|
|
|
|
int _selectedMeasureUnitIndex = 0;
|
|
|
|
|
final List<String> measureUnitList = ['mg/dlt', 'mol/L'];
|
|
|
|
|
final List<String> measureTimeEnList = [
|
|
|
|
|
'Before Breakfast',
|
|
|
|
|
@ -66,6 +68,7 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
|
|
|
|
|
"صائم",
|
|
|
|
|
"آخر",
|
|
|
|
|
];
|
|
|
|
|
int _selectedMeasureTimeIndex;
|
|
|
|
|
String measureTimeSelectedType;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -88,212 +91,198 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.all(15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 15,
|
|
|
|
|
),
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).sugarAdd,
|
|
|
|
|
controller: _bloodSugarValueController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
onChanged: (value) => validateForm(),
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectMeasureUnitDialog();
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(measureUnitSelectedType),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.arrow_drop_down,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
showNewAppBar: true,
|
|
|
|
|
showNewAppBarTitle: true,
|
|
|
|
|
appBarTitle: widget.isUpdate ? TranslationBase.of(context).update : TranslationBase.of(context).add,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
padding: EdgeInsets.all(21),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
NewTextFields(
|
|
|
|
|
hintText: TranslationBase.of(context).sugarAdd,
|
|
|
|
|
controller: _bloodSugarValueController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
onChanged: (value) => validateForm(),
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectMeasureUnitDialog();
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(measureUnitSelectedType),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.arrow_drop_down,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
bloodSugarDate = date;
|
|
|
|
|
});
|
|
|
|
|
}, currentTime: bloodSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(TranslationBase.of(context).date),
|
|
|
|
|
Texts(getDate()),
|
|
|
|
|
],
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showDatePicker(context, showTitleActions: true, minTime: DateTime(DateTime.now().year - 1, 1, 1), maxTime: DateTime.now(), onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
bloodSugarDate = date;
|
|
|
|
|
});
|
|
|
|
|
}, currentTime: bloodSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(TranslationBase.of(context).date),
|
|
|
|
|
Texts(getDate()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
timeSugarDate = date;
|
|
|
|
|
});
|
|
|
|
|
}, currentTime: timeSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
DatePicker.showTimePicker(context, showTitleActions: true, onConfirm: (date) {
|
|
|
|
|
setState(() {
|
|
|
|
|
timeSugarDate = date;
|
|
|
|
|
});
|
|
|
|
|
}, currentTime: timeSugarDate, locale: projectViewModel.localeType);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [Texts(TranslationBase.of(context).time), Texts(getTime())],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 8,
|
|
|
|
|
),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(measureTimeSelectedType ?? TranslationBase.of(context).other),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.arrow_drop_down,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
confirmSelectMeasureTimeDialog(projectViewModel.isArabic ? measureTimeArList : measureTimeEnList);
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
Texts(measureTimeSelectedType ?? TranslationBase.of(context).other),
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.arrow_drop_down,
|
|
|
|
|
color: Colors.grey,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
widget.isUpdate
|
|
|
|
|
? Container(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(context).delete,
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.red[900],
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
ConfirmDialog dialog = new ConfirmDialog(
|
|
|
|
|
widget.isUpdate
|
|
|
|
|
? Container(
|
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
child: Texts(
|
|
|
|
|
TranslationBase.of(context).delete,
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Colors.red[900],
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
confirmMessage: TranslationBase.of(context).removeMeasure,
|
|
|
|
|
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)
|
|
|
|
|
child: ConfirmWithMessageDialog(
|
|
|
|
|
message: TranslationBase.of(context).removeMeasure,
|
|
|
|
|
onTap: () async {
|
|
|
|
|
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);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
cancelFunction: () => {});
|
|
|
|
|
dialog.showAlertDialog(context);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
: Container()
|
|
|
|
|
],
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Container()
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(20.0),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).save.toUpperCase(),
|
|
|
|
|
isButtonDisabled
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
if (_bloodSugarValueController.text.isNotEmpty) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
if (widget.isUpdate) {
|
|
|
|
|
await widget.bloodSugarViewMode.updateDiabtecResult(
|
|
|
|
|
month: bloodSugarDate,
|
|
|
|
|
hour: timeSugarDate,
|
|
|
|
|
diabtecUnit: measureUnitSelectedType,
|
|
|
|
|
measuredTime: measuredTime,
|
|
|
|
|
lineItemNo: widget.lineItemNo,
|
|
|
|
|
bloodSugerResult: _bloodSugarValueController.text.toString());
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
} else {
|
|
|
|
|
await widget.bloodSugarViewMode.addDiabtecResult(
|
|
|
|
|
DefaultButton(
|
|
|
|
|
TranslationBase.of(context).save,
|
|
|
|
|
isButtonDisabled
|
|
|
|
|
? null
|
|
|
|
|
: () async {
|
|
|
|
|
if (_bloodSugarValueController.text.isNotEmpty) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
if (widget.isUpdate) {
|
|
|
|
|
await widget.bloodSugarViewMode.updateDiabtecResult(
|
|
|
|
|
month: bloodSugarDate,
|
|
|
|
|
hour: timeSugarDate,
|
|
|
|
|
diabtecUnit: measureUnitSelectedType,
|
|
|
|
|
measuredTime: measuredTime,
|
|
|
|
|
bloodSugerResult: _bloodSugarValueController.text.toString(),
|
|
|
|
|
bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
|
|
|
|
);
|
|
|
|
|
lineItemNo: widget.lineItemNo,
|
|
|
|
|
bloodSugerResult: _bloodSugarValueController.text.toString());
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.bloodSugarViewMode.state == ViewState.Error)
|
|
|
|
|
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.bloodSugarViewMode.state == ViewState.ErrorLocal)
|
|
|
|
|
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
} else {
|
|
|
|
|
await widget.bloodSugarViewMode.addDiabtecResult(
|
|
|
|
|
diabtecUnit: measureUnitSelectedType,
|
|
|
|
|
measuredTime: measuredTime,
|
|
|
|
|
bloodSugerResult: _bloodSugarValueController.text.toString(),
|
|
|
|
|
bloodSugerDateChart: '${bloodSugarDate.year}-${bloodSugarDate.month}-${bloodSugarDate.day} ${timeSugarDate.hour}:${timeSugarDate.minute}:00',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (widget.bloodSugarViewMode.state == ViewState.Error)
|
|
|
|
|
AppToast.showErrorToast(message: widget.bloodSugarViewMode.error);
|
|
|
|
|
else
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
disabledColor: Colors.grey,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
disabledColor: Colors.grey,
|
|
|
|
|
).insideContainer,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getDate() {
|
|
|
|
|
@ -305,33 +294,41 @@ class _AddBloodSugarPageState extends State<AddBloodSugarPage> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void confirmSelectMeasureUnitDialog() {
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
RadioSelectionDialogModel("mg/dlt", 0),
|
|
|
|
|
RadioSelectionDialogModel("mol/L", 1),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: RadioStringDialog(
|
|
|
|
|
radioList: measureUnitList,
|
|
|
|
|
title: TranslationBase.of(context).measureUnit,
|
|
|
|
|
selectedValue: measureUnitSelectedType,
|
|
|
|
|
onValueSelected: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
measureUnitSelectedType = value;
|
|
|
|
|
});
|
|
|
|
|
child: RadioSelectionDialog(
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: _selectedMeasureUnitIndex,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
_selectedMeasureUnitIndex = index;
|
|
|
|
|
measureUnitSelectedType = list[index].title;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void confirmSelectMeasureTimeDialog(List<String> list) {
|
|
|
|
|
void confirmSelectMeasureTimeDialog(List<String> dataList) {
|
|
|
|
|
List<RadioSelectionDialogModel> list = [
|
|
|
|
|
for (int i = 0; i < dataList.length; i++) RadioSelectionDialogModel(dataList[i], i),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: RadioStringDialog(
|
|
|
|
|
radioList: list,
|
|
|
|
|
title: TranslationBase.of(context).measureTime,
|
|
|
|
|
selectedValue: measureTimeSelectedType,
|
|
|
|
|
onValueSelected: (value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
measureTimeSelectedType = value;
|
|
|
|
|
measuredTime = list.indexOf(value);
|
|
|
|
|
});
|
|
|
|
|
child: RadioSelectionDialog(
|
|
|
|
|
listData: list,
|
|
|
|
|
selectedIndex: _selectedMeasureTimeIndex,
|
|
|
|
|
isScrollable: true,
|
|
|
|
|
onValueSelected: (index) {
|
|
|
|
|
_selectedMeasureTimeIndex = index;
|
|
|
|
|
measureTimeSelectedType = list[index].title;
|
|
|
|
|
measuredTime = index;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|