UIiphoneResponsie

This commit is contained in:
poojakhatawate 2024-06-10 16:41:00 +05:30
parent 6ddaf2774a
commit e13307c953
20 changed files with 8632 additions and 2241 deletions

View File

@ -49,6 +49,8 @@ Future<void> main() async {
var box = await Hive.openBox('mycontact'); var box = await Hive.openBox('mycontact');
var box1 = await Hive.openBox('myfilter'); var box1 = await Hive.openBox('myfilter');
await Hive.openBox('checkvalue');
runApp(MultiProvider( runApp(MultiProvider(
providers: [ providers: [
ChangeNotifierProvider(create: (_) => InteractionProvider()), 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(),
// ));
// }

View File

@ -29,118 +29,122 @@ class _ContactsState extends State<Contacts> {
print( print(
"Data_newww: ${HiveFunctions.getAllUsers()} ,${HiveFunctions.getAllUsers().length} "); "Data_newww: ${HiveFunctions.getAllUsers()} ,${HiveFunctions.getAllUsers().length} ");
return Scaffold( return SafeArea(
// appBar: AppBar( child: Scaffold(
// title: const Text('Contacts'), // appBar: AppBar(
// ), // title: const Text('Contacts'),
body: Column( // ),
children: [ body: Column(
Row( children: [
mainAxisAlignment: MainAxisAlignment Row(
.center, // Align children to start and end of the row mainAxisAlignment: MainAxisAlignment
.center, // Align children to start and end of the row
children: [ children: [
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 45.0), padding: const EdgeInsets.only(left: 45.0),
child: Text( child: Text(
_switchValue ? "My Contacts" : "All Contacts", _switchValue ? "My Contacts" : "All Contacts",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
fontSize: 20.0, fontSize: 20.0,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal, fontStyle: FontStyle.normal,
color: _switchValue ? Colors.black : Colors.black), color: _switchValue ? Colors.black : Colors.black),
),
), ),
), ),
), // Expanded(
// Expanded( Row(
Row( // Adjust alignment as needed
// Adjust alignment as needed mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [
children: [ _switchValue
_switchValue
? const Text(
'All',
style: TextStyle(
fontSize: 12,
decoration: TextDecoration.lineThrough,
decorationThickness: 0.85,
),
// TODO: implement dispose
)
: const Text('All',
style: TextStyle(
fontSize: 12,
)),
CupertinoSwitch(
activeColor: Color.fromARGB(255, 0, 71, 132),
value: _switchValue,
onChanged: (value) {
setState(() {
print("Switch_value_is : $value");
_switchValue = value;
});
},
),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: !_switchValue
? const Text( ? const Text(
'My', 'All',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
decoration: TextDecoration.lineThrough, decoration: TextDecoration.lineThrough,
decorationThickness: 0.85, decorationThickness: 0.85,
), ),
// TODO: implement dispose
) )
: const Text('My', : const Text('All',
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
)), )),
) CupertinoSwitch(
], activeColor: Color.fromARGB(255, 0, 71, 132),
), value: _switchValue,
// ), onChanged: (value) {
]), setState(() {
Expanded( print("Switch_value_is : $value");
child: ListView.builder( _switchValue = value;
itemCount: HiveFunctions.getAllUsers().length, });
itemBuilder: (BuildContext context, int index) { },
var data = HiveFunctions.getAllUsers()[index]; ),
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: !_switchValue
? const Text(
'My',
style: TextStyle(
fontSize: 12,
decoration: TextDecoration.lineThrough,
decorationThickness: 0.85,
),
)
: const Text('My',
style: TextStyle(
fontSize: 12,
)),
)
],
),
// ),
]),
Expanded(
child: ListView.builder(
itemCount: HiveFunctions.getAllUsers().length,
itemBuilder: (BuildContext context, int index) {
var data = HiveFunctions.getAllUsers()[index];
print("dataaaa_isss:$data"); print("dataaaa_isss:$data");
return Column( return Column(
children: [ children: [
ListTile( ListTile(
onTap: () { onTap: () {
Navigator.push(context, Navigator.push(
MaterialPageRoute(builder: (context) => Profile())); context,
}, MaterialPageRoute(
// title: Text(_contactbox.values.toString()), builder: (context) => Profile()));
leading: ProfilePicture( },
name: data["name"], // title: Text(_contactbox.values.toString()),
radius: 20, leading: ProfilePicture(
fontsize: 12, name: data["name"],
radius: 20,
fontsize: 12,
),
title: Text(
data["name"],
style: const TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold),
),
subtitle: const Text(
"Added by Pooja.K",
style: TextStyle(
fontSize: 14.0, fontWeight: FontWeight.normal),
),
), ),
title: Text( ],
data["name"], );
style: const TextStyle( },
fontSize: 18.0, fontWeight: FontWeight.bold), ),
),
subtitle: const Text(
"Added by Pooja.K",
style: TextStyle(
fontSize: 14.0, fontWeight: FontWeight.normal),
),
),
],
);
},
), ),
), ],
], ),
), ),
); );
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -47,120 +47,125 @@ class _InteractionListScreenState extends State<InteractionListScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<InteractionProvider>( return Consumer<InteractionProvider>(
builder: (BuildContext context, provider, Widget? child) { builder: (BuildContext context, provider, Widget? child) {
return Scaffold( return SafeArea(
appBar: AppBar( child: Scaffold(
title: Text( appBar: AppBar(
'Interaction Forms', title: Text(
//style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), 'Interaction Forms',
), //style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
automaticallyImplyLeading: false, ),
// backgroundColor: const Color(0xFF2b9af3), automaticallyImplyLeading: false,
leading: InkWell( // backgroundColor: const Color(0xFF2b9af3),
onTap: () { leading: InkWell(
Navigator.pop(context); onTap: () {
}, Navigator.pop(context);
child: const Icon( },
Icons.arrow_back_ios, child: const Icon(
color: Colors.white, Icons.arrow_back_ios,
color: Colors.white,
),
), ),
), ),
), body: Container(
body: Container( child: Center(
child: Center( child: ListView.builder(
child: ListView.builder( itemCount: provider.intConfigDataList.length,
itemCount: provider.intConfigDataList.length, cacheExtent: double.parse(
cacheExtent: double.parse( provider.intConfigDataList.length.toString()),
provider.intConfigDataList.length.toString()), itemBuilder: (context, index) {
itemBuilder: (context, index) { return Column(
return Column( children: [
children: [ ListTile(
ListTile( title: Row(
title: Row( children: [
children: [ Text(
Text( provider.intConfigDataList[index].name,
provider.intConfigDataList[index].name,
),
const SizedBox(
width: 20,
),
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
InteractionScreen(
index: index,
form: provider
.intConfigDataList[index]
.name,
)));
},
icon: const Icon(
Icons.arrow_circle_right_outlined,
size: 30,
color: Color.fromARGB(255, 8, 39, 92),
), ),
), const SizedBox(
], width: 20,
), ),
trailing: provider.savedList.indexWhere((element) => IconButton(
element.form == onPressed: () {
provider.intConfigDataList[index].name) != Navigator.push(
-1 context,
? InkWell( MaterialPageRoute(
onTap: () { builder: (BuildContext context) =>
if (getCount( InteractionScreen(
provider index: index,
.intConfigDataList[index].name, form: provider
provider) != .intConfigDataList[index]
0) { .name,
provider.savedList )));
.where((element) =>
element.form ==
provider.intConfigDataList[index]
.name)
.toList();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
SavedFormListScreen(
formname: provider
.intConfigDataList[
index]
.name,
)));
}
}, },
child: FittedBox( icon: const Icon(
fit: BoxFit.scaleDown, Icons.arrow_circle_right_outlined,
child: Text( size: 30,
"${provider.savedList.where((element) => element.form == provider.intConfigDataList[index].name).length} record(s) saved", color: Color.fromARGB(255, 8, 39, 92),
style: TextStyle(
// fontSize: isTablet ? 18.0 : 14,
fontSize: 18.0,
color: Colors.blue.shade900),
),
), ),
) ),
: const SizedBox.shrink(), ],
onTap: () { ),
Navigator.push( trailing: provider.savedList.indexWhere((element) =>
context, element.form ==
MaterialPageRoute( provider
builder: (BuildContext context) => .intConfigDataList[index].name) !=
InteractionScreen( -1
index: index, ? InkWell(
form: provider onTap: () {
.intConfigDataList[index].name, if (getCount(
))); provider.intConfigDataList[index]
}, .name,
), provider) !=
const Divider(), 0) {
], provider.savedList
); .where((element) =>
})), element.form ==
provider
.intConfigDataList[index]
.name)
.toList();
Navigator.push(
context,
MaterialPageRoute(
builder:
(BuildContext context) =>
SavedFormListScreen(
formname: provider
.intConfigDataList[
index]
.name,
)));
}
},
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(
"${provider.savedList.where((element) => element.form == provider.intConfigDataList[index].name).length} record(s) saved",
style: TextStyle(
// fontSize: isTablet ? 18.0 : 14,
fontSize: 18.0,
color: Colors.blue.shade900),
),
),
)
: const SizedBox.shrink(),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
InteractionScreen(
index: index,
form: provider
.intConfigDataList[index].name,
)));
},
),
const Divider(),
],
);
})),
),
), ),
); );
}); });

