validation_isrequired

This commit is contained in:
poojakhatawate 2024-06-24 17:06:09 +05:30
parent 12542f3534
commit c6ade88f27
11 changed files with 761 additions and 854 deletions

View File

@ -73,6 +73,7 @@ class MyApp extends StatefulWidget {
class _MyAppState extends State<MyApp> { class _MyAppState extends State<MyApp> {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(

View File

@ -2,6 +2,7 @@ import 'package:discover_module/ui_screen/profile.dart';
import 'package:discover_module/ui_screen/ranking.dart'; import 'package:discover_module/ui_screen/ranking.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_profile_picture/flutter_profile_picture.dart'; import 'package:flutter_profile_picture/flutter_profile_picture.dart';
import 'package:hive_flutter/hive_flutter.dart'; import 'package:hive_flutter/hive_flutter.dart';
@ -23,6 +24,8 @@ class _ContactsState extends State<Contacts> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(statusBarColor: Color.fromARGB(255, 0, 71, 132)));
print( print(
"newdata_is: ${_contactbox.values.toList()},${_contactbox.values.toList().length}"); "newdata_is: ${_contactbox.values.toList()},${_contactbox.values.toList().length}");

View File

@ -11,6 +11,7 @@ import 'package:discover_module/ui_screen/interactionform/widget/custombutton.da
import 'package:discover_module/ui_screen/interactionform/widget/customrangeslider.dart'; import 'package:discover_module/ui_screen/interactionform/widget/customrangeslider.dart';
import 'package:discover_module/ui_screen/interactionform/widget/interatciontextfield.dart'; import 'package:discover_module/ui_screen/interactionform/widget/interatciontextfield.dart';
import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -312,16 +313,31 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
.only( .only(
left: 8.0, left: 8.0,
right: 8.0), right: 8.0),
// child: Text(
// '${sectionItem.name}:*',
// style: TextStyle(
// color: Colors
// .orange
// .shade800,
// fontSize:
// isTablet
// ? 18
// : 12,
// ),
// ),
child: Text( child: Text(
'${sectionItem.name}:*', sectionItem
.isRequired
? '${sectionItem.name}:*'
: '${sectionItem.name}:',
style: TextStyle( style: TextStyle(
color: Colors color: Colors
.orange .orange
.shade800, .shade800,
fontSize: fontSize: 18.0,
isTablet // fontSize: isTablet
? 18 // ? 18
: 12, // : 12,
), ),
), ),
), ),
@ -518,7 +534,10 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
), ),
); );
case InteractionWidget.DROPDOWN: case InteractionWidget.DROPDOWN:
return customdropdown(sectionItem, provider, list, multiple); // return customdropdown(sectionItem, provider, list, multiple);
return customAutoCompletedropdown(
sectionItem, provider, list, multiple);
} }
} }
@ -1212,28 +1231,25 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
} }
print("ConvertedArrayEditMulti.leangth: $convertedArray"); print("ConvertedArrayEditMulti.leangth: $convertedArray");
print("ConvertedArray.leangth: ${convertedArray.length}"); print("ConvertedArray.leangth: ${convertedArray.length}");
return DecoratedBox( return Padding(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(10.0),
),
child: Padding(
padding: isTablet padding: isTablet
? const EdgeInsets.only(left: 14.0) ? const EdgeInsets.only(left: 0.0)
: const EdgeInsets.only(left: 12.0, right: 12.0), : const EdgeInsets.only(left: 12.0, right: 12.0),
child: Column( child: Column(
children: [ children: [
for (var i = 0; i < convertedArray.length; i++) for (var i = 0; i < convertedArray.length; i++)
DecoratedBox(
decoration: BoxDecoration(
color: i % 2 == 0
? Color.fromARGB(133, 213, 241, 254)
: Colors.white,
),
child: Wrap(
children: [
GestureDetector(child: Text("data")),
GridView.builder( GridView.builder(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( 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>( crossAxisCount: context.responsive<int>(
1, 1,
sm: 1, // small sm: 1, // small
@ -1245,17 +1261,6 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
), ),
mainAxisSpacing: mainAxisSpacing:
sectionList.length == 1 || !isTablet ? 1 : 2, 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),
childAspectRatio: sectionList.length == 1 childAspectRatio: sectionList.length == 1
? orientation == Orientation.landscape ? orientation == Orientation.landscape
? 10 ? 10
@ -1263,61 +1268,29 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
: isTablet : isTablet
? 2.8 ? 2.8
: 3.0, : 3.0,
// mainAxisSpacing:
// sectionList.length == 1 || !isTablet ? 1 : 3.5,
// childAspectRatio: sectionList.length == 1
// ? orientation == Orientation.landscape
// ? 10
// : 4.8
// : isTablet
// ? 2.8
// : 3.0,
), ),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
// childAspectRatio: sectionList.length == 1 || !isTablet
// ? orientation == Orientation.landscape
// ? 10
// : 4.2
// : 1.8,
itemCount: convertedArray[i].length, itemCount: convertedArray[i].length,
itemBuilder: (context, index) { 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]; SectionList sectionItem = convertedArray[i][index];
dropdownvalue = dropdownvalue =
sectionItem.widget == InteractionWidget.DROPDOWN 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 == sectionItem.widget ==
InteractionWidget.AUTOCOMPLETE || InteractionWidget.AUTOCOMPLETE ||
sectionItem.widget == InteractionWidget.MULTISELECT sectionItem.widget ==
InteractionWidget.MULTISELECT
? provider.getData2(sectionItem) ? provider.getData2(sectionItem)
: []; : [];
provider.checkboxlist = provider.checkboxlist =
sectionItem.widget == InteractionWidget.CHECKBOX sectionItem.widget == InteractionWidget.CHECKBOX
? provider.getData2(sectionItem) ? provider.getData2(sectionItem)
: []; : [];
return SizedBox( return SizedBox(
height: MediaQuery.of(context).size.height, height: MediaQuery.of(context).size.height,
child: Column( child: Column(
@ -1331,13 +1304,17 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
left: 8.0, right: 8.0), left: 8.0, right: 8.0),
child: Text( child: Text(
'${sectionItem.name}:*', sectionItem.isRequired
? '${sectionItem.name}:*'
: '${sectionItem.name}:',
style: TextStyle( style: TextStyle(
color: Colors.orange.shade800, color: Colors.orange.shade800,
fontSize: isTablet ? 18 : 14, fontSize: 18.0,
), // fontSize: isTablet
), // ? 18
// : 12,
), ),
)),
const SizedBox( const SizedBox(
height: 15, height: 15,
), ),
@ -1350,15 +1327,16 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
const Color.fromARGB( const Color.fromARGB(
255, 233, 229, 229), 255, 233, 229, 229),
onPressed: () async { onPressed: () async {
if (sectionItem if (sectionItem.selectedValue!
.selectedValue!.isNotEmpty) { .isNotEmpty) {
showFilesAlertDialog( showFilesAlertDialog(
context, context,
sectionItem.fileName! sectionItem.fileName!
.join(','), .join(','),
sectionItem); sectionItem);
} else { } else {
sectionItem.selectedValue = []; sectionItem.selectedValue =
[];
sectionItem.extension = []; sectionItem.extension = [];
sectionItem.fileName = []; sectionItem.fileName = [];
await getEncodedFile( await getEncodedFile(
@ -1375,12 +1353,14 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
width: 5, width: 5,
), ),
Text( Text(
sectionItem.selectedValue!.isNotEmpty sectionItem
.selectedValue!.isNotEmpty
? 'File uploaded' ? 'File uploaded'
: 'No file uploaded', : 'No file uploaded',
style: TextStyle( style: TextStyle(
color: sectionItem color: sectionItem
.selectedValue!.isNotEmpty .selectedValue!
.isNotEmpty
? Colors.green ? Colors.green
: Colors.red), : Colors.red),
), ),
@ -1399,8 +1379,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
icon: const Icon( icon: const Icon(
Icons.cancel, Icons.cancel,
size: 30, size: 30,
color: color: Color.fromARGB(
Color.fromARGB(255, 8, 39, 92), 255, 8, 39, 92),
), ),
) )
: Padding( : Padding(
@ -1441,6 +1421,8 @@ class _EditInteractionScreenState extends State<EditInteractionScreen> {
], ],
), ),
), ),
],
),
); );
} }

View File

@ -1,8 +1,10 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:js_interop';
// import 'dart:js_util'; // import 'dart:js_util';
import 'package:discover_module/constants.dart'; import 'package:discover_module/constants.dart';
import 'package:discover_module/custom_widget/floating_btn.dart';
import 'package:discover_module/ui_screen/add_event/add_hcp.dart'; import 'package:discover_module/ui_screen/add_event/add_hcp.dart';
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
@ -13,10 +15,12 @@ import 'package:discover_module/ui_screen/interactionform/widget/interatciontext
import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:popover/popover.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:dropdown_button2/dropdown_button2.dart'; import 'package:dropdown_button2/dropdown_button2.dart';
@ -25,6 +29,8 @@ import 'package:file_picker/file_picker.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
// import 'package:popover/popover.dart';
class InteractionScreen extends StatefulWidget { class InteractionScreen extends StatefulWidget {
int index; int index;
String form; String form;
@ -171,8 +177,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.center,
CrossAxisAlignment.center,
children: [ children: [
Padding( Padding(
padding: isTablet padding: isTablet
@ -193,8 +198,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
// xl: 3, // extra large screen // xl: 3, // extra large screen
// ), // ),
crossAxisCount: crossAxisCount: context.responsive<int>(
context.responsive<int>(
1, 1,
sm: 1, // small sm: 1, // small
md: isTablet md: isTablet
@ -220,8 +224,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
// : 1, // : 1,
mainAxisSpacing: mainAxisSpacing:
sectionList.length == 1 || sectionList.length == 1 || !isTablet
!isTablet
? 1 ? 1
: 3.5, : 3.5,
// mainAxisSpacing: // mainAxisSpacing:
@ -271,11 +274,9 @@ class _InteractionScreenState extends State<InteractionScreen> {
dropdownvalue = sectionItem dropdownvalue = sectionItem
.widget == .widget ==
InteractionWidget.DROPDOWN InteractionWidget.DROPDOWN
? sectionItem.value ?? ? sectionItem.value ?? "Select"
"Select"
: ' '; : ' ';
List< List<InputClass> list = sectionItem
InputClass> list = sectionItem
.widget == .widget ==
InteractionWidget InteractionWidget
.DROPDOWN || .DROPDOWN ||
@ -285,15 +286,12 @@ class _InteractionScreenState extends State<InteractionScreen> {
sectionItem.widget == sectionItem.widget ==
InteractionWidget InteractionWidget
.MULTISELECT .MULTISELECT
? provider ? provider.getData2(sectionItem)
.getData2(sectionItem)
: []; : [];
provider.checkboxlist = provider.checkboxlist = sectionItem
sectionItem.widget == .widget ==
InteractionWidget InteractionWidget.CHECKBOX
.CHECKBOX ? provider.getData2(sectionItem)
? provider
.getData2(sectionItem)
: []; : [];
return Column( return Column(
@ -313,8 +311,7 @@ class _InteractionScreenState extends State<InteractionScreen> {
left: 8.0, left: 8.0,
right: 8.0), right: 8.0),
child: FittedBox( child: FittedBox(
fit: BoxFit fit: BoxFit.scaleDown,
.scaleDown,
child: Text( child: Text(
sectionItem sectionItem
.validation! .validation!
@ -397,8 +394,90 @@ class _InteractionScreenState extends State<InteractionScreen> {
), ),
// const Spacer(), // const Spacer(),
// saveActions(provider), // saveActions(provider),
Align(
alignment: Alignment.bottomRight,
child: Container(
height: 80.0,
width: 80.0,
child: _offsetPopup(provider.interactionReponseList)))
], ],
)), ),
// floatingActionButton: FloatingBtn(
// title: "data",
// icon: Icons.add,
// onTap: () {
// showPopover(
// context: context,
// bodyBuilder: (context) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 8),
// child: ListView(
// padding: const EdgeInsets.all(8),
// children: [
// InkWell(
// onTap: () {
// },
// child: Container(
// height: 50,
// color: Colors.amber[100],
// child: const Center(child: Text('Entry A')),
// ),
// ),
// const Divider(),
// Container(
// height: 50,
// color: Colors.amber[200],
// child: const Center(child: Text('Entry B')),
// ),
// const Divider(),
// Container(
// height: 50,
// color: Colors.amber[300],
// child: const Center(child: Text('Entry C')),
// ),
// const Divider(),
// Container(
// height: 50,
// color: Colors.amber[400],
// child: const Center(child: Text('Entry D')),
// ),
// const Divider(),
// Container(
// height: 50,
// color: Colors.amber[500],
// child: const Center(child: Text('Entry E')),
// ),
// const Divider(),
// Container(
// height: 50,
// color: Colors.amber[600],
// child: const Center(child: Text('Entry F')),
// ),
// ],
// ),
// );
// },
// );
// var itemsectionname =
// provider.interactionReponseList.length;
// print("ItemSectionname: $itemsectionname");
// for (int i = 0; i < itemsectionname; i++) {
// var item = provider.interactionReponseList[i];
// print(
// "Check_ProviderNameL ${item.sectionName}, ${item.multiple}");
// }
// // provider.getSectionItem(
// // item.sectionName,
// // );
// },
// )
),
); );
}), }),
); );
@ -549,7 +628,10 @@ class _InteractionScreenState extends State<InteractionScreen> {
), ),
); );
case InteractionWidget.DROPDOWN: case InteractionWidget.DROPDOWN:
return customdropdown(sectionItem, provider, list, multiple); // return customdropdown(sectionItem, provider, list, multiple);
return customAutoCompletedropdown(
sectionItem, provider, list, multiple);
} }
} }
@ -1125,200 +1207,6 @@ class _InteractionScreenState extends State<InteractionScreen> {
); );
} }
// Widget gridViewWidget(
// InteractionProvider provider,
// String sectionName,
// List<SectionList> sectionList,
// Orientation orientation,
// FormFieldData item,
// int listIndex) {
// print("ListInex: $listIndex");
// print("sectionName: $sectionName");
// print("sectionName: $sectionName");
// print("gridsectionlost_is: $sectionList");
// print("gridsectionlostleangth_is: ${sectionList.length}");
// List<SectionList> pooja = sectionList;
// print("Pooja_isss: $pooja");
// 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
// // ),
// crossAxisCount: context.responsive<int>(
// 1,
// sm: 1, // small
// md: 1, // medium
// lg: sectionList.length == 1
// ? 1
// : (sectionList.length >= 1 ? 3 : 3), // large
// xl: 3, // 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,
// // childAspectRatio: sectionList.length == 1
// // ? orientation == Orientation.landscape
// // ? 10
// // : 4.8
// // : isTablet
// // ? 2.8
// // : 3.0,
// childAspectRatio: MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height / 3),
// 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.input == 'add' ||
// sectionItem.input == '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 {
// 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
// ? sectionItem.selectedValue!.isNotEmpty
// ? 'File uploaded'
// : "Files 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,
// height: 40,
// // height:
// // MediaQuery.of(context).size.height *
// // 0.2,
// 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),
// ],
// ),
// ]);
// },
// ),
// ),
// );
// }
//////////////////////////////////////Poojaaaa/////////////////////
///
///
Widget gridViewWidget( Widget gridViewWidget(
InteractionProvider provider, InteractionProvider provider,
String sectionName, String sectionName,
@ -1357,46 +1245,24 @@ class _InteractionScreenState extends State<InteractionScreen> {
print("ConvertedArray.leangth: $convertedArray"); print("ConvertedArray.leangth: $convertedArray");
print("ConvertedArray.leangth: ${convertedArray.length}"); print("ConvertedArray.leangth: ${convertedArray.length}");
return DecoratedBox( return Padding(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(10.0),
),
child: Padding(
padding: isTablet padding: isTablet
? const EdgeInsets.only(left: 14.0) ? const EdgeInsets.only(left: 0.0)
: const EdgeInsets.only(left: 12.0, right: 12.0), : const EdgeInsets.only(left: 12.0, right: 12.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
for (var i = 0; i < convertedArray.length; i++) for (var i = 0; i < convertedArray.length; i++)
GridView.builder( DecoratedBox(
decoration: BoxDecoration(
// border: Border.all(color: Colors.black),
// borderRadius: BorderRadius.circular(10.0),
color: i % 2 == 0
? Color.fromARGB(133, 213, 241, 254)
: Colors.white,
),
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: context.responsive<int>(
// 1,
// sm: 1, // small
// md: orientation == Orientation.landscape
// ? 1
// : 2, // medium
// lg: sectionList.length == 1
// ? 1
// : (sectionList.length >= 1 ? 3 : 3), // large
// xl: 3, // extra large screen
// ),
// mainAxisSpacing:
// sectionList.length == 1 || !isTablet ? 1 : 2,
// // childAspectRatio: isTablet
// // ? MediaQuery.of(context).size.width /
// // (MediaQuery.of(context).size.height * 0.3)
// // : MediaQuery.of(context).size.width /
// // (MediaQuery.of(context).size.height * 0.1),
// childAspectRatio: isTablet
// ? MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height / 3)
// : MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height * 0.2),
// ),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: context.responsive<int>( crossAxisCount: context.responsive<int>(
1, 1,
@ -1411,13 +1277,6 @@ class _InteractionScreenState extends State<InteractionScreen> {
), ),
mainAxisSpacing: mainAxisSpacing:
sectionList.length == 1 || !isTablet ? 1 : 1, sectionList.length == 1 || !isTablet ? 1 : 1,
// childAspectRatio: isTablet
// ? MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height * 0.3)
// : MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height * 0.1),
childAspectRatio: sectionList.length == 1 childAspectRatio: sectionList.length == 1
? orientation == Orientation.landscape ? orientation == Orientation.landscape
? 10 ? 10
@ -1425,47 +1284,11 @@ class _InteractionScreenState extends State<InteractionScreen> {
: isTablet : isTablet
? 2.8 ? 2.8
: 3.0, : 3.0,
// childAspectRatio: isTablet
// ? MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height / 3)
// : orientation == Orientation.landscape
// ? MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height * 0.5)
// : MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height * 0.1),
), ),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: convertedArray[i].length, itemCount: convertedArray[i].length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
// SectionList sectionItem =
// convertedArray.expand((list) => list).toList()[index];
// List.generate(
// sectionList.length,
// (i) {
// print(sectionList);
// // SectionList sectionItem = sectionList[i];
// SectionList sectionItem =
// convertedArray.expand((list) => list).toList()[index];
// 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]; SectionList sectionItem = convertedArray[i][index];
dropdownvalue = dropdownvalue =
sectionItem.widget == InteractionWidget.DROPDOWN sectionItem.widget == InteractionWidget.DROPDOWN
@ -1497,7 +1320,9 @@ class _InteractionScreenState extends State<InteractionScreen> {
child: FittedBox( child: FittedBox(
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
child: Text( child: Text(
'${sectionItem.name}:*', sectionItem.validation!.isRequired
? "${sectionItem.name}*"
: sectionItem.name,
style: TextStyle( style: TextStyle(
color: Colors.orange.shade800, color: Colors.orange.shade800,
fontSize: 18), fontSize: 18),
@ -1602,10 +1427,10 @@ class _InteractionScreenState extends State<InteractionScreen> {
], ],
), ),
); );
}) }),
)
], ],
), ),
),
); );
//); //);
} }
@ -1761,6 +1586,77 @@ class _InteractionScreenState extends State<InteractionScreen> {
}, },
); );
} }
Widget _offsetPopup(List<FormFieldData> interactionReponseList) => PopupMenuButton<
int>(
itemBuilder: (context) {
return List.generate(interactionReponseList.length, (index) {
var provider =
Provider.of<InteractionProvider>(context, listen: false);
var item = provider.interactionReponseList[index];
return PopupMenuItem(
value: index,
child: item.multiple
? GestureDetector(
onTap: () {
print("Clicked Section ${item.sectionName}");
// provider.getSectionItem(
// item.sectionName,
// );
setState(() {
provider.getSectionItem(
item.sectionName,
);
});
const DecoratedBox(
decoration: BoxDecoration(
// border: Border.all(color: Colors.black),
// borderRadius: BorderRadius.circular(10.0),
border: Border(
bottom: BorderSide(width: 1.5, color: Colors.black),
//top: BorderSide(width: 1.5, color: Colors.black),
),
),
);
},
child: Text(' ${item.sectionName}'))
: Container(),
);
});
},
// itemBuilder: (context) => [
// const PopupMenuItem(
// value: 1,
// child: Text(
// "Flutter Open",
// style:
// TextStyle(color: Colors.black, fontWeight: FontWeight.w700),
// ),
// ),
// const PopupMenuItem(
// value: 2,
// child: Text(
// "Flutter Tutorial",
// style:
// TextStyle(color: Colors.black, fontWeight: FontWeight.w700),
// ),
// ),
// ],
icon: Container(
height: double.infinity,
width: double.infinity,
decoration: const ShapeDecoration(
color: Color.fromARGB(255, 8, 39, 92),
shape: StadiumBorder(
side: BorderSide(color: Colors.white, width: 2),
),
),
child: Icon(Icons.add, color: Colors.white),
));
} }

