Compare commits

..

No commits in common. "0eef014073bfff70227dc7f264f1a6da3c972360" and "6415617f17fcc029102fe34c6b2e48cb66449e66" have entirely different histories.

6 changed files with 200 additions and 293 deletions

View File

@ -290,24 +290,16 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
sectionItem.input == sectionItem.input ==
'add' 'add'
? const SizedBox.shrink() ? const SizedBox.shrink()
: Padding( : Text(
padding:
const EdgeInsets
.only(
left: 8.0,
right: 8.0),
child: Text(
'${sectionItem.name}:*', '${sectionItem.name}:*',
style: TextStyle( style: TextStyle(
color: Colors color: Colors.orange
.orange
.shade800, .shade800,
fontSize: isTablet fontSize: isTablet
? 18 ? 18
: 12, : 12,
), ),
), ),
),
SizedBox( SizedBox(
height: isTablet ? 15 : 5, height: isTablet ? 15 : 5,
), ),
@ -473,7 +465,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
}, },
), ),
) )
: Padding( : Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: SizedBox( child: SizedBox(
// width: isTablet ? 200 : MediaQuery.of(context).size.width, // width: isTablet ? 200 : MediaQuery.of(context).size.width,
@ -493,6 +486,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
}, },
), ),
), ),
),
); );
case InteractionWidget.DROPDOWN: case InteractionWidget.DROPDOWN:
return customdropdown(sectionItem, provider, list, multiple); return customdropdown(sectionItem, provider, list, multiple);
@ -653,7 +647,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
Widget customdropdown(SectionList sectionItem, Widget customdropdown(SectionList sectionItem,
ViewInteractionProvider provider, List<InputClass> list, bool multiple) { ViewInteractionProvider provider, List<InputClass> list, bool multiple) {
// sectionItem.value = ''; // sectionItem.value = '';
// print("%%%%${sectionItem.selectedValue!.last}"); print("%%%%${sectionItem.selectedValue!.last}");
if (list.isEmpty) { if (list.isEmpty) {
print("###list empty###"); print("###list empty###");
list = []; list = [];
@ -1032,7 +1026,7 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
? provider.getData2(sectionItem) ? provider.getData2(sectionItem)
: []; : [];
return Wrap(runAlignment: WrapAlignment.spaceEvenly, children: [ return Wrap(children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View File

@ -282,13 +282,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
sectionItem.input == sectionItem.input ==
'add' 'add'
? const SizedBox.shrink() ? const SizedBox.shrink()
: Padding( : FittedBox(
padding:
const EdgeInsets
.only(
left: 8.0,
right: 8.0),
child: FittedBox(
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
child: Text( child: Text(
sectionItem sectionItem
@ -297,8 +291,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
? '${sectionItem.name}:*' ? '${sectionItem.name}:*'
: '${sectionItem.name}:', : '${sectionItem.name}:',
style: TextStyle( style: TextStyle(
color: Colors color: Colors.orange
.orange
.shade800, .shade800,
fontSize: 18.0, fontSize: 18.0,
// fontSize: isTablet // fontSize: isTablet
@ -307,7 +300,6 @@ class _InteractionScreenState extends State<InteractionScreen> {
), ),
), ),
), ),
),
// SizedBox( // SizedBox(
// height: isTablet ? 15 : 5, // height: isTablet ? 15 : 5,
// ), // ),
@ -509,7 +501,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
controller: sectionItem.controller!, controller: sectionItem.controller!,
labelText: sectionItem.name, labelText: sectionItem.name,
onChanged: (val) { onChanged: (val) {
sectionItem.selectedValue!.clear(); sectionItem.selectedValue = [];
provider.setTextValue(val, sectionItem, multiple); provider.setTextValue(val, sectionItem, multiple);
}, },
), ),
@ -1059,29 +1051,16 @@ class _InteractionScreenState extends State<InteractionScreen> {
Orientation orientation, Orientation orientation,
FormFieldData item, FormFieldData item,
int listIndex) { int listIndex) {
List<String> items = [];
for (var obj in sectionList) {
items.add(obj.name);
}
Map<String, int> count = {};
for (var i in items) {
count[i] = (count[i] ?? 0) + 1;
}
print(count['delete']);
return Padding( return Padding(
padding: isTablet padding: isTablet
? const EdgeInsets.only(left: 8.0) ? const EdgeInsets.only(left: 8.0)
: const EdgeInsets.only(left: 12.0, right: 12.0), : const EdgeInsets.only(left: 12.0, right: 12.0),
child: Card(
child: GridView.count( child: GridView.count(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
crossAxisCount: context.responsive<int>( crossAxisCount: context.responsive<int>(
1, // default 1, // default
sm: 1, // small sm: 1, // small
md: 2, // medium md: 1, // medium
lg: sectionList.length == 1 ? 1 : 4, // large lg: sectionList.length == 1 ? 1 : 4, // large
xl: 5, // extra large screen xl: 5, // extra large screen
), ),
@ -1092,7 +1071,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
? orientation == Orientation.landscape ? orientation == Orientation.landscape
? 10 ? 10
: 4.2 : 4.2
: 3, : 1.8,
children: List.generate( children: List.generate(
sectionList.length, sectionList.length,
(i) { (i) {
@ -1101,8 +1080,8 @@ class _InteractionScreenState extends State<InteractionScreen> {
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
? sectionItem.value ?? "Select" ? sectionItem.value ?? "Select"
: ' '; : ' ';
List<InputClass> list = sectionItem.widget == List<InputClass> list =
InteractionWidget.DROPDOWN || sectionItem.widget == InteractionWidget.DROPDOWN ||
sectionItem.widget == InteractionWidget.AUTOCOMPLETE || sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
sectionItem.widget == InteractionWidget.MULTISELECT sectionItem.widget == InteractionWidget.MULTISELECT
? provider.getData2(sectionItem) ? provider.getData2(sectionItem)
@ -1112,7 +1091,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
? provider.getData2(sectionItem) ? provider.getData2(sectionItem)
: []; : [];
return Wrap(runAlignment: WrapAlignment.spaceEvenly, children: [ return Wrap(children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -1160,19 +1139,15 @@ class _InteractionScreenState extends State<InteractionScreen> {
: "Files Uploaded" : "Files Uploaded"
: 'No file uploaded', : 'No file uploaded',
style: TextStyle( style: TextStyle(
color: sectionItem color:
.selectedValue!.isNotEmpty sectionItem.selectedValue!.isNotEmpty
? Colors.green ? Colors.green
: Colors.red), : Colors.red),
), ),
], ],
) )
: isTablet : isTablet
? Row( ? IconButton(
children: [
Expanded(
// width: MediaQuery.of(context).size.width,
child: IconButton(
onPressed: () { onPressed: () {
provider.deleteMultipleRows( provider.deleteMultipleRows(
sectionItem.gid!, sectionItem.gid!,
@ -1184,16 +1159,12 @@ class _InteractionScreenState extends State<InteractionScreen> {
icon: const Icon( icon: const Icon(
Icons.cancel, Icons.cancel,
size: 30, size: 30,
color: color: Color.fromARGB(255, 8, 39, 92),
Color.fromARGB(255, 8, 39, 92),
), ),
),
),
],
) )
: Padding( : Padding(
padding: const EdgeInsets.only( padding:
left: 3.0, top: 5), const EdgeInsets.only(left: 3.0, top: 5),
child: CustomButton( child: CustomButton(
backgroundColor: const Color.fromARGB( backgroundColor: const Color.fromARGB(
255, 233, 75, 75), 255, 233, 75, 75),
@ -1232,7 +1203,6 @@ class _InteractionScreenState extends State<InteractionScreen> {
}, },
), ),
), ),
),
); );
} }

View File

@ -246,8 +246,8 @@ class InteractionProvider extends ChangeNotifier {
int i = 0; int i = 0;
for (var obj in interactionReponseList) { for (var obj in interactionReponseList) {
if (multiple && obj.multipleList != null) { if (multiple && obj.multipleList != null) {
i = obj.multipleList!.indexWhere((element) => i = obj.multipleList!
element.id == sectionItem.id && element.gid == sectionItem.gid); .indexWhere((element) => element.id == sectionItem.id);
if (i != -1) { if (i != -1) {
obj.multipleList![i].value = value; obj.multipleList![i].value = value;
obj.multipleList![i].selectedValue!.add(value); obj.multipleList![i].selectedValue!.add(value);
@ -420,7 +420,7 @@ class InteractionProvider extends ChangeNotifier {
List<SectionList> addList = []; List<SectionList> addList = [];
int index = interactionReponseList int index = interactionReponseList
.indexWhere((element) => element.sectionName == sectionName); .indexWhere((element) => element.sectionName == sectionName);
var textEditingController = TextEditingController();
addList = interactionReponseList[index] addList = interactionReponseList[index]
.sectionList .sectionList
.map((e) => SectionList( .map((e) => SectionList(
@ -450,17 +450,6 @@ class InteractionProvider extends ChangeNotifier {
addList.add(delItem); addList.add(delItem);
for (SectionList obj in addList) {
//obj.gid = obj.gid ?? addList.length;
if (obj.widget == InteractionWidget.TEXT) {
// multipletextEditingControllerList.clear();
var textEditingController = TextEditingController();
obj.controller = textEditingController;
multipletextEditingControllerList.add(textEditingController);
}
// newList.add(obj);
}
// if (interactionReponseList[index].multipleList!.isEmpty) { // if (interactionReponseList[index].multipleList!.isEmpty) {
// newList = addList; // newList = addList;
// } else { // } else {
@ -477,13 +466,13 @@ class InteractionProvider extends ChangeNotifier {
if (interactionReponseList[index].multipleList != null) { if (interactionReponseList[index].multipleList != null) {
for (SectionList obj in interactionReponseList[index].multipleList!) { for (SectionList obj in interactionReponseList[index].multipleList!) {
obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length; obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
// if (obj.widget == InteractionWidget.TEXT) { if (obj.widget == InteractionWidget.TEXT) {
// var textEditingController = TextEditingController(); var textEditingController = TextEditingController();
// multipletextEditingControllerList.add(textEditingController); multipletextEditingControllerList.add(textEditingController);
// obj.controller = multipletextEditingControllerList.last; obj.controller = multipletextEditingControllerList.last;
// } }
//newList.add(obj); // newList.add(obj);
} }
} }
@ -536,12 +525,6 @@ class InteractionProvider extends ChangeNotifier {
Future<String> saveJsonObject(BuildContext context, String form, Future<String> saveJsonObject(BuildContext context, String form,
{bool isEdit = false}) async { {bool isEdit = false}) async {
print("form_data: $form"); print("form_data: $form");
// for (var ob in interactionReponseList) {
// for (var ob2 in ob.multipleList!) {
// debugPrint("!!!!!!!!!!!!In multiple :${ob2.selectedValue}");
// }
// }
List<FormFieldData> resultData = interactionReponseList List<FormFieldData> resultData = interactionReponseList
.map((e) => FormFieldData( .map((e) => FormFieldData(
multipleList: e.multipleList == null multipleList: e.multipleList == null

View File

@ -286,10 +286,8 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
sectionItem.id, sectionItem.selectedValue!.last)); sectionItem.id, sectionItem.selectedValue!.last));
case InteractionWidget.AUTOCOMPLETE: case InteractionWidget.AUTOCOMPLETE:
return Text(sectionItem.selectedValue!.isNotEmpty return Text(provider.getDataValue(
? provider.getDataValue( sectionItem.id, sectionItem.selectedValue!.last));
sectionItem.id, sectionItem.selectedValue!.last)
: " ");
case InteractionWidget.MULTISELECT: case InteractionWidget.MULTISELECT:
return Text(sectionItem.selectedValue.toString()); return Text(sectionItem.selectedValue.toString());
@ -322,11 +320,6 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
? const Text("File Uploaded") ? const Text("File Uploaded")
: const Text(" ") : const Text(" ")
: const Text(" "); : const Text(" ");
case InteractionWidget.DROPDOWN:
return Text(sectionItem.selectedValue!.isNotEmpty
? provider.getDataValue(
sectionItem.id, sectionItem.selectedValue!.last)
: " ");
default: default:
return Text(sectionItem.selectedValue!.isNotEmpty return Text(sectionItem.selectedValue!.isNotEmpty
? provider.getDataValue( ? provider.getDataValue(

View File

@ -140,22 +140,13 @@ class ViewInteractionProvider extends ChangeNotifier {
for (SectionList obj in item.multipleList!) { for (SectionList obj in item.multipleList!) {
obj.gid = obj.gid ?? item.multipleList!.length; obj.gid = obj.gid ?? item.multipleList!.length;
if (obj.widget == InteractionWidget.TEXT) { if (obj.widget == InteractionWidget.TEXT) {
debugPrint("textcontr:${obj.gid}");
debugPrint("textcontr:${obj.selectedValue}");
// debugPrint("textcontr:${obj.controller!.value}");
var textEditingController = TextEditingController(); var textEditingController = TextEditingController();
textEditingController.value = TextEditingValue(
text: obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last ?? ""
: "");
textEditingController.text = obj.selectedValue!.isNotEmpty textEditingController.text = obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last ?? "" ? obj.selectedValue!.last ?? ""
: ""; : "";
multipletextEditingControllerList.add(textEditingController); multipletextEditingControllerList.add(textEditingController);
// obj.controller!.value = textEditingController.value; obj.controller = multipletextEditingControllerList.last;
obj.controller = textEditingController;
// obj.controller = obj.selectedValue.last ?? " "; // obj.controller = obj.selectedValue.last ?? " ";
} }
if (obj.widget == InteractionWidget.DROPDOWN || if (obj.widget == InteractionWidget.DROPDOWN ||
@ -617,23 +608,6 @@ class ViewInteractionProvider extends ChangeNotifier {
// if (interactionReponseList[index].multipleList!.isEmpty) { // if (interactionReponseList[index].multipleList!.isEmpty) {
// newList = addList; // newList = addList;
// } else { // } 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) { if (interactionReponseList[index].multipleList == null) {
interactionReponseList[index].multipleList = addList; interactionReponseList[index].multipleList = addList;
} else { } else {
@ -648,6 +622,10 @@ class ViewInteractionProvider extends ChangeNotifier {
for (SectionList obj in interactionReponseList[index].multipleList!) { for (SectionList obj in interactionReponseList[index].multipleList!) {
obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length; obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
if (obj.widget == InteractionWidget.TEXT) { if (obj.widget == InteractionWidget.TEXT) {
var textEditingController = TextEditingController();
multipletextEditingControllerList.add(textEditingController);
obj.controller = multipletextEditingControllerList.last;
obj.controller!.text = obj.controller!.text =
obj.selectedValue != null && obj.selectedValue!.isNotEmpty obj.selectedValue != null && obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last ? obj.selectedValue!.last
@ -675,14 +653,6 @@ class ViewInteractionProvider extends ChangeNotifier {
saveJsonObject(BuildContext context, String form, saveJsonObject(BuildContext context, String form,
SaveInteraction saveInteraction) async { 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 List<FormFieldData> resultData = interactionReponseList
.map((e) => FormFieldData( .map((e) => FormFieldData(
multipleList: e.multipleList == null multipleList: e.multipleList == null

View File

@ -42,9 +42,6 @@ class InteractionTextField extends StatelessWidget {
onChanged: (value) { onChanged: (value) {
onChanged(value); onChanged(value);
}, },
onSubmitted: (value) {
onChanged(value);
},
inputFormatters: [ inputFormatters: [
inputType == TextInputType.number inputType == TextInputType.number
? FilteringTextInputFormatter.digitsOnly ? FilteringTextInputFormatter.digitsOnly