File diff suppressed because it is too large Load Diff

View File

@ -16,10 +16,12 @@ class MockApiCall {
final response = await dio.get('https://passvault.konectar.io/forms'); final response = await dio.get('https://passvault.konectar.io/forms');
print("response1"); print("response1_isssss");
// print(response.data.toString()); // print(response.data.toString());
log('${jsonEncode(response.data)}'); // log(jsonEncode(response.data));
final parsedJson = json.encode(response.data);
print(parsedJson);
return response.data; return response.data;
} }

View File

@ -98,6 +98,11 @@ class FormFieldData {
Map<String, dynamic> saveToJson() => { Map<String, dynamic> saveToJson() => {
"sectionName": sectionName, "sectionName": sectionName,
}; };
@override
String toString() {
// TODO: implement toString
return multiple.toString();
}
} }
@HiveType(typeId: 5) @HiveType(typeId: 5)

View File

@ -62,6 +62,12 @@ class SaveInteraction {
"form": form, "form": form,
"intId": intId, "intId": intId,
}; };
@override
String toString() {
// TODO: implement toString
return save.toString();
}
} }
class JsonFormat {} class JsonFormat {}

View File

@ -10,7 +10,7 @@ class HiveDataRepository extends ChangeNotifier {
HiveDataRepository(this._hiveBox); HiveDataRepository(this._hiveBox);
List<InteractionConfigData> getAllDataFromHive() { List<InteractionConfigData> getAllDataFromHive() {
print("Stored_ALL_valuesssss : ${_hiveBox.values.toList()}"); print("Stored_ALL_valuesssss : ${_hiveBox.values.toList().toString()}");
print( print(
"Stored_ALL_valuesssss_leangthhh : ${_hiveBox.values.toList().length}"); "Stored_ALL_valuesssss_leangthhh : ${_hiveBox.values.toList().length}");

View File

@ -39,110 +39,113 @@ class _SavedFormListScreenState extends State<SavedFormListScreen> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<ViewInteractionProvider>( return Consumer<ViewInteractionProvider>(
builder: (BuildContext context, provider, Widget? child) { builder: (BuildContext context, provider, Widget? child) {
return Scaffold( return SafeArea(
appBar: AppBar( child: Scaffold(
title: Text( appBar: AppBar(
'Records of ${widget.formname}', title: Text(
style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white), 'Records of ${widget.formname}',
), style:
automaticallyImplyLeading: false, TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
// backgroundColor: const Color(0xFF2b9af3), ),
leading: InkWell( automaticallyImplyLeading: false,
onTap: () { // backgroundColor: const Color(0xFF2b9af3),
Navigator.pop(context); leading: InkWell(
}, onTap: () {
child: const Icon( Navigator.pop(context);
Icons.arrow_back_ios, },
color: Colors.white, child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
), ),
), ),
), body: Container(
body: Container( child: Center(
child: Center( child: ListView.builder(
child: ListView.builder( itemCount: provider.savedList.length,
itemCount: provider.savedList.length, cacheExtent:
cacheExtent: double.parse(provider.savedList.length.toString()),
double.parse(provider.savedList.length.toString()), itemBuilder: (context, index) {
itemBuilder: (context, index) { return Column(
return Column( children: [
children: [ ListTile(
ListTile( subtitle: Text(
subtitle: Text( 'Updated on ${provider.savedList[index].updatedTime}',
'Updated on ${provider.savedList[index].updatedTime}', //style: TextStyle(fontStyle: FontStyle.italic),
//style: TextStyle(fontStyle: FontStyle.italic), ),
), title: Text(
title: Text( provider.savedList[index].id,
provider.savedList[index].id, ),
), trailing: SizedBox(
trailing: SizedBox( width: 150,
width: 150, child: Row(children: [
child: Row(children: [ IconButton(
IconButton( onPressed: () {
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
ViewInteractionScreen(
saveInteraction:
provider.savedList[index],
)));
},
icon: const Icon(
Icons.info_outline,
size: 24,
color: Color.fromARGB(255, 8, 39, 92),
),
),
IconButton(
onPressed: () async {
await provider.initConfigData().then({
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
EditInteractionScreen( ViewInteractionScreen(
saveInteraction: saveInteraction:
provider.savedList[index], provider.savedList[index],
))) )));
}); },
}, icon: const Icon(
icon: const Icon( Icons.info_outline,
Icons.edit, size: 24,
size: 24, color: Color.fromARGB(255, 8, 39, 92),
color: Color.fromARGB(255, 8, 39, 92), ),
), ),
), IconButton(
IconButton( onPressed: () async {
onPressed: () { await provider.initConfigData().then({
showDeleteRecordAlertDialog( Navigator.push(
context, context,
provider.savedList[index].id, MaterialPageRoute(
provider.savedList[index]); builder: (BuildContext context) =>
}, EditInteractionScreen(
icon: const Icon( saveInteraction: provider
Icons.delete, .savedList[index],
size: 24, )))
color: Color.fromARGB(255, 8, 39, 92), });
},
icon: const Icon(
Icons.edit,
size: 24,
color: Color.fromARGB(255, 8, 39, 92),
),
), ),
), IconButton(
]), onPressed: () {
showDeleteRecordAlertDialog(
context,
provider.savedList[index].id,
provider.savedList[index]);
},
icon: const Icon(
Icons.delete,
size: 24,
color: Color.fromARGB(255, 8, 39, 92),
),
),
]),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
ViewInteractionScreen(
saveInteraction:
provider.savedList[index],
)));
},
), ),
onTap: () { const Divider(),
Navigator.push( ],
context, );
MaterialPageRoute( })),
builder: (BuildContext context) => ),
ViewInteractionScreen(
saveInteraction:
provider.savedList[index],
)));
},
),
const Divider(),
],
);
})),
), ),
); );
}); });