View File

@ -1148,6 +1148,7 @@ class InteractionProvider extends ChangeNotifier {
.where((element) => element.pid == obj.sectionList[i].value) .where((element) => element.pid == obj.sectionList[i].value)
.toList(); .toList();
// sectionItem.selectedObject = list[0];
sectionItem.selectedObject = list[0]; sectionItem.selectedObject = list[0];
} else { } else {
// InputClass obj = InputClass( // InputClass obj = InputClass(
@ -1382,6 +1383,7 @@ class InteractionProvider extends ChangeNotifier {
inputList: e.inputList, inputList: e.inputList,
isRequired: e.isRequired, isRequired: e.isRequired,
name: e.name, name: e.name,
validation: e.validation,
param: e.param, param: e.param,
selectedValue: [], selectedValue: [],
widget: e.widget, widget: e.widget,
@ -1392,13 +1394,14 @@ class InteractionProvider extends ChangeNotifier {
value: e.value)) value: e.value))
.toList(); .toList();
SectionList delItem = SectionList( SectionList delItem = SectionList(
name: "delete", name: " ",
param: "deletebtn", param: "deletebtn",
id: "deletebtn", id: "deletebtn",
selectedValue: [], selectedValue: [],
depid: "", depid: "",
widget: InteractionWidget.BUTTON, widget: InteractionWidget.BUTTON,
inputList: [], inputList: [],
validation: Validation(isRequired: false),
isRequired: true); isRequired: true);
addList.add(delItem); addList.add(delItem);
@ -1502,9 +1505,11 @@ class InteractionProvider extends ChangeNotifier {
: e.multipleList! : e.multipleList!
.map((mobj) => SectionList( .map((mobj) => SectionList(
depid: mobj.depid, depid: mobj.depid,
validation:
Validation(isRequired: mobj.validation!.isRequired),
id: mobj.id, id: mobj.id,
inputList: mobj.inputList, inputList: mobj.inputList,
isRequired: mobj.isRequired, isRequired: mobj.validation!.isRequired,
name: mobj.name, name: mobj.name,
param: mobj.param, param: mobj.param,
selectedValue: mobj.selectedValue, selectedValue: mobj.selectedValue,
@ -1521,8 +1526,10 @@ class InteractionProvider extends ChangeNotifier {
.map((obj) => SectionList( .map((obj) => SectionList(
depid: obj.depid, depid: obj.depid,
id: obj.id, id: obj.id,
validation:
Validation(isRequired: obj.validation!.isRequired),
inputList: obj.inputList, inputList: obj.inputList,
isRequired: obj.isRequired, isRequired: obj.validation!.isRequired,
name: obj.name, name: obj.name,
param: obj.param, param: obj.param,
selectedValue: obj.selectedValue, selectedValue: obj.selectedValue,
@ -1675,30 +1682,32 @@ class InteractionProvider extends ChangeNotifier {
print("Section_isssss: $section"); print("Section_isssss: $section");
print("Section_isssss: ${section.widget}"); print("Section_isssss: ${section.widget}");
print("Section_isssss: ${section.selectedId}"); print("Section_isssss: ${section.selectedId}");
print("Section_isssss1111: ${section.isRequired},${section.name}");
if (section.widget == InteractionWidget.TEXT) { if (section.widget == InteractionWidget.TEXT) {
if (section.controller!.text.isEmpty) { // if (section.controller!.text.isEmpty) {
if (section.isRequired == true && section.controller!.text.isEmpty) {
debugPrint("Iam text and empty"); debugPrint("Iam text and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.AUTOCOMPLETE) { } else if (section.widget == InteractionWidget.AUTOCOMPLETE) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam AUTOCOMPLETE and empty"); debugPrint("Iam AUTOCOMPLETE and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.DROPDOWN) { } else if (section.widget == InteractionWidget.DROPDOWN) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam dropdown and empty"); debugPrint("Iam dropdown and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.CHECKBOX) { } else if (section.widget == InteractionWidget.CHECKBOX) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam CHECKBOX and empty"); debugPrint("Iam CHECKBOX and empty");
notifyListeners(); notifyListeners();
@ -1712,35 +1721,36 @@ class InteractionProvider extends ChangeNotifier {
print("Multilist Enterwidget: ${msection.widget}"); print("Multilist Enterwidget: ${msection.widget}");
if (msection.widget == InteractionWidget.TEXT) { if (msection.isRequired == true &&
msection.widget == InteractionWidget.TEXT) {
print("Checkinggg: ${msection.id}"); print("Checkinggg: ${msection.id}");
print("Checkinggg: ${msection.depid}"); print("Checkinggg: ${msection.depid}");
print("Checkinggg: ${msection.chars}"); print("Checkinggg: ${msection.chars}");
print("Checkinggg: ${msection.selectedId}"); print("Checkinggg: ${msection.selectedId}");
print("Checkinggg: ${msection.selectedValue!}"); print("Checkinggg: ${msection.selectedValue!}");
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam multi text and empty"); debugPrint("Iam multi text and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.AUTOCOMPLETE) { } else if (msection.widget == InteractionWidget.AUTOCOMPLETE) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam AUTOCOMPLETE and empty"); debugPrint("Iam AUTOCOMPLETE and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.DROPDOWN) { } else if (msection.widget == InteractionWidget.DROPDOWN) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam dropdown and empty"); debugPrint("Iam dropdown and empty ${msection.widget}");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.CHECKBOX) { } else if (msection.widget == InteractionWidget.CHECKBOX) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam CHECKBOX and empty"); debugPrint("Iam CHECKBOX and empty");
notifyListeners(); notifyListeners();

View File

@ -126,7 +126,7 @@ class SectionList {
@HiveField(8) @HiveField(8)
List<InputClass>? inputList; List<InputClass>? inputList;
@HiveField(9) @HiveField(9)
bool? isRequired; bool isRequired;
TextEditingController? controller; TextEditingController? controller;
@HiveField(10) @HiveField(10)
@ -160,7 +160,7 @@ class SectionList {
this.input, this.input,
this.gid, this.gid,
this.inputList, this.inputList,
this.isRequired, this.isRequired = false,
this.controller, this.controller,
this.selectedObject, this.selectedObject,
this.selectedId, this.selectedId,

View File

@ -109,7 +109,7 @@ class SectionListAdapter extends TypeAdapter<SectionList> {
input: fields[7] as String?, input: fields[7] as String?,
gid: fields[3] as int?, gid: fields[3] as int?,
inputList: (fields[8] as List?)?.cast<InputClass>(), inputList: (fields[8] as List?)?.cast<InputClass>(),
isRequired: fields[9] as bool?, isRequired: fields[9] as bool,
selectedObject: fields[12] as InputClass?, selectedObject: fields[12] as InputClass?,
selectedId: fields[11] as String?, selectedId: fields[11] as String?,
validation: fields[13] as Validation?, validation: fields[13] as Validation?,

View File

@ -501,19 +501,21 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
print("ConvertedArrayEdit.leangth: $convertedArray"); print("ConvertedArrayEdit.leangth: $convertedArray");
print("ConvertedArray.leangth2323: ${convertedArray.length}"); print("ConvertedArray.leangth2323: ${convertedArray.length}");
return DecoratedBox( return Padding(
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
borderRadius: BorderRadius.circular(10),
),
child: Padding(
padding: isTablet padding: isTablet
? const EdgeInsets.only(left: 14.0) ? const EdgeInsets.only(left: 0.0, right: 0.0)
: const EdgeInsets.only(left: 12.0, right: 12.0), : const EdgeInsets.only(left: 12.0, right: 12.0),
child: Column( child: Column(
children: [ children: [
for (var i = 0; i < convertedArray.length; i++) for (var i = 0; i < convertedArray.length; i++)
GridView.builder( DecoratedBox(
decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.0),
color: i % 2 == 0
? Color.fromARGB(133, 213, 241, 254)
: Colors.white,
),
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: context.responsive<int>( crossAxisCount: context.responsive<int>(
@ -617,10 +619,10 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
); );
}, },
), ),
),
//), //),
], ],
), ),
),
); );
} }

View File

@ -597,6 +597,7 @@ class ViewInteractionProvider extends ChangeNotifier {
inputList: e.inputList, inputList: e.inputList,
isRequired: e.isRequired, isRequired: e.isRequired,
name: e.name, name: e.name,
validation: e.validation,
param: e.param, param: e.param,
selectedValue: [], selectedValue: [],
widget: e.widget, widget: e.widget,
@ -607,13 +608,14 @@ class ViewInteractionProvider extends ChangeNotifier {
value: e.value)) value: e.value))
.toList(); .toList();
SectionList delItem = SectionList( SectionList delItem = SectionList(
name: "delete", name: " ",
param: "deletebtn", param: "deletebtn",
id: "deletebtn", id: "deletebtn",
selectedValue: [], selectedValue: [],
depid: "", depid: "",
widget: InteractionWidget.BUTTON, widget: InteractionWidget.BUTTON,
inputList: [], inputList: [],
validation: Validation(isRequired: false),
isRequired: true); isRequired: true);
addList.add(delItem); addList.add(delItem);
@ -775,6 +777,7 @@ class ViewInteractionProvider extends ChangeNotifier {
depid: mobj.depid, depid: mobj.depid,
id: mobj.id, id: mobj.id,
inputList: mobj.inputList, inputList: mobj.inputList,
validation: mobj.validation,
isRequired: mobj.isRequired, isRequired: mobj.isRequired,
extension: mobj.extension, extension: mobj.extension,
fileName: mobj.fileName, fileName: mobj.fileName,
@ -793,9 +796,10 @@ class ViewInteractionProvider extends ChangeNotifier {
depid: obj.depid, depid: obj.depid,
id: obj.id, id: obj.id,
inputList: obj.inputList, inputList: obj.inputList,
validation: obj.validation,
isRequired: obj.isRequired,
extension: obj.extension, extension: obj.extension,
fileName: obj.fileName, fileName: obj.fileName,
isRequired: obj.isRequired,
name: obj.name, name: obj.name,
param: obj.param, param: obj.param,
selectedValue: obj.tempselectedValue ?? obj.selectedValue, selectedValue: obj.tempselectedValue ?? obj.selectedValue,
@ -930,28 +934,28 @@ class ViewInteractionProvider extends ChangeNotifier {
print("Section_isssss: ${section.selectedId}"); print("Section_isssss: ${section.selectedId}");
if (section.widget == InteractionWidget.TEXT) { if (section.widget == InteractionWidget.TEXT) {
if (section.controller!.text.isEmpty) { if (section.isRequired == true && section.controller!.text.isEmpty) {
debugPrint("Iam text and empty"); debugPrint("Iam text and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.AUTOCOMPLETE) { } else if (section.widget == InteractionWidget.AUTOCOMPLETE) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam AUTOCOMPLETE and empty"); debugPrint("Iam AUTOCOMPLETE and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.DROPDOWN) { } else if (section.widget == InteractionWidget.DROPDOWN) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam dropdown and empty"); debugPrint("Iam dropdown and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (section.widget == InteractionWidget.CHECKBOX) { } else if (section.widget == InteractionWidget.CHECKBOX) {
if (section.selectedValue!.isEmpty) { if (section.isRequired == true && section.selectedValue!.isEmpty) {
debugPrint("Iam CHECKBOX and empty"); debugPrint("Iam CHECKBOX and empty");
notifyListeners(); notifyListeners();
@ -972,28 +976,28 @@ class ViewInteractionProvider extends ChangeNotifier {
print("Checkinggg: ${msection.selectedId}"); print("Checkinggg: ${msection.selectedId}");
print("Checkinggg: ${msection.selectedValue!}"); print("Checkinggg: ${msection.selectedValue!}");
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam multi text and empty"); debugPrint("Iam multi text and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.AUTOCOMPLETE) { } else if (msection.widget == InteractionWidget.AUTOCOMPLETE) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam AUTOCOMPLETE and empty"); debugPrint("Iam AUTOCOMPLETE and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.DROPDOWN) { } else if (msection.widget == InteractionWidget.DROPDOWN) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam dropdown and empty"); debugPrint("Iam dropdown and empty");
notifyListeners(); notifyListeners();
return false; return false;
} }
} else if (msection.widget == InteractionWidget.CHECKBOX) { } else if (msection.widget == InteractionWidget.CHECKBOX) {
if (msection.selectedValue!.isEmpty) { if (msection.isRequired == true && msection.selectedValue!.isEmpty) {
debugPrint("Iam CHECKBOX and empty"); debugPrint("Iam CHECKBOX and empty");
notifyListeners(); notifyListeners();

View File

@ -776,6 +776,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.1" version: "1.5.1"
popover:
dependency: "direct main"
description:
name: popover
sha256: "5cba40e04115cbbf15c35e00767b91e8bf3f769763a34beb2f8a1b9e8b5fc876"
url: "https://pub.dev"
source: hosted
version: "0.3.0+1"
provider: provider:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -58,6 +58,7 @@ dependencies:
rfw: ^1.0.26 rfw: ^1.0.26
hive_generator: ^2.0.1 hive_generator: ^2.0.1
responsive_grid: ^2.4.4 responsive_grid: ^2.4.4
popover: ^0.3.0+1
dev_dependencies: dev_dependencies: