evaluation form submit fixed.

design_3.0_demo_module
Sikander Saleem 2 days ago
parent 3180a80a88
commit 121a4a9762

@ -439,21 +439,21 @@ class FooterActionButton {
), ),
); );
case DemoRequestStepEnum.submitEvaluation: case DemoRequestStepEnum.submitEvaluation:
// return const SizedBox(); // return const SizedBox();
// return footerContainer( // return footerContainer(
// context: context, // context: context,
// child: AppFilledButton( // child: AppFilledButton(
// label: 'Submit Evaluation'.addTranslation, // label: 'Submit Evaluation'.addTranslation,
// // maxWidth: true, // // maxWidth: true,
// buttonColor: AppColor.primary10, // buttonColor: AppColor.primary10,
// onPressed: () async { // onPressed: () async {
// bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage())); // bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage()));
// if (isRefresh == true) { // if (isRefresh == true) {
// refreshData(); // refreshData();
// } // }
// }, // },
// ), // ),
// ); // );
return const SizedBox(); return const SizedBox();
case DemoRequestStepEnum.viewOnly: case DemoRequestStepEnum.viewOnly:
return const SizedBox(); return const SizedBox();
@ -490,7 +490,7 @@ class FooterActionButton {
// maxWidth: true, // maxWidth: true,
buttonColor: AppColor.primary10, buttonColor: AppColor.primary10,
onPressed: () async { onPressed: () async {
bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage())); bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage(id: dataModel.id!)));
if (isRefresh == true) { if (isRefresh == true) {
refreshData(); refreshData();
} }

@ -17,7 +17,9 @@ import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart
import 'package:test_sa/providers/loading_list_notifier.dart'; import 'package:test_sa/providers/loading_list_notifier.dart';
class EvaluationFormPage extends StatefulWidget { class EvaluationFormPage extends StatefulWidget {
EvaluationFormPage({Key? key}) : super(key: key); final int id;
const EvaluationFormPage({Key? key, required this.id}) : super(key: key);
@override @override
_EvaluationFormPageState createState() { _EvaluationFormPageState createState() {
@ -234,14 +236,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: formData['easeOfUse'], initialValue: rating.where((obj) => obj.value == formData['easeOfUse']).firstOrNull,
staticData: rating, staticData: rating,
validator: (value) { validator: (value) {
if (value == null) return "Mandatory"; if (value == null) return "Mandatory";
return null; return null;
}, },
onSelect: (value) { onSelect: (value) {
formData['easeOfUse'] = value; formData['easeOfUse'] = value!.value;
}, },
), ),
8.height, 8.height,
@ -251,14 +253,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: formData['easeOfApplication'], initialValue: rating.where((obj) => obj.value == formData['easeOfApplication']).firstOrNull,
staticData: rating, staticData: rating,
validator: (value) { validator: (value) {
if (value == null) return "Mandatory"; if (value == null) return "Mandatory";
return null; return null;
}, },
onSelect: (value) { onSelect: (value) {
formData['easeOfApplication'] = value; formData['easeOfApplication'] = value!.value;
}, },
), ),
8.height, 8.height,
@ -268,14 +270,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: formData['easeOfPatientSwitch'], initialValue: rating.where((obj) => obj.value == formData['easeOfPatientSwitch']).firstOrNull,
staticData: rating, staticData: rating,
validator: (value) { validator: (value) {
if (value == null) return "Mandatory"; if (value == null) return "Mandatory";
return null; return null;
}, },
onSelect: (value) { onSelect: (value) {
formData['easeOfPatientSwitch'] = value; formData['easeOfPatientSwitch'] = value!.value;
}, },
), ),
8.height, 8.height,
@ -285,14 +287,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context), backgroundColor: AppColor.fieldBgColor(context),
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: formData['patientComfort'], initialValue: rating.where((obj) => obj.value == formData['patientComfort']).firstOrNull,
staticData: rating, staticData: rating,
validator: (value) { validator: (value) {
if (value == null) return "Mandatory"; if (value == null) return "Mandatory";
return null; return null;
}, },
onSelect: (value) { onSelect: (value) {
formData['patientComfort'] = value; formData['patientComfort'] = value!.value;
}, },
), ),
// 8.height, // 8.height,
@ -374,11 +376,11 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
_formKey.currentState!.save(); _formKey.currentState!.save();
Utils.showLoading(context); Utils.showLoading(context);
DemoProvider demoProvider = Provider.of<DemoProvider>(context, listen: false); DemoProvider demoProvider = Provider.of<DemoProvider>(context, listen: false);
formData["id"] = 0; formData["id"] = widget.id;
formData["isAcknowledged"] = isAcknowledged; formData["isAcknowledged"] = isAcknowledged;
bool isSuccess = await demoProvider.addDemoTrialOutcome(formData); bool isSuccess = await demoProvider.addDemoTrialOutcome(formData);
Utils.hideLoading(context); Utils.hideLoading(context);
if (isSuccess) { if (isSuccess) {

@ -125,7 +125,7 @@ class DemoProvider extends ChangeNotifier {
Future<bool> addDemoTrialOutcome(Map<String, dynamic> body) async { Future<bool> addDemoTrialOutcome(Map<String, dynamic> body) async {
try { try {
Response response = await ApiManager.instance.post(URLs.addDemoTrialOutcome, body: body, showToast: false); Response response = await ApiManager.instance.post(URLs.addDemoTrialOutcome, body: body);
if (response.statusCode >= 200 && response.statusCode < 300) { if (response.statusCode >= 200 && response.statusCode < 300) {
String message = (jsonDecode(response.body)["message"] ?? ""); String message = (jsonDecode(response.body)["message"] ?? "");
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG); Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);

Loading…
Cancel
Save