evaluation form submit fixed.

design_3.0_demo_module
Sikander Saleem 19 hours ago
parent 3180a80a88
commit 121a4a9762

@ -439,21 +439,21 @@ class FooterActionButton {
),
);
case DemoRequestStepEnum.submitEvaluation:
// return const SizedBox();
// return footerContainer(
// context: context,
// child: AppFilledButton(
// label: 'Submit Evaluation'.addTranslation,
// // maxWidth: true,
// buttonColor: AppColor.primary10,
// onPressed: () async {
// bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage()));
// if (isRefresh == true) {
// refreshData();
// }
// },
// ),
// );
// return const SizedBox();
// return footerContainer(
// context: context,
// child: AppFilledButton(
// label: 'Submit Evaluation'.addTranslation,
// // maxWidth: true,
// buttonColor: AppColor.primary10,
// onPressed: () async {
// bool? isRefresh = await Navigator.push(context, MaterialPageRoute(builder: (context) => EvaluationFormPage()));
// if (isRefresh == true) {
// refreshData();
// }
// },
// ),
// );
return const SizedBox();
case DemoRequestStepEnum.viewOnly:
return const SizedBox();
@ -490,7 +490,7 @@ class FooterActionButton {
// maxWidth: true,
buttonColor: AppColor.primary10,
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) {
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';
class EvaluationFormPage extends StatefulWidget {
EvaluationFormPage({Key? key}) : super(key: key);
final int id;
const EvaluationFormPage({Key? key, required this.id}) : super(key: key);
@override
_EvaluationFormPageState createState() {
@ -234,14 +236,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
initialValue: formData['easeOfUse'],
initialValue: rating.where((obj) => obj.value == formData['easeOfUse']).firstOrNull,
staticData: rating,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
formData['easeOfUse'] = value;
formData['easeOfUse'] = value!.value;
},
),
8.height,
@ -251,14 +253,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
initialValue: formData['easeOfApplication'],
initialValue: rating.where((obj) => obj.value == formData['easeOfApplication']).firstOrNull,
staticData: rating,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
formData['easeOfApplication'] = value;
formData['easeOfApplication'] = value!.value;
},
),
8.height,
@ -268,14 +270,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
initialValue: formData['easeOfPatientSwitch'],
initialValue: rating.where((obj) => obj.value == formData['easeOfPatientSwitch']).firstOrNull,
staticData: rating,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
formData['easeOfPatientSwitch'] = value;
formData['easeOfPatientSwitch'] = value!.value;
},
),
8.height,
@ -285,14 +287,14 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
backgroundColor: AppColor.fieldBgColor(context),
showShadow: false,
showAsBottomSheet: true,
initialValue: formData['patientComfort'],
initialValue: rating.where((obj) => obj.value == formData['patientComfort']).firstOrNull,
staticData: rating,
validator: (value) {
if (value == null) return "Mandatory";
return null;
},
onSelect: (value) {
formData['patientComfort'] = value;
formData['patientComfort'] = value!.value;
},
),
// 8.height,
@ -374,11 +376,11 @@ class _EvaluationFormPageState extends State<EvaluationFormPage> {
FocusScope.of(context).unfocus();
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
Utils.showLoading(context);
DemoProvider demoProvider = Provider.of<DemoProvider>(context, listen: false);
formData["id"] = 0;
formData["id"] = widget.id;
formData["isAcknowledged"] = isAcknowledged;
bool isSuccess = await demoProvider.addDemoTrialOutcome(formData);
Utils.hideLoading(context);
if (isSuccess) {

@ -125,7 +125,7 @@ class DemoProvider extends ChangeNotifier {
Future<bool> addDemoTrialOutcome(Map<String, dynamic> body) async {
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) {
String message = (jsonDecode(response.body)["message"] ?? "");
Fluttertoast.showToast(msg: message ?? "", toastLength: Toast.LENGTH_LONG);

Loading…
Cancel
Save