View File

@ -51,219 +51,229 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
child: OrientationBuilder(builder: (context, orientation) { child: OrientationBuilder(builder: (context, orientation) {
return Scaffold( return SafeArea(
//resizeToAvoidBottomInset: false, child: Scaffold(
appBar: AppBar( //resizeToAvoidBottomInset: false,
title: Text( appBar: AppBar(
widget.saveInteraction.id, title: Text(
style: TextStyle( widget.saveInteraction.id,
fontSize: isTablet ? 22 : 14, color: Colors.white), style: TextStyle(
), fontSize: isTablet ? 22 : 14, color: Colors.white),
// backgroundColor: const Color(0xFF2b9af3),
automaticallyImplyLeading: false,
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
), ),
), // backgroundColor: const Color(0xFF2b9af3),
), automaticallyImplyLeading: false,
body: Column( leading: InkWell(
children: [ onTap: () {
Expanded( Navigator.pop(context);
child: ListView.builder( },
itemCount: provider.interactionReponseList.length, child: const Icon(
cacheExtent: double.parse( Icons.arrow_back_ios,
provider.interactionReponseList.length.toString()), color: Colors.white,
itemBuilder: (context, index) {
var item = provider.interactionReponseList[index];
sectionList = item.sectionList;
return ExpansionTile(
initiallyExpanded: true,
title: Stack(
alignment: AlignmentDirectional.center,
children: [
Container(
// height: double.infinity,
width: double.infinity,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
// color: Color(0xFF2b9af3),
color: Constants.k2color,
),
child: Text(
item.sectionName,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0),
)),
]),
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(
height: 20,
),
Padding(
padding: isTablet
? const EdgeInsets.only(left: 18.0)
: const EdgeInsets.only(
left: 12.0, right: 12.0),
child: GridView.count(
physics:
const NeverScrollableScrollPhysics(),
// crossAxisCount: context.responsive<int>(
// 1,
// sm: 1, // small
// md: 1, // medium
// lg: sectionList.length == 1
// ? 1
// : 4, // large
// xl: 3, // extra large screen
// ),
// mainAxisSpacing:
// sectionList.length == 1 || !isTablet
// ? 1
// : 3.5,
// shrinkWrap: true,
// padding: EdgeInsets.zero,
// childAspectRatio:
// sectionList.length == 1 || !isTablet
// ? orientation ==
// Orientation.landscape
// ? 10
// : 3.8
// : 2.8,
crossAxisCount: context.responsive<int>(
1,
sm: 1, // small
md: 2, // medium
lg: sectionList.length == 1
? 1
: 3, // large
xl: 3, // extra large screen
),
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,
padding: EdgeInsets.zero,
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 Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
sectionItem.widget ==
InteractionWidget
.BUTTON &&
sectionItem.param ==
'add'
? const SizedBox.shrink()
: Text(
'${sectionItem.name}:*',
style: TextStyle(
color: Colors
.orange.shade800,
fontSize: isTablet
? 18
: 12,
),
),
SizedBox(
height: isTablet ? 15 : 5,
),
returnWidget(
sectionItem: sectionItem,
item: item,
provider: provider,
list: list,
gridIndex: i,
listIndex: index,
widgetData:
sectionItem.widget!),
SizedBox(
height: isTablet ? 15 : 5,
),
],
);
},
),
),
),
SizedBox(
height: isTablet ? 15 : 5,
),
item.multiple
? gridViewWidget(
provider,
item.sectionName,
item.multipleList ?? [],
orientation,
item,
index)
: const SizedBox.shrink(),
provider.interactionReponseList.length ==
index - 1
? saveActions(provider)
: const SizedBox.shrink()
//const Spacer(),
],
),
),
]);
},
), ),
), ),
// const Spacer(), ),
// saveActions(provider), body: Column(
], children: [
)); Expanded(
child: ListView.builder(
itemCount: provider.interactionReponseList.length,
cacheExtent: double.parse(
provider.interactionReponseList.length.toString()),
itemBuilder: (context, index) {
var item = provider.interactionReponseList[index];
sectionList = item.sectionList;
return ExpansionTile(
initiallyExpanded: true,
title: Stack(
alignment: AlignmentDirectional.center,
children: [
Container(
// height: double.infinity,
width: double.infinity,
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
// color: Color(0xFF2b9af3),
color: Constants.k2color,
),
child: Text(
item.sectionName,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0),
)),
]),
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.center,
children: [
const SizedBox(
height: 20,
),
Padding(
padding: isTablet
? const EdgeInsets.only(left: 18.0)
: const EdgeInsets.only(
left: 12.0, right: 12.0),
child: GridView.count(
physics:
const NeverScrollableScrollPhysics(),
// crossAxisCount: context.responsive<int>(
// 1,
// sm: 1, // small
// md: 1, // medium
// lg: sectionList.length == 1
// ? 1
// : 4, // large
// xl: 3, // extra large screen
// ),
// mainAxisSpacing:
// sectionList.length == 1 || !isTablet
// ? 1
// : 3.5,
// shrinkWrap: true,
// padding: EdgeInsets.zero,
// childAspectRatio:
// sectionList.length == 1 || !isTablet
// ? orientation ==
// Orientation.landscape
// ? 10
// : 3.8
// : 2.8,
crossAxisCount:
context.responsive<int>(
1,
sm: 1, // small
md: 2, // medium
lg: sectionList.length == 1
? 1
: 3, // large
xl: 3, // extra large screen
),
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,
padding: EdgeInsets.zero,
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 Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
sectionItem.widget ==
InteractionWidget
.BUTTON &&
sectionItem.param ==
'add'
? const SizedBox.shrink()
: Text(
'${sectionItem.name}:*',
style: TextStyle(
color: Colors.orange
.shade800,
fontSize: isTablet
? 18
: 12,
),
),
SizedBox(
height: isTablet ? 15 : 5,
),
returnWidget(
sectionItem: sectionItem,
item: item,
provider: provider,
list: list,
gridIndex: i,
listIndex: index,
widgetData:
sectionItem.widget!),
SizedBox(
height: isTablet ? 15 : 5,
),
],
);
},
),
),
),
SizedBox(
height: isTablet ? 15 : 5,
),
item.multiple
? gridViewWidget(
provider,
item.sectionName,
item.multipleList ?? [],
orientation,
item,
index)
: const SizedBox.shrink(),
provider.interactionReponseList.length ==
index - 1
? saveActions(provider)
: const SizedBox.shrink()
//const Spacer(),
],
),
),
]);
},
),
),
// 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( Widget gridViewWidget(
InteractionProvider provider, InteractionProvider provider,
String sectionName, String sectionName,
@ -382,77 +474,118 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
Orientation orientation, Orientation orientation,
FormFieldData item, FormFieldData item,
int listIndex) { 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( return Padding(
padding: isTablet padding: isTablet
? const EdgeInsets.only(left: 22.0) ? const EdgeInsets.only(left: 22.0)
: const EdgeInsets.only(left: 12.0, right: 12.0), : const EdgeInsets.only(left: 12.0, right: 12.0),
child: GridView.count( child: Column(
physics: const NeverScrollableScrollPhysics(), children: [
crossAxisCount: context.responsive<int>( for (var i = 0; i < convertedArray.length; i++)
1, // default GridView.builder(
sm: 1, // small physics: const NeverScrollableScrollPhysics(),
md: 1, // medium gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
lg: sectionList.length == 1 ? 1 : 4, // large crossAxisCount: context.responsive<int>(
xl: 5, // extra large screen 1, // default
), sm: 1, // small
mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, md: 1, // medium
shrinkWrap: true, lg: sectionList.length == 1 ? 1 : 4, // large
padding: EdgeInsets.zero, xl: 5, // extra large screen
childAspectRatio: sectionList.length == 1 || !isTablet ),
? orientation == Orientation.landscape mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2,
? 10 ),
: 4.2 shrinkWrap: true,
: 1.8, padding: EdgeInsets.zero,
children: List.generate( // childAspectRatio: sectionList.length == 1 || !isTablet
sectionList.length, // ? orientation == Orientation.landscape
(i) { // ? 10
print(sectionList); // : 4.2
SectionList sectionItem = sectionList[i]; // : 1.8,
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN itemCount: convertedArray[i].length,
? sectionItem.value ?? "Select" itemBuilder: (context, index) {
: ' '; // children: List.generate(
List<InputClass> list = // sectionList.length,
sectionItem.widget == InteractionWidget.DROPDOWN || // (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 || sectionItem.widget == 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 Wrap(children: [ return SizedBox(
Column( height: MediaQuery.of(context).size.height,
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
sectionItem.widget == InteractionWidget.BUTTON && children: [
sectionItem.param == 'add' || sectionItem.widget == InteractionWidget.BUTTON &&
sectionItem.param == 'deletebtn' sectionItem.param == 'add' ||
? const SizedBox.shrink() sectionItem.param == 'deletebtn'
: Text( ? const SizedBox.shrink()
'${sectionItem.name}:*', : Text(
style: TextStyle( '${sectionItem.name}:*',
color: Colors.orange.shade800, style: TextStyle(
fontSize: isTablet ? 18 : 14, color: Colors.orange.shade800,
), fontSize: isTablet ? 18 : 14,
), ),
const SizedBox( ),
height: 15, const SizedBox(
height: 15,
),
returnWidget(
sectionItem: sectionItem,
item: item,
provider: provider,
list: list,
gridIndex: i,
listIndex: listIndex,
widgetData: sectionItem.widget!),
],
), ),
returnWidget( );
sectionItem: sectionItem, },
item: item, ),
provider: provider, //),
list: list, ],
gridIndex: i,
listIndex: listIndex,
widgetData: sectionItem.widget!),
],
),
]);
},
),
), ),
); );
} }

View File

@ -140,13 +140,22 @@ 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 = multipletextEditingControllerList.last; // obj.controller!.value = textEditingController.value;
obj.controller = textEditingController;
// obj.controller = obj.selectedValue.last ?? " "; // obj.controller = obj.selectedValue.last ?? " ";
} }
if (obj.widget == InteractionWidget.DROPDOWN || if (obj.widget == InteractionWidget.DROPDOWN ||
@ -608,6 +617,23 @@ 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 {
@ -622,10 +648,6 @@ 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
@ -653,6 +675,14 @@ 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
@ -793,3 +823,814 @@ class ViewInteractionProvider extends ChangeNotifier {
return false; 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;
// }
// }

View File

@ -42,6 +42,9 @@ 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

View File

@ -8,82 +8,84 @@ class DataTableDemo extends StatefulWidget {
class _DataTableDemoState extends State<DataTableDemo> { class _DataTableDemoState extends State<DataTableDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
body: ListView( child: Scaffold(
padding: const EdgeInsets.all(3), body: ListView(
children: [ padding: const EdgeInsets.all(3),
PaginatedDataTable( children: [
header: const Text( PaginatedDataTable(
'HCP RANKING', header: const Text(
style: TextStyle( 'HCP RANKING',
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal), fontSize: 18.0,
fontStyle: FontStyle.normal),
),
showFirstLastButtons: true,
showEmptyRows: false,
showCheckboxColumn: false,
// actions: const [Text("jii")],
rowsPerPage: 5,
columns: const [
DataColumn(
label: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Opt-in Status',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Country',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Score',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Event',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Affliations',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Publications',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Trails',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _DataSource(context),
), ),
showFirstLastButtons: true, ],
showEmptyRows: false, ),
showCheckboxColumn: false,
// actions: const [Text("jii")],
rowsPerPage: 5,
columns: const [
DataColumn(
label: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Opt-in Status',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Country',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Score',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Event',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Affliations',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Publications',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Trails',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _DataSource(context),
),
],
), ),
); );
} }

View File

@ -14,88 +14,90 @@ class FormList extends StatefulWidget {
class _FormListState extends State<FormList> { class _FormListState extends State<FormList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
appBar: AppBar( child: Scaffold(
title: Text("Form List"), appBar: AppBar(
), title: Text("Form List"),
body: ListView( ),
children: [ body: ListView(
ListTile( children: [
title: const Text( ListTile(
"Add My Event", title: const Text(
style: TextStyle(fontSize: 18.0), "Add My Event",
), style: TextStyle(fontSize: 18.0),
onTap: () async { ),
final ConfigDataProvider configDataProvider = onTap: () async {
ConfigDataProvider(); final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIData123(); await configDataProvider.initConfigUIData123();
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const InteractionListScreen())); builder: (context) => const InteractionListScreen()));
// Navigator.push(context, // Navigator.push(context,
// MaterialPageRoute(builder: (context) => AddEventScreen())); // MaterialPageRoute(builder: (context) => AddEventScreen()));
}, },
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
),
Divider(),
ListTile(
title: const Text(
"Interaction",
style: TextStyle(fontSize: 18.0),
), ),
onTap: () async { Divider(),
print("I am Interaction"); ListTile(
final ConfigDataProvider configDataProvider = title: const Text(
ConfigDataProvider(); "Interaction",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
print("I am Interaction");
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIData(); await configDataProvider.initConfigUIData();
// Navigator.push(context, MaterialPageRoute(builder: (context)))=> InteractionScreen(); // Navigator.push(context, MaterialPageRoute(builder: (context)))=> InteractionScreen();
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => InteractionListScreen())); builder: (context) => InteractionListScreen()));
}, },
trailing: const Icon(Icons.arrow_forward_ios), trailing: const Icon(Icons.arrow_forward_ios),
),
const Divider(),
ListTile(
title: const Text(
"New Medical Insight",
style: TextStyle(fontSize: 18.0),
), ),
onTap: () async { const Divider(),
final ConfigDataProvider configDataProvider = ListTile(
ConfigDataProvider(); title: const Text(
"New Medical Insight",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIDataMedical(); await configDataProvider.initConfigUIDataMedical();
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const InteractionListScreen())); builder: (context) => const InteractionListScreen()));
}, },
trailing: Icon(Icons.arrow_forward_ios), trailing: Icon(Icons.arrow_forward_ios),
),
Divider(),
ListTile(
title: const Text(
"Engagement",
style: TextStyle(fontSize: 18.0),
), ),
onTap: () async { Divider(),
final ConfigDataProvider configDataProvider = ListTile(
ConfigDataProvider(); title: const Text(
await configDataProvider.initConfigUIDataEng(); "Engagement",
Navigator.push( style: TextStyle(fontSize: 18.0),
context, ),
MaterialPageRoute( onTap: () async {
builder: (context) => const InteractionListScreen())); final ConfigDataProvider configDataProvider =
}, ConfigDataProvider();
trailing: const Icon(Icons.arrow_forward_ios), await configDataProvider.initConfigUIDataEng();
), Navigator.push(
Divider(), context,
], MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
Divider(),
],
),
), ),
); );
} }

View File

@ -14,349 +14,352 @@ class Profile extends StatefulWidget {
class _ProfileState extends State<Profile> { class _ProfileState extends State<Profile> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
appBar: AppBar( child: Scaffold(
title: const Text('Profile'), appBar: AppBar(
actions: const [ title: const Text('Profile'),
Padding( actions: const [
padding: const EdgeInsets.all(8.0), Padding(
child: Text("View Similar"), padding: const EdgeInsets.all(8.0),
), child: Text("View Similar"),
Padding( ),
padding: const EdgeInsets.all(8.0), Padding(
child: Text("Request Profile"), padding: const EdgeInsets.all(8.0),
) child: Text("Request Profile"),
], )
), ],
body: ListView( ),
children: [ body: ListView(
Column( children: [
crossAxisAlignment: CrossAxisAlignment.center, Column(
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ mainAxisSize: MainAxisSize.min,
Row( children: <Widget>[
children: [ Row(
const Padding( children: [
padding: EdgeInsets.all(10.0), const Padding(
child: ProfilePicture( padding: EdgeInsets.all(10.0),
name: 'Gerosa, Gino', child: ProfilePicture(
radius: 31, name: 'Gerosa, Gino',
fontsize: 21, radius: 31,
fontsize: 21,
),
), ),
), Column(
Column( children: [
children: [ // Text(
// Text( // "Gerosa, Gino",
// "Gerosa, Gino", // style: TextStyle(
// style: TextStyle( // fontSize: 22.0,
// fontSize: 22.0, // color: Colors.black,
// color: Colors.black, // ),
// ), // ),
// ), Text1(
Text1( title: "Gerosa, Gino",
title: "Gerosa, Gino", txtcolor: Colors.black,
txtcolor: Colors.black, txtfont: 22.0),
txtfont: 22.0), // Text(
// Text( // "Cardiac Surgery",
// "Cardiac Surgery", // style: TextStyle(
// style: TextStyle( // fontWeight: FontWeight.bold, fontSize: 14.0),
// fontWeight: FontWeight.bold, fontSize: 14.0), // ),
// ), Text1(
Text1( title: "Cardiac Surgery",
title: "Cardiac Surgery", txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
],
),
],
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 30.0, horizontal: 14.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(children: [
const Icon(
Icons.location_city_sharp,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
Expanded(
// child: Text(
// "Azienda Ospedaliera di Padova",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
child: Text1(
title: "Azienda Ospedaliera di Padova",
txtcolor: Colors.black, txtcolor: Colors.black,
txtfont: 14.0,
fontweight: FontWeight.bold, fontweight: FontWeight.bold,
txtfont: 14.0), )),
], ]),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(
vertical: 30.0, horizontal: 14.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(children: [
const Icon(
Icons.location_city_sharp,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox( const SizedBox(
width: 3.0, height: 8.0,
), ),
Expanded( Row(children: [
const Icon(
Icons.location_pin,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
Expanded(
// child: Text( // child: Text(
// "Azienda Ospedaliera di Padova", // "Via Giustiniani, 2, Padova, Veneto 35128, Italy",
// style: TextStyle( // style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0), // fontWeight: FontWeight.bold, fontSize: 14.0),
// ), // ),
child: Text1( child: Text1(
title: "Azienda Ospedaliera di Padova", title:
txtcolor: Colors.black, "Via Giustiniani, 2, Padova, Veneto 35128, Italy",
txtfont: 14.0, txtcolor: Colors.black,
fontweight: FontWeight.bold, fontweight: FontWeight.bold,
)), txtfont: 14.0),
]), ),
const SizedBox( ]),
height: 8.0,
),
Row(children: [
const Icon(
Icons.location_pin,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox( const SizedBox(
width: 3.0, height: 8.0,
), ),
Expanded( Row(children: [
// child: Text( const Icon(
// "Via Giustiniani, 2, Padova, Veneto 35128, Italy", Icons.phone,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
// Text(
// "+390498212410 X 12",
// style: TextStyle( // style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0), // fontWeight: FontWeight.bold, fontSize: 14.0),
// ), // ),
child: Text1( Text1(
title: title: "+390498212410 X 12",
"Via Giustiniani, 2, Padova, Veneto 35128, Italy",
txtcolor: Colors.black, txtcolor: Colors.black,
fontweight: FontWeight.bold, fontweight: FontWeight.bold,
txtfont: 14.0), txtfont: 14.0),
), ]),
]),
const SizedBox(
height: 8.0,
),
Row(children: [
const Icon(
Icons.phone,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox( const SizedBox(
width: 3.0, height: 8.0,
),
// Text(
// "+390498212410 X 12",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
Text1(
title: "+390498212410 X 12",
txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
]),
const SizedBox(
height: 8.0,
),
Row(children: [
const Icon(
Icons.call,
color: Color.fromARGB(255, 0, 71, 132),
), ),
Row(children: [
const Icon(
Icons.call,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
Text1(
title: "+390498212410 X 12",
txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
]),
const SizedBox( const SizedBox(
width: 3.0, height: 8.0,
), ),
Text1( Row(children: [
title: "+390498212410 X 12", const Icon(
txtcolor: Colors.black, Icons.email,
fontweight: FontWeight.bold, color: Color.fromARGB(255, 0, 71, 132),
txtfont: 14.0),
]),
const SizedBox(
height: 8.0,
),
Row(children: [
const Icon(
Icons.email,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
// Text(
// "Gerosa,Gino@gmail.com",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
Text1(
title: "Gerosa,Gino@gmail.com",
txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
]),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 18.0),
child: Card(
surfaceTintColor: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0),
clipBehavior: Clip.antiAlias,
color: Colors.white,
elevation: 5.0,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 1.0, vertical: 22.0),
child: Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Affliations",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Affliations",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
const SizedBox(
height: 5.0,
),
// Text(
// "75",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "75",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
), ),
Expanded( const SizedBox(
child: Column( width: 3.0,
children: <Widget>[
// Text(
// "Events",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Events",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
const SizedBox(
height: 5.0,
),
// Text(
// "0",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "0",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
), ),
Expanded( // Text(
child: Column( // "Gerosa,Gino@gmail.com",
children: <Widget>[ // style: TextStyle(
// Text( // fontWeight: FontWeight.bold, fontSize: 14.0),
// "Publications", // ),
// style: TextStyle( Text1(
// color: Color.fromARGB(255, 0, 71, 137), title: "Gerosa,Gino@gmail.com",
// fontSize: 13.0, txtcolor: Colors.black,
// fontWeight: FontWeight.bold, fontweight: FontWeight.bold,
// ), txtfont: 14.0),
// ), ]),
Text1( ],
title: "Publications",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
SizedBox(
height: 5.0,
),
// Text(
// "251",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "251",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Trails",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Trails",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
SizedBox(
height: 5.0,
),
// Text(
// "1",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "1",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
],
),
), ),
), ),
) Padding(
], padding: EdgeInsets.only(bottom: 18.0),
child: Card(
surfaceTintColor: Colors.white,
margin:
EdgeInsets.symmetric(horizontal: 15.0, vertical: 5.0),
clipBehavior: Clip.antiAlias,
color: Colors.white,
elevation: 5.0,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 1.0, vertical: 22.0),
child: Row(
children: <Widget>[
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Affliations",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Affliations",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
const SizedBox(
height: 5.0,
),
// Text(
// "75",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "75",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Events",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Events",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
const SizedBox(
height: 5.0,
),
// Text(
// "0",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "0",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Publications",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Publications",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
SizedBox(
height: 5.0,
),
// Text(
// "251",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "251",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
Expanded(
child: Column(
children: <Widget>[
// Text(
// "Trails",
// style: TextStyle(
// color: Color.fromARGB(255, 0, 71, 137),
// fontSize: 13.0,
// fontWeight: FontWeight.bold,
// ),
// ),
Text1(
title: "Trails",
txtcolor: Color.fromARGB(255, 0, 71, 137),
fontweight: FontWeight.bold,
txtfont: 13.0),
SizedBox(
height: 5.0,
),
// Text(
// "1",
// style: TextStyle(
// fontSize: 13.0,
// color: Color.fromARGB(255, 0, 71, 137),
// ),
// )
Text1(
title: "1",
txtfont: 13.0,
txtcolor: Color.fromARGB(255, 0, 71, 137),
)
],
),
),
],
),
),
),
)
],
),
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingActionButton(
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => FormList()));
},
foregroundColor: Colors.white,
backgroundColor: const Color.fromARGB(255, 0, 71, 132),
child: new Icon(Icons.add),
), ),
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingActionButton(
onPressed: () {
Navigator.push(
context, MaterialPageRoute(builder: (context) => FormList()));
},
foregroundColor: Colors.white,
backgroundColor: const Color.fromARGB(255, 0, 71, 132),
child: new Icon(Icons.add),
), ),
), ),
); );

View File

@ -1,5 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'dart:js_interop';
import 'package:discover_module/custom_widget/floating_btn.dart'; import 'package:discover_module/custom_widget/floating_btn.dart';
import 'package:discover_module/custom_widget/show_alert.dart'; import 'package:discover_module/custom_widget/show_alert.dart';
@ -19,8 +20,9 @@ class Ranking extends StatefulWidget {
} }
class _RankingState extends State<Ranking> { class _RankingState extends State<Ranking> {
late _DataSource _dataSource; // Instance variable for _DataSource late _DataSource _dataSource;
List<int> selectedno = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -28,146 +30,153 @@ class _RankingState extends State<Ranking> {
_dataSource = _DataSource(context); // Initialize _DataSource _dataSource = _DataSource(context); // Initialize _DataSource
} }
@override
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
body: ListView( child: Scaffold(
padding: const EdgeInsets.all(3), body: ListView(
children: [ padding: const EdgeInsets.all(3),
PaginatedDataTable( children: [
header: const Text( PaginatedDataTable(
'HCP RANKING', header: const Text(
style: TextStyle( 'HCP RANKING',
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal), fontSize: 18.0,
fontStyle: FontStyle.normal),
),
showFirstLastButtons: true,
showEmptyRows: false,
showCheckboxColumn: true,
actions: [
IconButton(
onPressed: () {
_createExcel();
},
icon: const Icon(Icons.download,
color: Color.fromARGB(255, 0, 71, 132)))
],
rowsPerPage: 5,
columns: const [
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Tier',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Score',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Event',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Affliations',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Publications',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Trails',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
],
source: _dataSource,
), ),
showFirstLastButtons: true, ],
showEmptyRows: false, ),
showCheckboxColumn: true, floatingActionButton: Visibility(
actions: [ visible: true,
IconButton( child: FloatingBtn(
onPressed: () { icon: Icons.add,
_createExcel(); title: "add",
}, onTap: () async {
icon: const Icon(Icons.download, List<int> selectedRowIds = _dataSource.getSelectedRowIds();
color: Color.fromARGB(255, 0, 71, 132))) // Do something with selectedRowIds
], print('Selected Row IDstrndsss: $selectedRowIds');
rowsPerPage: 5,
columns: const [
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Tier',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Score',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Event',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Affliations',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Publications',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
DataColumn(
label: FittedBox(
fit: BoxFit.scaleDown,
child: Text('Trails',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal)),
)),
],
source: _dataSource,
),
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingBtn(
icon: Icons.add,
title: "add",
onTap: () {
List<String> selectedRowIds = _dataSource.getSelectedRowIds();
// Do something with selectedRowIds
print('Selected Row IDstrndsss: $selectedRowIds');
for (int i = 0; i < selectedRowIds.length; i++) { for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}"); print('The id id : ${selectedRowIds[i]}');
// _contactbox.put(i, selectedRowIds[i]); print("checking_value_istrends: ${selectedRowIds[i]}");
HiveFunctions.createUser({ // selectedno.add(selectedRowIds[i]);
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova", HiveFunctions.addno(selectedRowIds[i]);
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12", // _contactbox.put(i, selectedRowIds[i]);
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com", HiveFunctions.createUser({
"affno": "75", "name": "Gerosa,Gino",
"eveno": "8", "org": "Azienda Ospedaliera di Padova",
"pubno": "251", "adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"trailno": "1" "phone": "+390498212410X12",
}); "Pphone": "+390498212410X12",
} "email": "Gerosa,Gino@gmail.com",
showDialog( "affno": "75",
context: context, "eveno": "8",
builder: (_) { "pubno": "251",
return Alert(data: "User Added Successfully"); "trailno": "1"
}); });
}, }
)), showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
});
},
)),
),
); );
} }
@ -291,6 +300,7 @@ class HiveFunctions {
// String userHiveBox="User Box"; // String userHiveBox="User Box";
// Box which will use to store the things // Box which will use to store the things
static final _contactbox = Hive.box("mycontact"); static final _contactbox = Hive.box("mycontact");
static var box1 = Hive.box('checkvalue');
static createUser(Map data) { static createUser(Map data) {
_contactbox.add(data); _contactbox.add(data);
@ -337,11 +347,35 @@ class HiveFunctions {
return data.reversed.toList(); 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 { class _Row {
_Row(this.identifier, this.valueA, this.valueC, this.valueD, this.valueE, _Row(
this.valueF, this.valueG, this.valueH, this.valueI); 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 int identifier;
final String valueA; final String valueA;
@ -360,17 +394,18 @@ class _DataSource extends DataTableSource {
final BuildContext context; final BuildContext context;
late List<_Row> _rows; late List<_Row> _rows;
// late List<int> _selectedRowsIndexes = []; // List to track selected rows // late List<int> _selectedRowsIndexes = []; // List to track selected rows
final List<String> _selectedRowIds = []; final List<int> _selectedRowIds = [];
_DataSource(this.context) { _DataSource(this.context) {
_rows = <_Row>[ _rows = <_Row>[
for (int i = 0; i < 20; i++) 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 return _selectedRowIds; // Return a copy to prevent direct modification
} }
@ -392,11 +427,11 @@ class _DataSource extends DataTableSource {
if (value) { if (value) {
print("Selected"); 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"); print("Selected_selectedRowIds :$_selectedRowIds");
} else { } else {
_selectedRowIds _selectedRowIds
.remove(row.valueA); // Remove the row ID from the list .remove(row.identifier); // Remove the row ID from the list
} }
notifyListeners(); notifyListeners();
@ -433,4 +468,17 @@ class _DataSource extends DataTableSource {
@override @override
int get selectedRowCount => _selectedCount; 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;
}
} }

View File

@ -23,114 +23,116 @@ class RisingStarState extends State<RisingStar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
body: ListView( child: Scaffold(
padding: const EdgeInsets.all(3), body: ListView(
children: [ padding: const EdgeInsets.all(3),
PaginatedDataTable( children: [
header: const Text( PaginatedDataTable(
'HCP RANKING', header: const Text(
style: TextStyle( 'HCP RANKING',
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal), fontSize: 18.0,
fontStyle: FontStyle.normal),
),
showFirstLastButtons: true,
showEmptyRows: false,
showCheckboxColumn: true,
// actions: const [Text("jii")],
rowsPerPage: 5,
columns: const [
DataColumn(
label: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Specialty',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Discover Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Indicator',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Previous year \n (2018-2022)',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Current year \n (2022-2024)',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Status',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _dataSource,
), ),
showFirstLastButtons: true, ],
showEmptyRows: false, ),
showCheckboxColumn: true, floatingActionButton: Visibility(
// actions: const [Text("jii")], visible: true,
rowsPerPage: 5, child: FloatingBtn(
columns: const [ icon: Icons.add,
DataColumn( title: "add",
label: Text('Name', onTap: () {
style: TextStyle( List<String> selectedRowIds = _dataSource.getSelectedRowIds();
fontWeight: FontWeight.bold, // Do something with selectedRowIds
fontSize: 14.0, print('Selected Row IDstrndsss: $selectedRowIds');
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Specialty',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Discover Rank',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Indicator',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Previous year \n (2018-2022)',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Current year \n (2022-2024)',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Status',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _dataSource,
),
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingBtn(
icon: Icons.add,
title: "add",
onTap: () {
List<String> selectedRowIds = _dataSource.getSelectedRowIds();
// Do something with selectedRowIds
print('Selected Row IDstrndsss: $selectedRowIds');
for (int i = 0; i < selectedRowIds.length; i++) { for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}"); print("checking_value_istrends: ${selectedRowIds[i]}");
// _contactbox.put(i, selectedRowIds[i]); // _contactbox.put(i, selectedRowIds[i]);
HiveFunctions.createUser({ HiveFunctions.createUser({
"name": selectedRowIds[i], "name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova", "org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy", "adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12", "phone": "+390498212410X12",
"Pphone": "+390498212410X12", "Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com", "email": "Gerosa,Gino@gmail.com",
"affno": "75", "affno": "75",
"eveno": "8", "eveno": "8",
"pubno": "251", "pubno": "251",
"trailno": "1" "trailno": "1"
});
}
showDialog(
context: context,
builder: (_) {
return Alert(
data: "User Added Successfully",
);
}); });
}, }
)), showDialog(
context: context,
builder: (_) {
return Alert(
data: "User Added Successfully",
);
});
},
)),
),
); );
} }
} }

View File

@ -22,88 +22,90 @@ class _TrendsState extends State<Trends> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return SafeArea(
body: ListView( child: Scaffold(
padding: const EdgeInsets.all(3), body: ListView(
children: [ padding: const EdgeInsets.all(3),
PaginatedDataTable( children: [
header: const Text( PaginatedDataTable(
'HCP RANKING', header: const Text(
style: TextStyle( 'HCP RANKING',
fontWeight: FontWeight.bold, style: TextStyle(
fontSize: 18.0, fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal), fontSize: 18.0,
fontStyle: FontStyle.normal),
),
showFirstLastButtons: true,
showEmptyRows: false,
showCheckboxColumn: true,
// actions: const [Text("jii")],
rowsPerPage: 5,
columns: const [
DataColumn(
label: Text('Name',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 5 Years',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 3 Years',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 1 Year',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _dataSource,
), ),
showFirstLastButtons: true, ],
showEmptyRows: false, ),
showCheckboxColumn: true, floatingActionButton: Visibility(
// actions: const [Text("jii")], visible: true,
rowsPerPage: 5, child: FloatingBtn(
columns: const [ icon: Icons.add,
DataColumn( title: "add",
label: Text('Name', onTap: () {
style: TextStyle( List<String> selectedRowIds = _dataSource.getSelectedRowIds();
fontWeight: FontWeight.bold, // Do something with selectedRowIds
fontSize: 14.0, print('Selected Row IDstrndsss: $selectedRowIds');
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 5 Years',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 3 Years',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
DataColumn(
label: Text('Last 1 Year',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.0,
fontStyle: FontStyle.normal))),
],
source: _dataSource,
),
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingBtn(
icon: Icons.add,
title: "add",
onTap: () {
List<String> selectedRowIds = _dataSource.getSelectedRowIds();
// Do something with selectedRowIds
print('Selected Row IDstrndsss: $selectedRowIds');
for (int i = 0; i < selectedRowIds.length; i++) { for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}"); print("checking_value_istrends: ${selectedRowIds[i]}");
// _contactbox.put(i, selectedRowIds[i]); // _contactbox.put(i, selectedRowIds[i]);
HiveFunctions.createUser({ HiveFunctions.createUser({
"name": selectedRowIds[i], "name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova", "org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy", "adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12", "phone": "+390498212410X12",
"Pphone": "+390498212410X12", "Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com", "email": "Gerosa,Gino@gmail.com",
"affno": "75", "affno": "75",
"eveno": "8", "eveno": "8",
"pubno": "251", "pubno": "251",
"trailno": "1" "trailno": "1"
});
}
showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
}); });
}, }
)), showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
});
},
)),
),
); );
} }
} }