Merge branch 'main' of https://git.aissel.com/poojakhatawate/DiscoverModule
This commit is contained in:
commit
513d41d28c
|
@ -1,15 +1,13 @@
|
|||
import 'package:discover_module/custom_widget/text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http_mock_adapter/http_mock_adapter.dart';
|
||||
|
||||
class Alert extends StatefulWidget {
|
||||
Alert({super.key, required this.data});
|
||||
class Alert extends StatelessWidget {
|
||||
Alert({super.key, required this.data, required this.onPressed});
|
||||
String? data;
|
||||
VoidCallbackAction? oidCallbackAction;
|
||||
final void Function() onPressed;
|
||||
|
||||
@override
|
||||
State<Alert> createState() => _AlertState();
|
||||
}
|
||||
|
||||
class _AlertState extends State<Alert> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
|
@ -18,16 +16,10 @@ class _AlertState extends State<Alert> {
|
|||
txtfont: 22.0,
|
||||
),
|
||||
content: Text1(
|
||||
title: widget.data!,
|
||||
title: data!,
|
||||
txtfont: 18.0,
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text("Cancel"))
|
||||
],
|
||||
actions: [TextButton(onPressed: onPressed, child: Text("Ok"))],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,7 +226,12 @@ class _FiltersState extends State<Filters> {
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return Alert(data: "Please select the Filter");
|
||||
return Alert(
|
||||
data: "Please select the Filter",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -239,6 +239,17 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
// : 3.8
|
||||
// : 2.4,
|
||||
|
||||
// childAspectRatio:
|
||||
// sectionList.length == 1
|
||||
// ? orientation ==
|
||||
// Orientation
|
||||
// .landscape
|
||||
// ? 10
|
||||
// : 4.8
|
||||
// : isTablet
|
||||
// ? 3.6
|
||||
// : 3.0,
|
||||
|
||||
childAspectRatio:
|
||||
sectionList.length == 1
|
||||
? orientation ==
|
||||
|
@ -247,7 +258,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
? 10
|
||||
: 4.8
|
||||
: isTablet
|
||||
? 3.6
|
||||
? 2.8
|
||||
: 3.0,
|
||||
children: List.generate(
|
||||
sectionList.length,
|
||||
|
@ -574,7 +585,18 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
// if (textFieldsValidation(provider).isEmpty) {
|
||||
await provider.saveJsonObject(context,
|
||||
widget.saveInteraction.intId, widget.saveInteraction);
|
||||
|
||||
// showAlertDialog(context, widget.saveInteraction.id);
|
||||
|
||||
print("Validation_isss: ${provider.isLoading}");
|
||||
|
||||
if (provider.isLoading == false) {
|
||||
print("Validation_false");
|
||||
showAlertDialog1(context, "Please fill all the fields");
|
||||
} else {
|
||||
showAlertDialog(context, widget.saveInteraction.id);
|
||||
print("Validation_True");
|
||||
}
|
||||
// } else {
|
||||
// _displaySnackBar(textFieldsValidation(provider));
|
||||
// }
|
||||
|
@ -1228,11 +1250,19 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
// (MediaQuery.of(context).size.height * 0.3)
|
||||
// : MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.1),
|
||||
childAspectRatio: isTablet
|
||||
? MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height / 3)
|
||||
: MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height * 0.2),
|
||||
// childAspectRatio: isTablet
|
||||
// ? MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height / 3)
|
||||
// : MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.2),
|
||||
|
||||
childAspectRatio: sectionList.length == 1
|
||||
? orientation == Orientation.landscape
|
||||
? 10
|
||||
: 4.8
|
||||
: isTablet
|
||||
? 2.8
|
||||
: 3.0,
|
||||
// mainAxisSpacing:
|
||||
// sectionList.length == 1 || !isTablet ? 1 : 3.5,
|
||||
// childAspectRatio: sectionList.length == 1
|
||||
|
@ -1388,8 +1418,9 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
|
||||
setState(() {});
|
||||
},
|
||||
width: 80,
|
||||
height: 30,
|
||||
// width: 80,
|
||||
// height: 30,
|
||||
height: 40,
|
||||
fontsize: 12,
|
||||
textColor: Colors.white,
|
||||
title: "Delete"),
|
||||
|
@ -1530,6 +1561,35 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
showAlertDialog1(BuildContext context, String record) {
|
||||
// set up the buttons
|
||||
// ViewInteractionProvider provider =
|
||||
// Provider.of<ViewInteractionProvider>(context, listen: false);
|
||||
Widget cancelButton = TextButton(
|
||||
child: const Text("Ok"),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: const Text(""),
|
||||
content: Text(record),
|
||||
actions: [
|
||||
cancelButton,
|
||||
],
|
||||
);
|
||||
|
||||
// show the dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
showFilesAlertDialog(
|
||||
BuildContext context, String files, SectionList sectionItem) {
|
||||
// set up the buttons
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:js_util';
|
||||
// import 'dart:js_util';
|
||||
|
||||
import 'package:discover_module/constants.dart';
|
||||
import 'package:discover_module/ui_screen/add_event/add_hcp.dart';
|
||||
|
@ -182,16 +182,33 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
child: GridView.count(
|
||||
physics:
|
||||
const NeverScrollableScrollPhysics(),
|
||||
// crossAxisCount:
|
||||
// context.responsive<int>(
|
||||
// 1,
|
||||
// sm: 1, // small
|
||||
// md: 1, // medium
|
||||
// lg: sectionList.length == 1
|
||||
// ? 1
|
||||
// : 3, // large
|
||||
// xl: 3, // extra large screen
|
||||
// ),
|
||||
|
||||
crossAxisCount:
|
||||
context.responsive<int>(
|
||||
1,
|
||||
sm: 1, // small
|
||||
md: 1, // medium
|
||||
md: isTablet
|
||||
? 2
|
||||
: orientation ==
|
||||
Orientation.landscape
|
||||
? 2
|
||||
: 1, // medium
|
||||
lg: sectionList.length == 1
|
||||
? 1
|
||||
: 3, // large
|
||||
xl: 3, // extra large screen
|
||||
),
|
||||
|
||||
// crossAxisCount:
|
||||
// orientation == Orientation.portrait
|
||||
// ? 1
|
||||
|
@ -503,13 +520,16 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
style: TextStyle(
|
||||
fontSize: 18.0, fontWeight: FontWeight.normal),
|
||||
)
|
||||
: Padding(
|
||||
: Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
|
||||
child: SizedBox(
|
||||
// width:
|
||||
// isTablet ? 200 : MediaQuery.of(context).size.width,
|
||||
//height: isTablet ? 50 : 40,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: isTablet ? 50 : 40,
|
||||
|
||||
child: InteractionTextField(
|
||||
inputType: sectionItem.input == "number"
|
||||
? TextInputType.number
|
||||
|
@ -521,10 +541,12 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
sectionItem.selectedValue = [];
|
||||
// sectionItem.selectedValue!.clear();
|
||||
|
||||
provider.setTextValue(val, sectionItem, multiple);
|
||||
provider.setTextValue(
|
||||
val, sectionItem, multiple);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
case InteractionWidget.DROPDOWN:
|
||||
return customdropdown(sectionItem, provider, list, multiple);
|
||||
|
@ -668,7 +690,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
|
||||
if (provider.isLoading == false) {
|
||||
print("Validation_false");
|
||||
showAlertDialog(context, "Please fill all the fields");
|
||||
showAlertDialog1(context, "Please fill all the fields");
|
||||
} else {
|
||||
showAlertDialog(context, "Form $record Saved Successfully!");
|
||||
print("Validation_True");
|
||||
|
@ -1335,22 +1357,14 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
print("ConvertedArray.leangth: $convertedArray");
|
||||
print("ConvertedArray.leangth: ${convertedArray.length}");
|
||||
|
||||
return
|
||||
// Container(
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(
|
||||
// width: 0,
|
||||
// ),
|
||||
// ),
|
||||
// child:
|
||||
DecoratedBox(
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 8.0)
|
||||
? const EdgeInsets.only(left: 14.0)
|
||||
: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -1358,30 +1372,68 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
for (var i = 0; i < convertedArray.length; i++)
|
||||
GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: context.responsive<int>(
|
||||
// 1,
|
||||
// sm: 1, // small
|
||||
// md: orientation == Orientation.landscape
|
||||
// ? 1
|
||||
// : 2, // medium
|
||||
// lg: sectionList.length == 1
|
||||
// ? 1
|
||||
// : (sectionList.length >= 1 ? 3 : 3), // large
|
||||
// xl: 3, // extra large screen
|
||||
// ),
|
||||
// mainAxisSpacing:
|
||||
// sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
// // childAspectRatio: isTablet
|
||||
// // ? MediaQuery.of(context).size.width /
|
||||
// // (MediaQuery.of(context).size.height * 0.3)
|
||||
// // : MediaQuery.of(context).size.width /
|
||||
// // (MediaQuery.of(context).size.height * 0.1),
|
||||
// childAspectRatio: isTablet
|
||||
// ? MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height / 3)
|
||||
// : MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.2),
|
||||
// ),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: context.responsive<int>(
|
||||
1,
|
||||
sm: 1, // small
|
||||
md: orientation == Orientation.landscape
|
||||
? 1
|
||||
: 2, // medium
|
||||
lg: sectionList.length == 1
|
||||
? 1
|
||||
: (sectionList.length >= 1 ? 3 : 3), // large
|
||||
md: isTablet
|
||||
? 2
|
||||
: orientation == Orientation.landscape
|
||||
? 2
|
||||
: 1, // medium
|
||||
lg: sectionList.length == 1 ? 1 : 3, // large
|
||||
xl: 3, // extra large screen
|
||||
),
|
||||
mainAxisSpacing:
|
||||
sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
sectionList.length == 1 || !isTablet ? 1 : 1,
|
||||
|
||||
// childAspectRatio: isTablet
|
||||
// ? MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.3)
|
||||
// : MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.1),
|
||||
childAspectRatio: isTablet
|
||||
? MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height / 3)
|
||||
: MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height * 0.2),
|
||||
|
||||
childAspectRatio: sectionList.length == 1
|
||||
? orientation == Orientation.landscape
|
||||
? 10
|
||||
: 4.8
|
||||
: isTablet
|
||||
? 2.8
|
||||
: 3.0,
|
||||
|
||||
// childAspectRatio: isTablet
|
||||
// ? MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height / 3)
|
||||
// : orientation == Orientation.landscape
|
||||
// ? MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.5)
|
||||
// : MediaQuery.of(context).size.width /
|
||||
// (MediaQuery.of(context).size.height * 0.1),
|
||||
),
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
|
@ -1430,8 +1482,8 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
? provider.getData2(sectionItem)
|
||||
: [];
|
||||
return Wrap(children: [
|
||||
Expanded(
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -1467,8 +1519,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
sectionItem.selectedValue = [];
|
||||
sectionItem.extension = [];
|
||||
sectionItem.fileName = [];
|
||||
await getEncodedFile(
|
||||
sectionItem);
|
||||
await getEncodedFile(sectionItem);
|
||||
|
||||
setState(() {});
|
||||
},
|
||||
|
@ -1481,17 +1532,15 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
width: 5,
|
||||
),
|
||||
Text(
|
||||
sectionItem
|
||||
sectionItem.selectedValue!.isNotEmpty
|
||||
? sectionItem
|
||||
.selectedValue!.isNotEmpty
|
||||
? sectionItem.selectedValue!
|
||||
.isNotEmpty
|
||||
? 'File uploaded'
|
||||
: "Files Uploaded"
|
||||
: 'No file uploaded',
|
||||
style: TextStyle(
|
||||
color: sectionItem
|
||||
.selectedValue!
|
||||
.isNotEmpty
|
||||
.selectedValue!.isNotEmpty
|
||||
? Colors.green
|
||||
: Colors.red),
|
||||
),
|
||||
|
@ -1510,8 +1559,8 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
icon: const Icon(
|
||||
Icons.cancel,
|
||||
size: 30,
|
||||
color: Color.fromARGB(
|
||||
255, 8, 39, 92),
|
||||
color:
|
||||
Color.fromARGB(255, 8, 39, 92),
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
|
@ -1552,8 +1601,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
multiple: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
]);
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
|
@ -1684,6 +1732,35 @@ class _InteractionScreenState extends State<InteractionScreen> {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
showAlertDialog1(BuildContext context, String record) {
|
||||
// set up the buttons
|
||||
// ViewInteractionProvider provider =
|
||||
// Provider.of<ViewInteractionProvider>(context, listen: false);
|
||||
Widget cancelButton = TextButton(
|
||||
child: const Text("Ok"),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
title: const Text(""),
|
||||
content: Text(record),
|
||||
actions: [
|
||||
cancelButton,
|
||||
],
|
||||
);
|
||||
|
||||
// show the dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ bool get isTablet {
|
|||
final logicalShortestSide =
|
||||
firstView.physicalSize.shortestSide / firstView.devicePixelRatio;
|
||||
// print("size:${logicalShortestSide > 600} tablet ");
|
||||
return logicalShortestSide > 600;
|
||||
return logicalShortestSide > 500;
|
||||
}
|
||||
|
||||
Future<String> formJsonForSync() async {
|
||||
|
|
|
@ -144,6 +144,7 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
// ? 10
|
||||
// : 3.8
|
||||
// : 2.8,
|
||||
|
||||
crossAxisCount:
|
||||
context.responsive<int>(
|
||||
1,
|
||||
|
@ -168,6 +169,15 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
: isTablet
|
||||
? 2.8
|
||||
: 3.0,
|
||||
// childAspectRatio:
|
||||
// sectionList.length == 1
|
||||
// ? orientation ==
|
||||
// Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.8
|
||||
// : isTablet
|
||||
// ? 2.8
|
||||
// : 3.0,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
children: List.generate(
|
||||
|
@ -491,9 +501,14 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
print("ConvertedArrayEdit.leangth: $convertedArray");
|
||||
print("ConvertedArray.leangth2323: ${convertedArray.length}");
|
||||
|
||||
return Padding(
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 22.0)
|
||||
? const EdgeInsets.only(left: 14.0)
|
||||
: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
|
@ -504,14 +519,28 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
crossAxisCount: context.responsive<int>(
|
||||
1, // default
|
||||
sm: 1, // small
|
||||
md: 1, // medium
|
||||
lg: sectionList.length == 1 ? 1 : 4, // large
|
||||
xl: 5, // extra large screen
|
||||
md: 2, // medium
|
||||
lg: sectionList.length == 1
|
||||
? 1
|
||||
: (sectionList.length >= 1 ? 3 : 3),
|
||||
// lg: sectionList.length == 1 ? 1 : 3, // large
|
||||
xl: 3, // extra large screen
|
||||
),
|
||||
mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
childAspectRatio: sectionList.length == 1
|
||||
? orientation == Orientation.landscape
|
||||
? 10
|
||||
: 4.8
|
||||
: isTablet
|
||||
? 2.8
|
||||
: 3.0,
|
||||
|
||||
mainAxisSpacing:
|
||||
sectionList.length == 1 || !isTablet ? 1 : 3.5,
|
||||
// mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
|
||||
// childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
|
@ -538,12 +567,14 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
SectionList sectionItem = convertedArray[i][index];
|
||||
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
dropdownvalue =
|
||||
sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
? sectionItem.value ?? "Select"
|
||||
: ' ';
|
||||
List<InputClass> list = sectionItem.widget ==
|
||||
InteractionWidget.DROPDOWN ||
|
||||
sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
sectionItem.widget ==
|
||||
InteractionWidget.AUTOCOMPLETE ||
|
||||
sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
? provider.getData2(sectionItem)
|
||||
: [];
|
||||
|
@ -561,6 +592,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
sectionItem.param == 'add' ||
|
||||
sectionItem.param == 'deletebtn'
|
||||
? const SizedBox.shrink()
|
||||
|
||||
// ? const SizedBox.shrink()
|
||||
: Text(
|
||||
'${sectionItem.name}:*',
|
||||
style: TextStyle(
|
||||
|
@ -587,6 +620,7 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
//),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
Hive.box<InteractionConfigData>('InteractionConfigDataBox'));
|
||||
|
||||
late final InteractionProvider interactionProvider;
|
||||
late bool _isLoadingView;
|
||||
|
||||
get isLoading => _isLoadingView;
|
||||
|
||||
initConfigData() async {
|
||||
intConfigDataList = _hiveprovider.getAllDataFromHive();
|
||||
notifyListeners();
|
||||
|
@ -673,6 +677,85 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
// saveJsonObject(BuildContext context, String form,
|
||||
// SaveInteraction saveInteraction) async {
|
||||
// for (var res in interactionReponseList) {
|
||||
// for (var sec in res.sectionList) {
|
||||
// debugPrint("print ${sec.selectedValue}");
|
||||
// }
|
||||
// for (var sec in res.multipleList!) {
|
||||
// debugPrint("printmultiple ${sec.selectedValue}");
|
||||
// }
|
||||
// }
|
||||
// List<FormFieldData> resultData = interactionReponseList
|
||||
// .map((e) => FormFieldData(
|
||||
// multipleList: e.multipleList == null
|
||||
// ? []
|
||||
// : e.multipleList!
|
||||
// .map((mobj) => SectionList(
|
||||
// depid: mobj.depid,
|
||||
// id: mobj.id,
|
||||
// inputList: mobj.inputList,
|
||||
// isRequired: mobj.isRequired,
|
||||
// extension: mobj.extension,
|
||||
// fileName: mobj.fileName,
|
||||
// name: mobj.name,
|
||||
// param: mobj.param,
|
||||
// selectedValue:
|
||||
// mobj.tempselectedValue ?? mobj.selectedValue,
|
||||
// widget: mobj.widget,
|
||||
// gid: mobj.gid,
|
||||
// input: mobj.input,
|
||||
// selectedId: mobj.selectedId,
|
||||
// value: mobj.value))
|
||||
// .toList(),
|
||||
// sectionList: e.sectionList
|
||||
// .map((obj) => SectionList(
|
||||
// depid: obj.depid,
|
||||
// id: obj.id,
|
||||
// inputList: obj.inputList,
|
||||
// extension: obj.extension,
|
||||
// fileName: obj.fileName,
|
||||
// isRequired: obj.isRequired,
|
||||
// name: obj.name,
|
||||
// param: obj.param,
|
||||
// selectedValue: obj.tempselectedValue ?? obj.selectedValue,
|
||||
// widget: obj.widget,
|
||||
// controller: obj.controller,
|
||||
// gid: obj.gid,
|
||||
// input: obj.input,
|
||||
// selectedId: obj.selectedId,
|
||||
// value: obj.value))
|
||||
// .toList(),
|
||||
// sectionName: e.sectionName,
|
||||
// multiple: e.multiple,
|
||||
// ))
|
||||
// .toList();
|
||||
|
||||
// final data = SaveInteraction(
|
||||
// save: resultData,
|
||||
// id: saveInteraction.id,
|
||||
// updatedTime: DateTime.now().toString(),
|
||||
// form: saveInteraction.form,
|
||||
// intId: saveInteraction.intId,
|
||||
// intName: saveInteraction.intName,
|
||||
// );
|
||||
// var box = Hive.box<SaveInteraction>('InteractionDataBox');
|
||||
|
||||
// if (!box.isOpen) {
|
||||
// box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
|
||||
// }
|
||||
|
||||
// int index =
|
||||
// box.values.toList().indexWhere((element) => element.id == data.id);
|
||||
|
||||
// box.putAt(index, data);
|
||||
// await getRecords(saveInteraction.form!);
|
||||
// // box.close();
|
||||
|
||||
// // await MockApiCall().postFormData(data);
|
||||
// }
|
||||
|
||||
saveJsonObject(BuildContext context, String form,
|
||||
SaveInteraction saveInteraction) async {
|
||||
for (var res in interactionReponseList) {
|
||||
|
@ -727,6 +810,9 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
multiple: e.multiple,
|
||||
))
|
||||
.toList();
|
||||
if (validateSectionList(resultData)) {
|
||||
_isLoadingView = true;
|
||||
notifyListeners();
|
||||
|
||||
final data = SaveInteraction(
|
||||
save: resultData,
|
||||
|
@ -746,6 +832,13 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
box.values.toList().indexWhere((element) => element.id == data.id);
|
||||
|
||||
box.putAt(index, data);
|
||||
} else {
|
||||
_isLoadingView = false;
|
||||
notifyListeners();
|
||||
|
||||
// Handle validation error
|
||||
print("JSON data is not valid according to the schema.");
|
||||
}
|
||||
await getRecords(saveInteraction.form!);
|
||||
// box.close();
|
||||
|
||||
|
@ -822,6 +915,97 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool validateSectionList(List<FormFieldData> resultData) {
|
||||
for (var formData in resultData) {
|
||||
for (var section in formData.sectionList) {
|
||||
// print("Section.leangthiss: ${resultData.length}");
|
||||
// for (int i = 0; i <= resultData.length; i++) {
|
||||
// SectionList sectionItem = formData.sectionList[i];
|
||||
// print("Section_isssss1111: ${sectionItem.validation!.isRequired}");
|
||||
// }
|
||||
|
||||
print("Section_isssss: $section");
|
||||
print("Section_isssss: ${section.widget}");
|
||||
print("Section_isssss: ${section.selectedId}");
|
||||
|
||||
if (section.widget == InteractionWidget.TEXT) {
|
||||
if (section.controller!.text.isEmpty) {
|
||||
debugPrint("Iam text and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (section.widget == InteractionWidget.AUTOCOMPLETE) {
|
||||
if (section.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam AUTOCOMPLETE and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (section.widget == InteractionWidget.DROPDOWN) {
|
||||
if (section.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam dropdown and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (section.widget == InteractionWidget.CHECKBOX) {
|
||||
if (section.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam CHECKBOX and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
print("Multilist");
|
||||
for (var msection in formData.multipleList!) {
|
||||
print("Multilist Enter");
|
||||
|
||||
print("Multilist Enterwidget: ${msection.widget}");
|
||||
|
||||
if (msection.widget == InteractionWidget.TEXT) {
|
||||
print("Checkinggg: ${msection.id}");
|
||||
print("Checkinggg: ${msection.depid}");
|
||||
print("Checkinggg: ${msection.chars}");
|
||||
print("Checkinggg: ${msection.selectedId}");
|
||||
print("Checkinggg: ${msection.selectedValue!}");
|
||||
|
||||
if (msection.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam multi text and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (msection.widget == InteractionWidget.AUTOCOMPLETE) {
|
||||
if (msection.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam AUTOCOMPLETE and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (msection.widget == InteractionWidget.DROPDOWN) {
|
||||
if (msection.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam dropdown and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
} else if (msection.widget == InteractionWidget.CHECKBOX) {
|
||||
if (msection.selectedValue!.isEmpty) {
|
||||
debugPrint("Iam CHECKBOX and empty");
|
||||
notifyListeners();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:js_interop';
|
||||
// import 'dart:js_interop';
|
||||
|
||||
import 'package:discover_module/custom_widget/floating_btn.dart';
|
||||
import 'package:discover_module/custom_widget/show_alert.dart';
|
||||
import 'package:discover_module/ui_screen/contacts.dart';
|
||||
import 'package:discover_module/ui_screen/profile.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
|
@ -145,6 +146,19 @@ class _RankingState extends State<Ranking> {
|
|||
// Do something with selectedRowIds
|
||||
print('Selected Row IDstrndsss: $selectedRowIds');
|
||||
|
||||
if (selectedRowIds.isEmpty) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return Alert(
|
||||
data: "Please Select the user",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
print('OK button pressed');
|
||||
},
|
||||
);
|
||||
});
|
||||
} else {
|
||||
for (int i = 0; i < selectedRowIds.length; i++) {
|
||||
print('The id id : ${selectedRowIds[i]}');
|
||||
|
||||
|
@ -172,8 +186,16 @@ class _RankingState extends State<Ranking> {
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return Alert(data: "User Added Successfully");
|
||||
return Alert(
|
||||
data: "User Added Successfully",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
// Navigator.push(context,
|
||||
// MaterialPageRoute(builder: (_) => Contacts()));
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
)),
|
||||
),
|
||||
|
|
|
@ -128,6 +128,9 @@ class RisingStarState extends State<RisingStar> {
|
|||
builder: (_) {
|
||||
return Alert(
|
||||
data: "User Added Successfully",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -101,7 +101,12 @@ class _TrendsState extends State<Trends> {
|
|||
showDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return Alert(data: "User Added Successfully");
|
||||
return Alert(
|
||||
data: "User Added Successfully",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
)),
|
||||
|
|
Loading…
Reference in New Issue