UIiphoneResponsie
This commit is contained in:
parent
6ddaf2774a
commit
e13307c953
|
@ -49,6 +49,8 @@ Future<void> main() async {
|
|||
var box = await Hive.openBox('mycontact');
|
||||
var box1 = await Hive.openBox('myfilter');
|
||||
|
||||
await Hive.openBox('checkvalue');
|
||||
|
||||
runApp(MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => InteractionProvider()),
|
||||
|
@ -173,3 +175,62 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// import 'package:flutter/material.dart';
|
||||
|
||||
// class MyGridView extends StatefulWidget {
|
||||
// @override
|
||||
// _MyGridViewState createState() => _MyGridViewState();
|
||||
// }
|
||||
|
||||
// class _MyGridViewState extends State<MyGridView> {
|
||||
// List<List<String>> sections = [["Item 1", "Item 2", "Item 3"]];
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: Text('GridView Example'),
|
||||
// ),
|
||||
// body: Column(
|
||||
// children: [
|
||||
// Expanded(
|
||||
// child: ListView.builder(
|
||||
// itemCount: sections.length,
|
||||
// itemBuilder: (context, index) {
|
||||
// return GridView.count(
|
||||
// shrinkWrap: true,
|
||||
// crossAxisCount: 2,
|
||||
// children: sections[index].map((item) {
|
||||
// return Card(
|
||||
// child: Center(
|
||||
// child: Text(item),
|
||||
// ),
|
||||
// );
|
||||
// }).toList(),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ElevatedButton(
|
||||
// onPressed: () {
|
||||
// setState(() {
|
||||
// sections.add(["Item 1", "Item 2", "Item 3"]);
|
||||
// });
|
||||
// },
|
||||
// child: Icon(Icons.add),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// void main() {
|
||||
// runApp(MaterialApp(
|
||||
// home: MyGridView(),
|
||||
// ));
|
||||
// }
|
||||
|
|
|
@ -29,7 +29,8 @@ class _ContactsState extends State<Contacts> {
|
|||
print(
|
||||
"Data_newww: ${HiveFunctions.getAllUsers()} ,${HiveFunctions.getAllUsers().length} ");
|
||||
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Contacts'),
|
||||
// ),
|
||||
|
@ -115,8 +116,10 @@ class _ContactsState extends State<Contacts> {
|
|||
children: [
|
||||
ListTile(
|
||||
onTap: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => Profile()));
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => Profile()));
|
||||
},
|
||||
// title: Text(_contactbox.values.toString()),
|
||||
leading: ProfilePicture(
|
||||
|
@ -142,6 +145,7 @@ class _ContactsState extends State<Contacts> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,13 +98,14 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
return Consumer<ViewInteractionProvider>(
|
||||
builder: (BuildContext context, provider, Widget? child) {
|
||||
// print("build context");
|
||||
// print("${provider.interactionReponseList}");
|
||||
// print("Providerr_is: ${provider.multipletextEditingControllerList}");
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: OrientationBuilder(builder: (context, orientation) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
//resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
|
@ -195,7 +196,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
|
||||
Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 14.0)
|
||||
? const EdgeInsets.only(
|
||||
left: 14.0)
|
||||
: const EdgeInsets.only(
|
||||
left: 12.0, right: 12.0),
|
||||
child: GridView.count(
|
||||
|
@ -240,7 +242,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
childAspectRatio:
|
||||
sectionList.length == 1
|
||||
? orientation ==
|
||||
Orientation.landscape
|
||||
Orientation
|
||||
.landscape
|
||||
? 10
|
||||
: 4.8
|
||||
: isTablet
|
||||
|
@ -252,9 +255,10 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
// print(sectionList);
|
||||
SectionList sectionItem =
|
||||
sectionList[i];
|
||||
dropdownvalue = sectionItem
|
||||
.widget ==
|
||||
InteractionWidget.DROPDOWN
|
||||
dropdownvalue =
|
||||
sectionItem.widget ==
|
||||
InteractionWidget
|
||||
.DROPDOWN
|
||||
? sectionItem.value ??
|
||||
"Select"
|
||||
: ' ';
|
||||
|
@ -276,8 +280,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
sectionItem.widget ==
|
||||
InteractionWidget
|
||||
.CHECKBOX
|
||||
? provider
|
||||
.getData2(sectionItem)
|
||||
? provider.getData2(
|
||||
sectionItem)
|
||||
: [];
|
||||
|
||||
return Column(
|
||||
|
@ -289,7 +293,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
.BUTTON &&
|
||||
sectionItem.input ==
|
||||
'add'
|
||||
? const SizedBox.shrink()
|
||||
? const SizedBox
|
||||
.shrink()
|
||||
: Padding(
|
||||
padding:
|
||||
const EdgeInsets
|
||||
|
@ -302,7 +307,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
color: Colors
|
||||
.orange
|
||||
.shade800,
|
||||
fontSize: isTablet
|
||||
fontSize:
|
||||
isTablet
|
||||
? 18
|
||||
: 12,
|
||||
),
|
||||
|
@ -312,7 +318,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
height: isTablet ? 15 : 5,
|
||||
),
|
||||
returnWidget(
|
||||
sectionItem: sectionItem,
|
||||
sectionItem:
|
||||
sectionItem,
|
||||
item: item,
|
||||
provider: provider,
|
||||
list: list,
|
||||
|
@ -342,7 +349,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
item,
|
||||
index)
|
||||
: const SizedBox.shrink(),
|
||||
provider.interactionReponseList.length ==
|
||||
provider.interactionReponseList
|
||||
.length ==
|
||||
index - 1
|
||||
? saveActions(provider)
|
||||
: const SizedBox.shrink()
|
||||
|
@ -358,7 +366,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
// const Spacer(),
|
||||
// saveActions(provider),
|
||||
],
|
||||
));
|
||||
)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -389,6 +398,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
return customMultiselectDropdown(sectionItem, provider, list, multiple);
|
||||
|
||||
case InteractionWidget.RADIO:
|
||||
print("Radiiooooo");
|
||||
return (sectionItem.inputList!.length >= 5)
|
||||
? customdropdown(
|
||||
sectionItem, provider, sectionItem.inputList!, multiple)
|
||||
|
@ -556,8 +566,10 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
CustomButton(
|
||||
backgroundColor: Colors.green.shade900,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: CustomButton(
|
||||
backgroundColor: Colors.green.shade500,
|
||||
onPressed: () async {
|
||||
// if (textFieldsValidation(provider).isEmpty) {
|
||||
await provider.saveJsonObject(context,
|
||||
|
@ -569,9 +581,12 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
},
|
||||
textColor: Colors.white,
|
||||
title: "Update",
|
||||
height: 40,
|
||||
width: isTablet ? 120 : 80,
|
||||
fontsize: isTablet ? 15 : 12,
|
||||
// height: 40,
|
||||
// width: isTablet ? 120 : 80,
|
||||
height: MediaQuery.of(context).size.height * 0.2,
|
||||
|
||||
fontsize: isTablet ? 16 : 12,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: isTablet ? 20 : 2,
|
||||
|
@ -655,7 +670,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
Widget customdropdown(SectionList sectionItem,
|
||||
ViewInteractionProvider provider, List<InputClass> list, bool multiple) {
|
||||
// sectionItem.value = '';
|
||||
print("%%%%${sectionItem.selectedValue!.last}");
|
||||
// print("%%%%${sectionItem.selectedValue!.last}");
|
||||
print("ItemList_is: $list");
|
||||
if (list.isEmpty) {
|
||||
print("###list empty###");
|
||||
list = [];
|
||||
|
@ -987,6 +1003,168 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
// Widget gridViewWidget(
|
||||
// ViewInteractionProvider provider,
|
||||
// String sectionName,
|
||||
// List<SectionList> sectionList,
|
||||
// Orientation orientation,
|
||||
// FormFieldData item,
|
||||
// int listIndex) {
|
||||
// print("SectionListtt:isss: $sectionList");
|
||||
// return Padding(
|
||||
// padding: isTablet
|
||||
// ? const EdgeInsets.only(left: 8.0)
|
||||
// : const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
// child: GridView.count(
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// crossAxisCount: context.responsive<int>(
|
||||
// 1, // default
|
||||
// sm: 1, // small
|
||||
// md: 1, // medium
|
||||
// lg: sectionList.length == 1 ? 1 : 4, // large
|
||||
// xl: 5, // extra large screen
|
||||
// ),
|
||||
// mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
// shrinkWrap: true,
|
||||
// padding: EdgeInsets.zero,
|
||||
// childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.2
|
||||
// : 1.8,
|
||||
// children: List.generate(
|
||||
// sectionList.length,
|
||||
// (i) {
|
||||
// // print(sectionList);
|
||||
// SectionList sectionItem = sectionList[i];
|
||||
// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
// ? sectionItem.value ?? "Select"
|
||||
// : ' ';
|
||||
// List<InputClass> list =
|
||||
// sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
// provider.checkboxlist =
|
||||
// sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
|
||||
// return Wrap(children: [
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// sectionItem.widget == InteractionWidget.BUTTON &&
|
||||
// sectionItem.param == 'add' ||
|
||||
// sectionItem.param == 'deletebtn'
|
||||
// ? const SizedBox.shrink()
|
||||
// : Text(
|
||||
// '${sectionItem.name}:*',
|
||||
// style: TextStyle(
|
||||
// color: Colors.orange.shade800,
|
||||
// fontSize: isTablet ? 18 : 14,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// sectionItem.widget == InteractionWidget.BUTTON
|
||||
// ? sectionItem.input == 'chooseFile'
|
||||
// ? Row(
|
||||
// children: [
|
||||
// CustomButton(
|
||||
// backgroundColor: const Color.fromARGB(
|
||||
// 255, 233, 229, 229),
|
||||
// onPressed: () async {
|
||||
// if (sectionItem
|
||||
// .selectedValue!.isNotEmpty) {
|
||||
// showFilesAlertDialog(
|
||||
// context,
|
||||
// sectionItem.fileName!.join(','),
|
||||
// sectionItem);
|
||||
// } else {
|
||||
// sectionItem.selectedValue = [];
|
||||
// sectionItem.extension = [];
|
||||
// sectionItem.fileName = [];
|
||||
// await getEncodedFile(sectionItem);
|
||||
// }
|
||||
// setState(() {});
|
||||
// },
|
||||
// width: 120,
|
||||
// height: 40,
|
||||
// fontsize: 12,
|
||||
// textColor: Colors.black,
|
||||
// title: sectionItem.name),
|
||||
// const SizedBox(
|
||||
// width: 5,
|
||||
// ),
|
||||
// Text(
|
||||
// sectionItem.selectedValue!.isNotEmpty
|
||||
// ? 'File uploaded'
|
||||
// : 'No file uploaded',
|
||||
// style: TextStyle(
|
||||
// color:
|
||||
// sectionItem.selectedValue!.isNotEmpty
|
||||
// ? Colors.green
|
||||
// : Colors.red),
|
||||
// ),
|
||||
// ],
|
||||
// )
|
||||
// : isTablet
|
||||
// ? IconButton(
|
||||
// onPressed: () {
|
||||
// provider.deleteMultipleRows(
|
||||
// sectionItem.gid!,
|
||||
// sectionList[i],
|
||||
// sectionName);
|
||||
|
||||
// setState(() {});
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.cancel,
|
||||
// size: 30,
|
||||
// color: Color.fromARGB(255, 8, 39, 92),
|
||||
// ),
|
||||
// )
|
||||
// : Padding(
|
||||
// padding:
|
||||
// const EdgeInsets.only(left: 3.0, top: 5),
|
||||
// child: CustomButton(
|
||||
// backgroundColor: const Color.fromARGB(
|
||||
// 255, 233, 75, 75),
|
||||
// onPressed: () {
|
||||
// provider.deleteMultipleRows(
|
||||
// sectionItem.gid!,
|
||||
// sectionList[i],
|
||||
// sectionName);
|
||||
|
||||
// setState(() {});
|
||||
// },
|
||||
// width: 80,
|
||||
// height: 30,
|
||||
// fontsize: 12,
|
||||
// textColor: Colors.white,
|
||||
// title: "Delete"),
|
||||
// )
|
||||
// : returnWidget(
|
||||
// sectionItem: sectionItem,
|
||||
// item: item,
|
||||
// provider: provider,
|
||||
// list: list,
|
||||
// gridIndex: i,
|
||||
// listIndex: listIndex,
|
||||
// widgetData: sectionItem.widget!,
|
||||
// multiple: true),
|
||||
// ],
|
||||
// ),
|
||||
// ]);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget gridViewWidget(
|
||||
ViewInteractionProvider provider,
|
||||
String sectionName,
|
||||
|
@ -994,38 +1172,115 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
Orientation orientation,
|
||||
FormFieldData item,
|
||||
int listIndex) {
|
||||
return Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 8.0)
|
||||
: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: GridView.count(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: context.responsive<int>(
|
||||
1, // default
|
||||
sm: 1, // small
|
||||
md: 1, // medium
|
||||
lg: sectionList.length == 1 ? 1 : 4, // large
|
||||
xl: 5, // extra large screen
|
||||
print("SectionListtt:isss: $sectionList");
|
||||
|
||||
List<SectionList> pooja = sectionList;
|
||||
|
||||
print("Pooja: $pooja");
|
||||
|
||||
List<List<SectionList>> convertedArray = [];
|
||||
print("Provider Length: ${item.sectionList.length}");
|
||||
|
||||
for (int i = 0; i < sectionList.length; i += item.sectionList.length + 1) {
|
||||
print("Section List11111: $sectionList");
|
||||
print("item.sectionList.length List11111: ${item.sectionList.length}");
|
||||
|
||||
convertedArray
|
||||
.add(sectionList.sublist(i, i + item.sectionList.length + 1));
|
||||
}
|
||||
print("ConvertedArrayEditMulti.leangth: $convertedArray");
|
||||
print("ConvertedArray.leangth: ${convertedArray.length}");
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.black),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
child: Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 14.0)
|
||||
: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: Column(
|
||||
children: [
|
||||
for (var i = 0; i < convertedArray.length; i++)
|
||||
GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: context.responsive<int>(
|
||||
// 1, // default
|
||||
// sm: 1, // small
|
||||
// md: 1, // medium
|
||||
// lg: sectionList.length == 1 ? 1 : 4, // large
|
||||
// xl: 5, // extra large screen
|
||||
// ),
|
||||
crossAxisCount: context.responsive<int>(
|
||||
1,
|
||||
sm: 1, // small
|
||||
md: 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),
|
||||
// mainAxisSpacing:
|
||||
// sectionList.length == 1 || !isTablet ? 1 : 3.5,
|
||||
// childAspectRatio: sectionList.length == 1
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.8
|
||||
// : isTablet
|
||||
// ? 2.8
|
||||
// : 3.0,
|
||||
),
|
||||
mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
? orientation == Orientation.landscape
|
||||
? 10
|
||||
: 4.2
|
||||
: 1.8,
|
||||
children: List.generate(
|
||||
sectionList.length,
|
||||
(i) {
|
||||
// print(sectionList);
|
||||
SectionList sectionItem = sectionList[i];
|
||||
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
|
||||
// childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.2
|
||||
// : 1.8,
|
||||
|
||||
itemCount: convertedArray[i].length,
|
||||
itemBuilder: (context, index) {
|
||||
// children: List.generate(
|
||||
// sectionList.length,
|
||||
// (i) {
|
||||
// // print(sectionList);
|
||||
// SectionList sectionItem = sectionList[i];
|
||||
// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
// ? sectionItem.value ?? "Select"
|
||||
// : ' ';
|
||||
// List<InputClass> list =
|
||||
// sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
// provider.checkboxlist =
|
||||
// sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
SectionList sectionItem = convertedArray[i][index];
|
||||
dropdownvalue =
|
||||
sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
? sectionItem.value ?? "Select"
|
||||
: ' ';
|
||||
List<InputClass> list =
|
||||
sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
List<InputClass> list = sectionItem.widget ==
|
||||
InteractionWidget.DROPDOWN ||
|
||||
sectionItem.widget ==
|
||||
InteractionWidget.AUTOCOMPLETE ||
|
||||
sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
? provider.getData2(sectionItem)
|
||||
: [];
|
||||
|
@ -1033,22 +1288,26 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
? provider.getData2(sectionItem)
|
||||
: [];
|
||||
|
||||
return Wrap(children: [
|
||||
Column(
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
sectionItem.widget == InteractionWidget.BUTTON &&
|
||||
sectionItem.param == 'add' ||
|
||||
sectionItem.param == 'deletebtn'
|
||||
? const SizedBox.shrink()
|
||||
: Text(
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8.0, right: 8.0),
|
||||
child: Text(
|
||||
'${sectionItem.name}:*',
|
||||
style: TextStyle(
|
||||
color: Colors.orange.shade800,
|
||||
fontSize: isTablet ? 18 : 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
|
@ -1057,20 +1316,23 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
? Row(
|
||||
children: [
|
||||
CustomButton(
|
||||
backgroundColor: const Color.fromARGB(
|
||||
backgroundColor:
|
||||
const Color.fromARGB(
|
||||
255, 233, 229, 229),
|
||||
onPressed: () async {
|
||||
if (sectionItem
|
||||
.selectedValue!.isNotEmpty) {
|
||||
showFilesAlertDialog(
|
||||
context,
|
||||
sectionItem.fileName!.join(','),
|
||||
sectionItem.fileName!
|
||||
.join(','),
|
||||
sectionItem);
|
||||
} else {
|
||||
sectionItem.selectedValue = [];
|
||||
sectionItem.extension = [];
|
||||
sectionItem.fileName = [];
|
||||
await getEncodedFile(sectionItem);
|
||||
await getEncodedFile(
|
||||
sectionItem);
|
||||
}
|
||||
setState(() {});
|
||||
},
|
||||
|
@ -1087,8 +1349,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
? 'File uploaded'
|
||||
: 'No file uploaded',
|
||||
style: TextStyle(
|
||||
color:
|
||||
sectionItem.selectedValue!.isNotEmpty
|
||||
color: sectionItem
|
||||
.selectedValue!.isNotEmpty
|
||||
? Colors.green
|
||||
: Colors.red),
|
||||
),
|
||||
|
@ -1107,14 +1369,16 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
icon: const Icon(
|
||||
Icons.cancel,
|
||||
size: 30,
|
||||
color: Color.fromARGB(255, 8, 39, 92),
|
||||
color:
|
||||
Color.fromARGB(255, 8, 39, 92),
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 3.0, top: 5),
|
||||
padding: const EdgeInsets.only(
|
||||
left: 3.0, top: 5),
|
||||
child: CustomButton(
|
||||
backgroundColor: const Color.fromARGB(
|
||||
backgroundColor:
|
||||
const Color.fromARGB(
|
||||
255, 233, 75, 75),
|
||||
onPressed: () {
|
||||
provider.deleteMultipleRows(
|
||||
|
@ -1141,8 +1405,9 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
|
|||
multiple: true),
|
||||
],
|
||||
),
|
||||
]);
|
||||
},
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -47,7 +47,8 @@ class _InteractionListScreenState extends State<InteractionListScreen> {
|
|||
Widget build(BuildContext context) {
|
||||
return Consumer<InteractionProvider>(
|
||||
builder: (BuildContext context, provider, Widget? child) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'Interaction Forms',
|
||||
|
@ -106,25 +107,28 @@ class _InteractionListScreenState extends State<InteractionListScreen> {
|
|||
),
|
||||
trailing: provider.savedList.indexWhere((element) =>
|
||||
element.form ==
|
||||
provider.intConfigDataList[index].name) !=
|
||||
provider
|
||||
.intConfigDataList[index].name) !=
|
||||
-1
|
||||
? InkWell(
|
||||
onTap: () {
|
||||
if (getCount(
|
||||
provider
|
||||
.intConfigDataList[index].name,
|
||||
provider.intConfigDataList[index]
|
||||
.name,
|
||||
provider) !=
|
||||
0) {
|
||||
provider.savedList
|
||||
.where((element) =>
|
||||
element.form ==
|
||||
provider.intConfigDataList[index]
|
||||
provider
|
||||
.intConfigDataList[index]
|
||||
.name)
|
||||
.toList();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
builder:
|
||||
(BuildContext context) =>
|
||||
SavedFormListScreen(
|
||||
formname: provider
|
||||
.intConfigDataList[
|
||||
|
@ -162,6 +166,7 @@ class _InteractionListScreenState extends State<InteractionListScreen> {
|
|||
);
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,10 +16,12 @@ class MockApiCall {
|
|||
|
||||
final response = await dio.get('https://passvault.konectar.io/forms');
|
||||
|
||||
print("response1");
|
||||
print("response1_isssss");
|
||||
// print(response.data.toString());
|
||||
log('${jsonEncode(response.data)}');
|
||||
// log(jsonEncode(response.data));
|
||||
|
||||
final parsedJson = json.encode(response.data);
|
||||
print(parsedJson);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,11 @@ class FormFieldData {
|
|||
Map<String, dynamic> saveToJson() => {
|
||||
"sectionName": sectionName,
|
||||
};
|
||||
@override
|
||||
String toString() {
|
||||
// TODO: implement toString
|
||||
return multiple.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@HiveType(typeId: 5)
|
||||
|
|
|
@ -62,6 +62,12 @@ class SaveInteraction {
|
|||
"form": form,
|
||||
"intId": intId,
|
||||
};
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
// TODO: implement toString
|
||||
return save.toString();
|
||||
}
|
||||
}
|
||||
|
||||
class JsonFormat {}
|
||||
|
|
|
@ -10,7 +10,7 @@ class HiveDataRepository extends ChangeNotifier {
|
|||
HiveDataRepository(this._hiveBox);
|
||||
|
||||
List<InteractionConfigData> getAllDataFromHive() {
|
||||
print("Stored_ALL_valuesssss : ${_hiveBox.values.toList()}");
|
||||
print("Stored_ALL_valuesssss : ${_hiveBox.values.toList().toString()}");
|
||||
print(
|
||||
"Stored_ALL_valuesssss_leangthhh : ${_hiveBox.values.toList().length}");
|
||||
|
||||
|
|
|
@ -39,11 +39,13 @@ class _SavedFormListScreenState extends State<SavedFormListScreen> {
|
|||
Widget build(BuildContext context) {
|
||||
return Consumer<ViewInteractionProvider>(
|
||||
builder: (BuildContext context, provider, Widget? child) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'Records of ${widget.formname}',
|
||||
style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
|
||||
style:
|
||||
TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
|
||||
),
|
||||
automaticallyImplyLeading: false,
|
||||
// backgroundColor: const Color(0xFF2b9af3),
|
||||
|
@ -102,8 +104,8 @@ class _SavedFormListScreenState extends State<SavedFormListScreen> {
|
|||
MaterialPageRoute(
|
||||
builder: (BuildContext context) =>
|
||||
EditInteractionScreen(
|
||||
saveInteraction:
|
||||
provider.savedList[index],
|
||||
saveInteraction: provider
|
||||
.savedList[index],
|
||||
)))
|
||||
});
|
||||
},
|
||||
|
@ -144,6 +146,7 @@ class _SavedFormListScreenState extends State<SavedFormListScreen> {
|
|||
);
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -51,7 +51,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: OrientationBuilder(builder: (context, orientation) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
//resizeToAvoidBottomInset: false,
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
|
@ -106,7 +107,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
|
@ -142,7 +144,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
// ? 10
|
||||
// : 3.8
|
||||
// : 2.8,
|
||||
crossAxisCount: context.responsive<int>(
|
||||
crossAxisCount:
|
||||
context.responsive<int>(
|
||||
1,
|
||||
sm: 1, // small
|
||||
md: 2, // medium
|
||||
|
@ -152,7 +155,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
xl: 3, // extra large screen
|
||||
),
|
||||
mainAxisSpacing:
|
||||
sectionList.length == 1 || !isTablet
|
||||
sectionList.length == 1 ||
|
||||
!isTablet
|
||||
? 1
|
||||
: 3.5,
|
||||
childAspectRatio:
|
||||
|
@ -175,9 +179,11 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
dropdownvalue = sectionItem
|
||||
.widget ==
|
||||
InteractionWidget.DROPDOWN
|
||||
? sectionItem.value ?? "Select"
|
||||
? sectionItem.value ??
|
||||
"Select"
|
||||
: ' ';
|
||||
List<InputClass> list = sectionItem
|
||||
List<
|
||||
InputClass> list = sectionItem
|
||||
.widget ==
|
||||
InteractionWidget
|
||||
.DROPDOWN ||
|
||||
|
@ -187,12 +193,15 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
sectionItem.widget ==
|
||||
InteractionWidget
|
||||
.MULTISELECT
|
||||
? provider.getData2(sectionItem)
|
||||
? provider
|
||||
.getData2(sectionItem)
|
||||
: [];
|
||||
provider.checkboxlist = sectionItem
|
||||
.widget ==
|
||||
InteractionWidget.CHECKBOX
|
||||
? provider.getData2(sectionItem)
|
||||
provider.checkboxlist =
|
||||
sectionItem.widget ==
|
||||
InteractionWidget
|
||||
.CHECKBOX
|
||||
? provider
|
||||
.getData2(sectionItem)
|
||||
: [];
|
||||
|
||||
return Column(
|
||||
|
@ -208,8 +217,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
: Text(
|
||||
'${sectionItem.name}:*',
|
||||
style: TextStyle(
|
||||
color: Colors
|
||||
.orange.shade800,
|
||||
color: Colors.orange
|
||||
.shade800,
|
||||
fontSize: isTablet
|
||||
? 18
|
||||
: 12,
|
||||
|
@ -263,7 +272,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
// const Spacer(),
|
||||
// saveActions(provider),
|
||||
],
|
||||
));
|
||||
)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -375,6 +385,88 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
// Widget gridViewWidget(
|
||||
// InteractionProvider provider,
|
||||
// String sectionName,
|
||||
// List<SectionList> sectionList,
|
||||
// Orientation orientation,
|
||||
// FormFieldData item,
|
||||
// int listIndex) {
|
||||
// return Padding(
|
||||
// padding: isTablet
|
||||
// ? const EdgeInsets.only(left: 22.0)
|
||||
// : const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
// child: GridView.count(
|
||||
// physics: const NeverScrollableScrollPhysics(),
|
||||
// crossAxisCount: context.responsive<int>(
|
||||
// 1, // default
|
||||
// sm: 1, // small
|
||||
// md: 1, // medium
|
||||
// lg: sectionList.length == 1 ? 1 : 4, // large
|
||||
// xl: 5, // extra large screen
|
||||
// ),
|
||||
// mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
// shrinkWrap: true,
|
||||
// padding: EdgeInsets.zero,
|
||||
// childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.2
|
||||
// : 1.8,
|
||||
// children: List.generate(
|
||||
// sectionList.length,
|
||||
// (i) {
|
||||
// print(sectionList);
|
||||
// SectionList sectionItem = sectionList[i];
|
||||
// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
// ? sectionItem.value ?? "Select"
|
||||
// : ' ';
|
||||
// List<InputClass> list =
|
||||
// sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
// provider.checkboxlist =
|
||||
// sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
|
||||
// return Wrap(children: [
|
||||
// Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// sectionItem.widget == InteractionWidget.BUTTON &&
|
||||
// sectionItem.param == 'add' ||
|
||||
// sectionItem.param == 'deletebtn'
|
||||
// ? const SizedBox.shrink()
|
||||
// : Text(
|
||||
// '${sectionItem.name}:*',
|
||||
// style: TextStyle(
|
||||
// color: Colors.orange.shade800,
|
||||
// fontSize: isTablet ? 18 : 14,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// returnWidget(
|
||||
// sectionItem: sectionItem,
|
||||
// item: item,
|
||||
// provider: provider,
|
||||
// list: list,
|
||||
// gridIndex: i,
|
||||
// listIndex: listIndex,
|
||||
// widgetData: sectionItem.widget!),
|
||||
// ],
|
||||
// ),
|
||||
// ]);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
Widget gridViewWidget(
|
||||
InteractionProvider provider,
|
||||
String sectionName,
|
||||
|
@ -382,12 +474,33 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
Orientation orientation,
|
||||
FormFieldData item,
|
||||
int listIndex) {
|
||||
List<SectionList> pooja = sectionList;
|
||||
|
||||
print("Pooja: $pooja");
|
||||
|
||||
List<List<SectionList>> convertedArray = [];
|
||||
print("Provider Length: ${item.sectionList.length}");
|
||||
|
||||
for (int i = 0; i < sectionList.length; i += item.sectionList.length + 1) {
|
||||
print("Section List11111: $sectionList");
|
||||
print("item.sectionList.length List11111: ${item.sectionList.length}");
|
||||
|
||||
convertedArray
|
||||
.add(sectionList.sublist(i, i + item.sectionList.length + 1));
|
||||
}
|
||||
print("ConvertedArrayEdit.leangth: $convertedArray");
|
||||
print("ConvertedArray.leangth2323: ${convertedArray.length}");
|
||||
|
||||
return Padding(
|
||||
padding: isTablet
|
||||
? const EdgeInsets.only(left: 22.0)
|
||||
: const EdgeInsets.only(left: 12.0, right: 12.0),
|
||||
child: GridView.count(
|
||||
child: Column(
|
||||
children: [
|
||||
for (var i = 0; i < convertedArray.length; i++)
|
||||
GridView.builder(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: context.responsive<int>(
|
||||
1, // default
|
||||
sm: 1, // small
|
||||
|
@ -396,23 +509,40 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
xl: 5, // extra large screen
|
||||
),
|
||||
mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.zero,
|
||||
childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
? orientation == Orientation.landscape
|
||||
? 10
|
||||
: 4.2
|
||||
: 1.8,
|
||||
children: List.generate(
|
||||
sectionList.length,
|
||||
(i) {
|
||||
print(sectionList);
|
||||
SectionList sectionItem = sectionList[i];
|
||||
// childAspectRatio: sectionList.length == 1 || !isTablet
|
||||
// ? orientation == Orientation.landscape
|
||||
// ? 10
|
||||
// : 4.2
|
||||
// : 1.8,
|
||||
itemCount: convertedArray[i].length,
|
||||
itemBuilder: (context, index) {
|
||||
// children: List.generate(
|
||||
// sectionList.length,
|
||||
// (i) {
|
||||
// print(sectionList);
|
||||
// SectionList sectionItem = sectionList[i];
|
||||
// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
// ? sectionItem.value ?? "Select"
|
||||
// : ' ';
|
||||
// List<InputClass> list =
|
||||
// sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
// provider.checkboxlist =
|
||||
// sectionItem.widget == InteractionWidget.CHECKBOX
|
||||
// ? provider.getData2(sectionItem)
|
||||
// : [];
|
||||
SectionList sectionItem = convertedArray[i][index];
|
||||
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
|
||||
? sectionItem.value ?? "Select"
|
||||
: ' ';
|
||||
List<InputClass> list =
|
||||
sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
List<InputClass> list = sectionItem.widget ==
|
||||
InteractionWidget.DROPDOWN ||
|
||||
sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
sectionItem.widget == InteractionWidget.MULTISELECT
|
||||
? provider.getData2(sectionItem)
|
||||
|
@ -422,8 +552,9 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
? provider.getData2(sectionItem)
|
||||
: [];
|
||||
|
||||
return Wrap(children: [
|
||||
Column(
|
||||
return SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
sectionItem.widget == InteractionWidget.BUTTON &&
|
||||
|
@ -450,9 +581,11 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
|
|||
widgetData: sectionItem.widget!),
|
||||
],
|
||||
),
|
||||
]);
|
||||
);
|
||||
},
|
||||
),
|
||||
//),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -140,13 +140,22 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
|
||||
for (SectionList obj in item.multipleList!) {
|
||||
obj.gid = obj.gid ?? item.multipleList!.length;
|
||||
|
||||
if (obj.widget == InteractionWidget.TEXT) {
|
||||
debugPrint("textcontr:${obj.gid}");
|
||||
debugPrint("textcontr:${obj.selectedValue}");
|
||||
// debugPrint("textcontr:${obj.controller!.value}");
|
||||
var textEditingController = TextEditingController();
|
||||
textEditingController.value = TextEditingValue(
|
||||
text: obj.selectedValue!.isNotEmpty
|
||||
? obj.selectedValue!.last ?? ""
|
||||
: "");
|
||||
textEditingController.text = obj.selectedValue!.isNotEmpty
|
||||
? obj.selectedValue!.last ?? ""
|
||||
: "";
|
||||
multipletextEditingControllerList.add(textEditingController);
|
||||
obj.controller = multipletextEditingControllerList.last;
|
||||
// obj.controller!.value = textEditingController.value;
|
||||
obj.controller = textEditingController;
|
||||
// obj.controller = obj.selectedValue.last ?? " ";
|
||||
}
|
||||
if (obj.widget == InteractionWidget.DROPDOWN ||
|
||||
|
@ -608,6 +617,23 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
// if (interactionReponseList[index].multipleList!.isEmpty) {
|
||||
// newList = addList;
|
||||
// } else {
|
||||
|
||||
if (addList.isNotEmpty) {
|
||||
for (SectionList obj in addList) {
|
||||
// obj.gid = obj.gid ?? addList.length;
|
||||
if (obj.widget == InteractionWidget.TEXT) {
|
||||
var textEditingController = TextEditingController();
|
||||
|
||||
multipletextEditingControllerList.add(textEditingController);
|
||||
obj.controller = multipletextEditingControllerList.last;
|
||||
obj.controller!.text =
|
||||
obj.selectedValue != null && obj.selectedValue!.isNotEmpty
|
||||
? obj.selectedValue!.last
|
||||
: '';
|
||||
}
|
||||
// newList.add(obj);
|
||||
}
|
||||
}
|
||||
if (interactionReponseList[index].multipleList == null) {
|
||||
interactionReponseList[index].multipleList = addList;
|
||||
} else {
|
||||
|
@ -622,10 +648,6 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
for (SectionList obj in interactionReponseList[index].multipleList!) {
|
||||
obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
|
||||
if (obj.widget == InteractionWidget.TEXT) {
|
||||
var textEditingController = TextEditingController();
|
||||
|
||||
multipletextEditingControllerList.add(textEditingController);
|
||||
obj.controller = multipletextEditingControllerList.last;
|
||||
obj.controller!.text =
|
||||
obj.selectedValue != null && obj.selectedValue!.isNotEmpty
|
||||
? obj.selectedValue!.last
|
||||
|
@ -653,6 +675,14 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
|
||||
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
|
||||
|
@ -793,3 +823,814 @@ class ViewInteractionProvider extends ChangeNotifier {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// import 'dart:convert';
|
||||
|
||||
// import 'package:dio/dio.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/model/interaction_config_data.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/model/json_form_data.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/model/location_model.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
|
||||
// import 'package:discover_module/ui_screen/interactionform/repository/hive_repository.dart';
|
||||
// import 'package:flutter/cupertino.dart';
|
||||
// import 'package:flutter/services.dart';
|
||||
// import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
// class ViewInteractionProvider extends ChangeNotifier {
|
||||
// List<FormFieldData> interactionReponseList = [];
|
||||
// // List<dynamic> sectionList = [];
|
||||
// List<SectionList> sectionList = [];
|
||||
// late Location locationList;
|
||||
// List<TextEditingController> textEditingControllerList = [];
|
||||
// List<TextEditingController> multipletextEditingControllerList = [];
|
||||
// int textfieldIndex = 0;
|
||||
// List<Country> countryList = [];
|
||||
// List<States> stateList = [];
|
||||
// List<City> cityList = [];
|
||||
// List<InputClass> checkboxlist = [];
|
||||
// String selectedCountry = 'Selected Country';
|
||||
// String radioValue = '';
|
||||
// bool checkboxValue = false;
|
||||
|
||||
// late SaveInteraction saveInteraction;
|
||||
// List<SaveData> saveData = [];
|
||||
|
||||
// List<SectionList> newList = [];
|
||||
// String sectionName = '';
|
||||
// late String selectedCity = 'Selected City', selectedState = 'Selected State';
|
||||
// String customdropdownValue = '';
|
||||
// String? selectedValue;
|
||||
// List<String> selectedItems = [];
|
||||
// InputClass? selectedObj;
|
||||
// List<SaveInteraction> savedList = [];
|
||||
// List<InteractionConfigData> intConfigDataList = [];
|
||||
// String? intId, intName;
|
||||
// final HiveDataRepository _hiveprovider = HiveDataRepository(
|
||||
// Hive.box<InteractionConfigData>('InteractionConfigDataBox'));
|
||||
|
||||
// late final InteractionProvider interactionProvider;
|
||||
// initConfigData() async {
|
||||
// intConfigDataList = _hiveprovider.getAllDataFromHive();
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// Future<void> getRecords(String formname) async {
|
||||
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
|
||||
// savedList = box.values.toList();
|
||||
// savedList = savedList
|
||||
// .where(
|
||||
// (element) => element.form == formname,
|
||||
// )
|
||||
// .toList();
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// Future<List<SaveInteraction>> getAllRecords() async {
|
||||
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
|
||||
// List<SaveInteraction> savedList = box.values.toList();
|
||||
|
||||
// return savedList;
|
||||
// }
|
||||
|
||||
// init(int index) async {
|
||||
// // _hiveprovider = HiveDataRepository(
|
||||
// // Hive.box<InteractionConfigData>('InteractionConfigDataBox'));
|
||||
// // intConfigDataList = _hiveprovider.getAllDataFromHive();
|
||||
// InteractionConfigData interactionConfigData = intConfigDataList[index];
|
||||
// intId = intConfigDataList[index].id;
|
||||
// intName = intConfigDataList[index].name;
|
||||
|
||||
// print("data $intConfigDataList");
|
||||
// // await fetchSaveDataJson();
|
||||
// // await fetchDataSet();
|
||||
// await fetchData(interactionConfigData.widgets);
|
||||
// await fetchLocationData();
|
||||
// }
|
||||
|
||||
// initSavedForm(SaveInteraction saveInteractiondata) {
|
||||
// intConfigDataList
|
||||
// .indexWhere((element) => element.id == saveInteractiondata.intId);
|
||||
|
||||
// interactionReponseList = saveInteractiondata.save
|
||||
// .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,
|
||||
// selectedObject: mobj.selectedObject,
|
||||
// name: mobj.name,
|
||||
// param: mobj.param,
|
||||
// selectedValue: mobj.selectedValue,
|
||||
// widget: mobj.widget,
|
||||
// controller: mobj.controller,
|
||||
// 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,
|
||||
// isRequired: obj.isRequired,
|
||||
// extension: obj.extension,
|
||||
// fileName: obj.fileName,
|
||||
// name: obj.name,
|
||||
// param: obj.param,
|
||||
// selectedObject: obj.selectedObject,
|
||||
// selectedValue: 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();
|
||||
|
||||
// textEditingControllerList.clear();
|
||||
|
||||
// for (var item in interactionReponseList) {
|
||||
// sectionList = item.sectionList;
|
||||
|
||||
// for (SectionList obj in item.multipleList!) {
|
||||
// obj.gid = obj.gid ?? item.multipleList!.length;
|
||||
// if (obj.widget == InteractionWidget.TEXT) {
|
||||
// var textEditingController = TextEditingController();
|
||||
// textEditingController.value = TextEditingValue(
|
||||
// text: obj.selectedValue!.isNotEmpty
|
||||
// ? obj.selectedValue!.last ?? ""
|
||||
// : "");
|
||||
// textEditingController.text = obj.selectedValue!.isNotEmpty
|
||||
// ? obj.selectedValue!.last ?? ""
|
||||
// : "";
|
||||
// multipletextEditingControllerList.add(textEditingController);
|
||||
// // obj.controller = multipletextEditingControllerList.last;
|
||||
// obj.controller = textEditingController;
|
||||
|
||||
// }
|
||||
// if (obj.widget == InteractionWidget.DROPDOWN ||
|
||||
// obj.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// obj.widget == InteractionWidget.MULTISELECT) {
|
||||
// List<InputClass> list = obj.inputList!;
|
||||
// if (obj.selectedObject != null) {
|
||||
// } else {
|
||||
// obj.selectedObject = obj.selectedValue!.isNotEmpty
|
||||
// ? getDataObject(obj.id, obj.selectedValue!.last, list)
|
||||
// : list[0];
|
||||
// }
|
||||
|
||||
// print("value : ${list.first.name} ");
|
||||
// }
|
||||
// if (obj.widget == InteractionWidget.CHECKBOX) {
|
||||
// List<String> selectedvalues = [];
|
||||
// if (obj.selectedValue!.isNotEmpty) {
|
||||
// for (var id in obj.selectedValue!) {
|
||||
// int ind =
|
||||
// obj.inputList!.indexWhere((element) => element.id == id);
|
||||
// if (ind != -1) {
|
||||
// obj.inputList![ind].ischecked = true;
|
||||
// selectedvalues.add(obj.inputList![ind].name);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (obj.widget == InteractionWidget.RADIO) {
|
||||
// List<InputClass> list = obj.inputList!;
|
||||
|
||||
// if (obj.selectedValue!.isNotEmpty) {
|
||||
// int ind = list
|
||||
// .indexWhere((element) => element.id == obj.selectedValue!.last);
|
||||
// if (ind != -1) {
|
||||
// obj.inputList![ind].ischecked = true;
|
||||
// radioValue = obj.inputList![ind].name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // newList.add(obj);
|
||||
// }
|
||||
// for (var sectionItem in item.sectionList) {
|
||||
// if (sectionItem.widget == InteractionWidget.TEXT) {
|
||||
// var textEditingController = TextEditingController();
|
||||
// textEditingController.text = sectionItem.selectedValue!.isNotEmpty
|
||||
// ? sectionItem.selectedValue!.last ?? " "
|
||||
// : " ";
|
||||
// textEditingControllerList.add(textEditingController);
|
||||
|
||||
// sectionItem.controller = textEditingControllerList.last;
|
||||
// }
|
||||
// if (sectionItem.widget == InteractionWidget.DROPDOWN) {
|
||||
// List<InputClass> list = sectionItem.inputList!;
|
||||
// if (sectionItem.selectedObject != null) {
|
||||
// print("#######not null");
|
||||
// } else {
|
||||
// print("#######is_null");
|
||||
// if (sectionItem.selectedValue == null) {
|
||||
// print("#######is_null#####");
|
||||
// } else {
|
||||
// print('###${sectionItem.selectedValue}');
|
||||
// }
|
||||
// sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty
|
||||
// ? getDataObject(
|
||||
// sectionItem.id, sectionItem.selectedValue!.last, list)
|
||||
// : list[0];
|
||||
// }
|
||||
|
||||
// print("valuesssss : ${sectionItem.selectedObject!.name} ");
|
||||
// }
|
||||
|
||||
// if (sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT) {
|
||||
// List<InputClass> list = sectionItem.inputList!;
|
||||
// if (sectionItem.selectedObject != null) {
|
||||
// } else {
|
||||
// sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty
|
||||
// ? getDataObject(
|
||||
// sectionItem.id, sectionItem.selectedValue!.last, list)
|
||||
// : list[0];
|
||||
// }
|
||||
|
||||
// print("value : ${list.first.name} ");
|
||||
// }
|
||||
// if (sectionItem.widget == InteractionWidget.CHECKBOX) {
|
||||
// List<String> selectedvalues = [];
|
||||
// if (sectionItem.selectedValue!.isNotEmpty) {
|
||||
// for (var id in sectionItem.selectedValue!) {
|
||||
// int ind = sectionItem.inputList!
|
||||
// .indexWhere((element) => element.id == id);
|
||||
// if (ind != -1) {
|
||||
// sectionItem.inputList![ind].ischecked = true;
|
||||
// selectedvalues.add(sectionItem.inputList![ind].name);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (sectionItem.widget == InteractionWidget.RADIO) {
|
||||
// List<InputClass> list = sectionItem.inputList!;
|
||||
|
||||
// if (sectionItem.selectedValue!.isNotEmpty) {
|
||||
// int ind = list.indexWhere(
|
||||
// (element) => element.id == sectionItem.selectedValue!.last);
|
||||
// if (ind != -1) {
|
||||
// sectionItem.inputList![ind].ischecked = true;
|
||||
// radioValue = sectionItem.inputList![ind].name;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (sectionItem.widget == InteractionWidget.BUTTON &&
|
||||
// sectionItem.param == 'chooseFile' &&
|
||||
// sectionItem.selectedValue!.isNotEmpty) {
|
||||
// print("choosed file");
|
||||
// print(sectionItem.selectedValue!.last);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// print(interactionReponseList);
|
||||
// print("check textcontrollers ${textEditingControllerList.length}");
|
||||
// }
|
||||
|
||||
// Future<String> fetchDataSet() async {
|
||||
// List<InputClass> list = getData("intlocation_1");
|
||||
// print(list);
|
||||
// return "success";
|
||||
// }
|
||||
|
||||
// List<InputClass> getData(String widgetId) {
|
||||
// List<InputClass> list = [];
|
||||
|
||||
// return list;
|
||||
// }
|
||||
|
||||
// InputClass getDataObject(String widgetId, String id, List<InputClass> list) {
|
||||
// // if (id != "") {
|
||||
// // List<InputClass> list = [];
|
||||
// InputClass value = InputClass(id: '', name: '');
|
||||
|
||||
// if (list.isNotEmpty) {
|
||||
// int index = list.indexWhere((element) => element.id.toString() == id);
|
||||
|
||||
// if (index != -1) {
|
||||
// value = list[index];
|
||||
// }
|
||||
// }
|
||||
|
||||
// return value;
|
||||
// }
|
||||
|
||||
// // TODO: Search for widget with depid and check if selected is not null and by selected id get the data of current widget
|
||||
// List<InputClass> getData2(SectionList sectionItem) {
|
||||
// List<InputClass> list = [];
|
||||
// // if (sectionItem.inputList != null) {
|
||||
// list = sectionItem.inputList!;
|
||||
// if (sectionItem.depid != "") {
|
||||
// // print("check depid : ${sectionItem.depid}");
|
||||
// int i = 0;
|
||||
// for (var obj in interactionReponseList) {
|
||||
// i = obj.sectionList
|
||||
// .indexWhere((element) => element.id == sectionItem.depid);
|
||||
// // print("check depid index: $i");
|
||||
// if (i != -1) {
|
||||
// //print("check depid value: ${obj.sectionList[i].value}");
|
||||
// if (obj.sectionList[i].value != null) {
|
||||
// if (list
|
||||
// .where((element) => element.pid == obj.sectionList[i].value)
|
||||
// .isNotEmpty) {
|
||||
// list = list
|
||||
// .where((element) => element.pid == obj.sectionList[i].value)
|
||||
// .toList();
|
||||
|
||||
// sectionItem.selectedObject = list[0];
|
||||
// } else {
|
||||
// // InputClass obj = InputClass(
|
||||
// // id: "obj.sectionList[i].value",
|
||||
// // name: "Select ${sectionItem.name}");
|
||||
// list = [];
|
||||
// // list.add(obj);
|
||||
// sectionItem.selectedObject = null;
|
||||
// }
|
||||
// } else {
|
||||
// // int index = obj.sectionList
|
||||
// // .indexWhere((element) => element.id == sectionItem.id);
|
||||
|
||||
// // list = obj.sectionList[index].inputList;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // int index = data[i].data.indexWhere((element) => element.)
|
||||
// }
|
||||
// // }
|
||||
|
||||
// print("I_am_Returning_list: $list");
|
||||
// return list;
|
||||
// }
|
||||
|
||||
// setDropDownValue(String value, SectionList sectionItem, bool multiple,
|
||||
// InputClass selectedObject) {
|
||||
// int i = 0;
|
||||
// for (var obj in interactionReponseList) {
|
||||
// if (multiple && obj.multipleList != null) {
|
||||
// i = obj.multipleList!.indexWhere((element) =>
|
||||
// element.id == sectionItem.id && element.gid == sectionItem.gid);
|
||||
// if (i != -1) {
|
||||
// obj.multipleList![i].value = value;
|
||||
// obj.multipleList![i].tempselectedValue = [];
|
||||
// obj.multipleList![i].tempselectedValue!.add(value);
|
||||
// // obj.multipleList![i].selectedObject = selectedObj;
|
||||
// }
|
||||
// } else {
|
||||
// i = obj.sectionList
|
||||
// .indexWhere((element) => element.id == sectionItem.id);
|
||||
// if (i != -1) {
|
||||
// obj.sectionList[i].value = value;
|
||||
// obj.sectionList[i].tempselectedValue = [];
|
||||
// obj.sectionList[i].tempselectedValue!.add(value);
|
||||
// // obj.sectionList[i].selectedObject = selectedObj;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// Future<void> disposeValues() async {
|
||||
// print("dispose called");
|
||||
// // await _hiveprovider.closeHiveBox();
|
||||
// for (var obj in interactionReponseList) {
|
||||
// obj.multipleList!.clear();
|
||||
// // for (var obj2 in obj.sectionList) {
|
||||
// // obj2.selectedObject = null;
|
||||
// // }
|
||||
|
||||
// obj.sectionList.clear();
|
||||
// }
|
||||
// interactionReponseList.clear();
|
||||
// }
|
||||
|
||||
// setTextValue(String value, SectionList sectionItem, bool multiple) {
|
||||
// int i = 0;
|
||||
// for (var obj in interactionReponseList) {
|
||||
// if (multiple && obj.multipleList != null) {
|
||||
// i = obj.multipleList!.indexWhere((element) =>
|
||||
// element.id == sectionItem.id && element.gid == sectionItem.gid);
|
||||
// if (i != -1) {
|
||||
// obj.multipleList![i].value = value;
|
||||
// obj.multipleList![i].selectedValue!.add(value);
|
||||
// }
|
||||
// } else {
|
||||
// i = obj.sectionList
|
||||
// .indexWhere((element) => element.id == sectionItem.id);
|
||||
// if (i != -1) {
|
||||
// obj.sectionList[i].value = value;
|
||||
// obj.sectionList[i].selectedValue!.add(value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// setAutoCompleteValue(String value, SectionList sectionItem, bool multiple) {
|
||||
// int i = 0;
|
||||
// for (var obj in interactionReponseList) {
|
||||
// if (multiple && obj.multipleList != null) {
|
||||
// i = obj.multipleList!.indexWhere((element) =>
|
||||
// element.id == sectionItem.id && element.gid == sectionItem.gid);
|
||||
// if (i != -1) {
|
||||
// obj.multipleList![i].value = value;
|
||||
// obj.multipleList![i].tempselectedValue = [];
|
||||
// obj.multipleList![i].tempselectedValue!.add(value);
|
||||
// }
|
||||
// } else {
|
||||
// i = obj.sectionList
|
||||
// .indexWhere((element) => element.id == sectionItem.id);
|
||||
// if (i != -1) {
|
||||
// obj.sectionList[i].value = value;
|
||||
// obj.sectionList[i].tempselectedValue = [];
|
||||
// obj.sectionList[i].tempselectedValue!.add(value);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// notifyListeners();
|
||||
// }
|
||||
// String getDropDownValue(
|
||||
// String value, SectionList sectionItem, List<InputClass> list) {
|
||||
// int i = 0;
|
||||
// String svalue = '';
|
||||
|
||||
// i = list.indexWhere((element) => element.id == value);
|
||||
// if (i != -1) {
|
||||
// svalue = list[i].name;
|
||||
// } else {
|
||||
// svalue = list[0].name;
|
||||
// }
|
||||
|
||||
// return svalue;
|
||||
// }
|
||||
|
||||
// Future<String> fetchData(InteractionResultData interactionResultData) async {
|
||||
// InteractionResultData interactionConfig = interactionResultData;
|
||||
|
||||
// print("itemCategoryModel Item = + ${interactionConfig.result}");
|
||||
|
||||
// interactionReponseList = interactionConfig.result;
|
||||
// print("check stored: $interactionReponseList");
|
||||
// textEditingControllerList.clear();
|
||||
|
||||
// for (var item in interactionReponseList) {
|
||||
// sectionList = item.sectionList;
|
||||
// for (var sectionItem in item.sectionList) {
|
||||
// if (sectionItem.widget == InteractionWidget.TEXT) {
|
||||
// var textEditingController = TextEditingController();
|
||||
|
||||
// textEditingControllerList.add(textEditingController);
|
||||
// sectionItem.controller = textEditingControllerList.last;
|
||||
// }
|
||||
// if (sectionItem.widget == InteractionWidget.DROPDOWN ||
|
||||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
|
||||
// sectionItem.widget == InteractionWidget.MULTISELECT) {
|
||||
// List<InputClass> list = sectionItem.inputList!;
|
||||
// sectionItem.value = list[0].name;
|
||||
// print("value : ${list.first} ");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// print(interactionReponseList);
|
||||
// print("check textcontrollers ${textEditingControllerList.length}");
|
||||
|
||||
// return "success";
|
||||
// }
|
||||
|
||||
// Future<String> fetchLocationData() async {
|
||||
// var data =
|
||||
// await rootBundle.loadString("assets/images/locationdetailsform.json");
|
||||
|
||||
// Locations loc =
|
||||
// Locations(location: Location.fromJson(json.decode(data)["location"]));
|
||||
// locationList = loc.location;
|
||||
// countryList = locationList.country;
|
||||
// stateList = locationList.state;
|
||||
// cityList = locationList.city;
|
||||
|
||||
// print(locationList);
|
||||
// notifyListeners();
|
||||
// return "success";
|
||||
// }
|
||||
|
||||
// List<States> getState(String cid) {
|
||||
// List<States> states =
|
||||
// stateList.where((element) => element.countryId == cid).toList();
|
||||
|
||||
// return states;
|
||||
// }
|
||||
|
||||
// List<City> getCity(String sid) {
|
||||
// List<City> city =
|
||||
// cityList.where((element) => element.stateId == sid).toList();
|
||||
|
||||
// return city;
|
||||
// }
|
||||
|
||||
// String getCountryId(String name) {
|
||||
// if (countryList.isNotEmpty) {
|
||||
// int i = countryList.indexWhere((element) => element.countryName == name);
|
||||
// return countryList[i].countryId;
|
||||
// }
|
||||
// return '';
|
||||
// }
|
||||
|
||||
// String getStateId(String name) {
|
||||
// if (stateList.isNotEmpty) {
|
||||
// int i = stateList.indexWhere((element) => element.stateName == name);
|
||||
// return stateList[i].stateId;
|
||||
// }
|
||||
// return '';
|
||||
// }
|
||||
|
||||
// String getCityId(String name) {
|
||||
// if (cityList.isNotEmpty) {
|
||||
// int i = cityList.indexWhere((element) => element.cityName == name);
|
||||
// return cityList[i].distId;
|
||||
// }
|
||||
// return '';
|
||||
// }
|
||||
|
||||
// setRadioValue(SectionList sectionItem) {
|
||||
// List<InputClass> list = (sectionItem.input as List)
|
||||
// .map((itemWord) => InputClass.fromJson(itemWord))
|
||||
// .toList();
|
||||
// radioValue = list[0].name;
|
||||
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// setcheckBoxValue(SectionList sectionItem, String sectionName, bool newValue,
|
||||
// String id, bool multiple) {
|
||||
// int index =
|
||||
// sectionItem.inputList!.indexWhere((element) => element.id == id);
|
||||
// sectionItem.inputList![index].ischecked = newValue;
|
||||
// // sectionItem.selectedValue.add(data[i].data[index].id);
|
||||
// int index2 = 0;
|
||||
// for (var obj in interactionReponseList) {
|
||||
// if (multiple && obj.multipleList != null) {
|
||||
// index2 = obj.multipleList!.indexWhere((element) =>
|
||||
// element.id == sectionItem.id && element.gid == sectionItem.gid);
|
||||
// if (index2 != -1) {
|
||||
// obj.multipleList![index2].value = sectionItem.inputList![index].id;
|
||||
// obj.multipleList![index2].selectedValue!
|
||||
// .add(sectionItem.inputList![index].id);
|
||||
// }
|
||||
// } else {
|
||||
// index2 = obj.sectionList
|
||||
// .indexWhere((element) => element.id == sectionItem.id);
|
||||
// if (index2 != -1) {
|
||||
// obj.sectionList[index2].value = sectionItem.inputList![index].id;
|
||||
// obj.sectionList[index2].selectedValue!
|
||||
// .add(sectionItem.inputList![index].id);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// getSectionItem(String sectionName) {
|
||||
// newList = [];
|
||||
// List<SectionList> addList = [];
|
||||
// int index = interactionReponseList
|
||||
// .indexWhere((element) => element.sectionName == sectionName);
|
||||
|
||||
// addList = interactionReponseList[index]
|
||||
// .sectionList
|
||||
// .map((e) => SectionList(
|
||||
// depid: e.depid,
|
||||
// id: e.id,
|
||||
// inputList: e.inputList,
|
||||
// isRequired: e.isRequired,
|
||||
// name: e.name,
|
||||
// param: e.param,
|
||||
// selectedValue: [],
|
||||
// widget: e.widget,
|
||||
// controller: e.controller,
|
||||
// gid: e.gid,
|
||||
// input: e.input,
|
||||
// selectedId: e.selectedId,
|
||||
// value: e.value))
|
||||
// .toList();
|
||||
// SectionList delItem = SectionList(
|
||||
// name: "delete",
|
||||
// param: "deletebtn",
|
||||
// id: "deletebtn",
|
||||
// selectedValue: [],
|
||||
// depid: "",
|
||||
// widget: InteractionWidget.BUTTON,
|
||||
// inputList: [],
|
||||
// isRequired: true);
|
||||
|
||||
// addList.add(delItem);
|
||||
|
||||
// // if (interactionReponseList[index].multipleList!.isEmpty) {
|
||||
// // newList = addList;
|
||||
// // } else {
|
||||
// if (interactionReponseList[index].multipleList == null) {
|
||||
// interactionReponseList[index].multipleList = addList;
|
||||
// } else {
|
||||
// interactionReponseList[index].multipleList =
|
||||
// interactionReponseList[index].multipleList! + addList;
|
||||
// }
|
||||
|
||||
// newList = interactionReponseList[index].multipleList!;
|
||||
// // newList = newList + addList;
|
||||
// // }
|
||||
// if (interactionReponseList[index].multipleList != null) {
|
||||
// for (SectionList obj in interactionReponseList[index].multipleList!) {
|
||||
// obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
|
||||
// if (obj.widget == InteractionWidget.TEXT) {
|
||||
// var textEditingController = TextEditingController();
|
||||
|
||||
// multipletextEditingControllerList.add(textEditingController);
|
||||
// obj.controller = multipletextEditingControllerList.last;
|
||||
// obj.controller!.text =
|
||||
// obj.selectedValue != null && obj.selectedValue!.isNotEmpty
|
||||
// ? obj.selectedValue!.last
|
||||
// : '';
|
||||
// }
|
||||
// // newList.add(obj);
|
||||
// }
|
||||
// }
|
||||
|
||||
// print(
|
||||
// "check length : ${interactionReponseList[index].multipleList!.length}");
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// deleteMultipleRows(
|
||||
// int gid, SectionList sectionItem, String selectedSectionName) {
|
||||
// int index = interactionReponseList
|
||||
// .indexWhere((element) => element.sectionName == selectedSectionName);
|
||||
// interactionReponseList[index]
|
||||
// .multipleList!
|
||||
// .removeWhere((item) => item.gid == gid);
|
||||
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
// saveJsonObject(BuildContext context, String form,
|
||||
// SaveInteraction saveInteraction) async {
|
||||
// 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);
|
||||
// }
|
||||
|
||||
// Future<void> deleteRecord(SaveInteraction saveInteraction) async {
|
||||
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
|
||||
// final Map<dynamic, SaveInteraction> deliveriesmap = box.toMap();
|
||||
// dynamic deleteKey;
|
||||
// deliveriesmap.forEach((key, value) {
|
||||
// if (value.id == saveInteraction.id) {
|
||||
// deleteKey = key;
|
||||
// }
|
||||
// });
|
||||
// box.delete(deleteKey);
|
||||
// await getRecords(saveInteraction.form!);
|
||||
// //box.close();
|
||||
// }
|
||||
|
||||
// List<MultipleSectionList> getModifiedList(List<SectionList> sectionList) {
|
||||
// List<MultipleSectionList> newSectionList = [];
|
||||
// for (var obj in sectionList) {
|
||||
// if (obj.id != 'deletebtn') {
|
||||
// if (obj.id == 'chooseFile') {
|
||||
// List<MultipartFile> files = [];
|
||||
// if (obj.selectedValue!.isNotEmpty && obj.selectedValue != null) {
|
||||
// for (var file in obj.selectedValue!) {
|
||||
// files.add(MultipartFile.fromFileSync(file));
|
||||
// }
|
||||
// }
|
||||
// MultipleSectionList newobj = MultipleSectionList(
|
||||
// id: obj.id,
|
||||
// selectedValue: files,
|
||||
// );
|
||||
|
||||
// newSectionList.add(newobj);
|
||||
// } else {
|
||||
// MultipleSectionList newobj = MultipleSectionList(
|
||||
// id: obj.id,
|
||||
// selectedValue: obj.selectedValue!,
|
||||
// );
|
||||
// newSectionList.add(newobj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return newSectionList;
|
||||
// }
|
||||
|
||||
// bool validateMultipleRows() {
|
||||
// for (var obj in interactionReponseList) {
|
||||
// if (obj.multipleList != null) {
|
||||
// for (var mulobj in obj.multipleList!) {
|
||||
// if (mulobj.widget == InteractionWidget.TEXT) {
|
||||
// if (mulobj.controller!.text.isEmpty) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
// bool validateTextFields() {
|
||||
// for (var obj in interactionReponseList) {
|
||||
// for (var mulobj in obj.sectionList) {
|
||||
// if (mulobj.widget == InteractionWidget.TEXT) {
|
||||
// if (mulobj.controller!.text.isEmpty) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -42,6 +42,9 @@ class InteractionTextField extends StatelessWidget {
|
|||
onChanged: (value) {
|
||||
onChanged(value);
|
||||
},
|
||||
onSubmitted: (value) {
|
||||
onChanged(value);
|
||||
},
|
||||
inputFormatters: [
|
||||
inputType == TextInputType.number
|
||||
? FilteringTextInputFormatter.digitsOnly
|
||||
|
|
|
@ -8,7 +8,8 @@ class DataTableDemo extends StatefulWidget {
|
|||
|
||||
class _DataTableDemoState extends State<DataTableDemo> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(3),
|
||||
children: [
|
||||
|
@ -85,6 +86,7 @@ class _DataTableDemoState extends State<DataTableDemo> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ class FormList extends StatefulWidget {
|
|||
class _FormListState extends State<FormList> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Form List"),
|
||||
),
|
||||
|
@ -97,6 +98,7 @@ class _FormListState extends State<FormList> {
|
|||
Divider(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ class Profile extends StatefulWidget {
|
|||
class _ProfileState extends State<Profile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Profile'),
|
||||
actions: const [
|
||||
|
@ -193,7 +194,8 @@ class _ProfileState extends State<Profile> {
|
|||
padding: EdgeInsets.only(bottom: 18.0),
|
||||
child: Card(
|
||||
surfaceTintColor: Colors.white,
|
||||
margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0),
|
||||
margin:
|
||||
EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
color: Colors.white,
|
||||
elevation: 5.0,
|
||||
|
@ -359,6 +361,7 @@ class _ProfileState extends State<Profile> {
|
|||
child: new Icon(Icons.add),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:js_interop';
|
||||
|
||||
import 'package:discover_module/custom_widget/floating_btn.dart';
|
||||
import 'package:discover_module/custom_widget/show_alert.dart';
|
||||
|
@ -19,8 +20,9 @@ class Ranking extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _RankingState extends State<Ranking> {
|
||||
late _DataSource _dataSource; // Instance variable for _DataSource
|
||||
late _DataSource _dataSource;
|
||||
|
||||
List<int> selectedno = [];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
@ -28,10 +30,10 @@ class _RankingState extends State<Ranking> {
|
|||
_dataSource = _DataSource(context); // Initialize _DataSource
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(3),
|
||||
children: [
|
||||
|
@ -138,18 +140,24 @@ class _RankingState extends State<Ranking> {
|
|||
child: FloatingBtn(
|
||||
icon: Icons.add,
|
||||
title: "add",
|
||||
onTap: () {
|
||||
List<String> selectedRowIds = _dataSource.getSelectedRowIds();
|
||||
onTap: () async {
|
||||
List<int> selectedRowIds = _dataSource.getSelectedRowIds();
|
||||
// Do something with selectedRowIds
|
||||
print('Selected Row IDstrndsss: $selectedRowIds');
|
||||
|
||||
for (int i = 0; i < selectedRowIds.length; i++) {
|
||||
print('The id id : ${selectedRowIds[i]}');
|
||||
|
||||
print("checking_value_istrends: ${selectedRowIds[i]}");
|
||||
|
||||
// selectedno.add(selectedRowIds[i]);
|
||||
|
||||
HiveFunctions.addno(selectedRowIds[i]);
|
||||
|
||||
// _contactbox.put(i, selectedRowIds[i]);
|
||||
|
||||
HiveFunctions.createUser({
|
||||
"name": selectedRowIds[i],
|
||||
"name": "Gerosa,Gino",
|
||||
"org": "Azienda Ospedaliera di Padova",
|
||||
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
|
||||
"phone": "+390498212410X12",
|
||||
|
@ -168,6 +176,7 @@ class _RankingState extends State<Ranking> {
|
|||
});
|
||||
},
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -291,6 +300,7 @@ class HiveFunctions {
|
|||
// String userHiveBox="User Box";
|
||||
// Box which will use to store the things
|
||||
static final _contactbox = Hive.box("mycontact");
|
||||
static var box1 = Hive.box('checkvalue');
|
||||
|
||||
static createUser(Map data) {
|
||||
_contactbox.add(data);
|
||||
|
@ -337,11 +347,35 @@ class HiveFunctions {
|
|||
|
||||
return data.reversed.toList();
|
||||
}
|
||||
|
||||
static addno(int selectedRowId) {
|
||||
// final box1 = Hive.box("mycontact");
|
||||
|
||||
print("SelectedStoredvaluessss: $selectedRowId");
|
||||
|
||||
box1.add(selectedRowId);
|
||||
}
|
||||
|
||||
static getno() {
|
||||
// final box1 = Hive.box("mycontact");
|
||||
|
||||
return box1.values;
|
||||
}
|
||||
}
|
||||
|
||||
class _Row {
|
||||
_Row(this.identifier, this.valueA, this.valueC, this.valueD, this.valueE,
|
||||
this.valueF, this.valueG, this.valueH, this.valueI);
|
||||
_Row(
|
||||
this.identifier,
|
||||
this.valueA,
|
||||
this.valueC,
|
||||
this.valueD,
|
||||
this.valueE,
|
||||
this.valueF,
|
||||
this.valueG,
|
||||
this.valueH,
|
||||
this.valueI,
|
||||
this.selected, // Add selected parameter
|
||||
);
|
||||
|
||||
final int identifier;
|
||||
final String valueA;
|
||||
|
@ -360,17 +394,18 @@ class _DataSource extends DataTableSource {
|
|||
final BuildContext context;
|
||||
late List<_Row> _rows;
|
||||
// late List<int> _selectedRowsIndexes = []; // List to track selected rows
|
||||
final List<String> _selectedRowIds = [];
|
||||
final List<int> _selectedRowIds = [];
|
||||
|
||||
_DataSource(this.context) {
|
||||
_rows = <_Row>[
|
||||
for (int i = 0; i < 20; i++)
|
||||
_Row(i, 'Gerosa, Gino', 'Tier1', '1', '0', '0', '0', '0', '0'),
|
||||
_Row(
|
||||
i, 'Gerosa, Gino', 'Tier1', '1', '0', '0', '0', '0', '0', check(i)),
|
||||
];
|
||||
//}
|
||||
}
|
||||
|
||||
List<String> getSelectedRowIds() {
|
||||
List<int> getSelectedRowIds() {
|
||||
return _selectedRowIds; // Return a copy to prevent direct modification
|
||||
}
|
||||
|
||||
|
@ -392,11 +427,11 @@ class _DataSource extends DataTableSource {
|
|||
|
||||
if (value) {
|
||||
print("Selected");
|
||||
_selectedRowIds.add(row.valueA); // Add the row ID to the list
|
||||
_selectedRowIds.add(row.identifier); // Add the row ID to the list
|
||||
print("Selected_selectedRowIds :$_selectedRowIds");
|
||||
} else {
|
||||
_selectedRowIds
|
||||
.remove(row.valueA); // Remove the row ID from the list
|
||||
.remove(row.identifier); // Remove the row ID from the list
|
||||
}
|
||||
notifyListeners();
|
||||
|
||||
|
@ -433,4 +468,17 @@ class _DataSource extends DataTableSource {
|
|||
|
||||
@override
|
||||
int get selectedRowCount => _selectedCount;
|
||||
|
||||
bool check(int i) {
|
||||
// print("I_am_i: $i");
|
||||
print("_selectedRowIds_i: ${HiveFunctions.getno()}");
|
||||
|
||||
//HiveFunctions.getno();
|
||||
if (HiveFunctions.getno().contains(i)) {
|
||||
print("Iam_in: $i");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ class RisingStarState extends State<RisingStar> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(3),
|
||||
children: [
|
||||
|
@ -131,6 +132,7 @@ class RisingStarState extends State<RisingStar> {
|
|||
});
|
||||
},
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@ class _TrendsState extends State<Trends> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(3),
|
||||
children: [
|
||||
|
@ -104,6 +105,7 @@ class _TrendsState extends State<Trends> {
|
|||
});
|
||||
},
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue