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 box1 = await Hive.openBox('myfilter');
await Hive.openBox('checkvalue');
runApp(MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => InteractionProvider()),
@ -173,3 +175,62 @@ class _MyHomePageState extends State<MyHomePage> {
);
}
}
// import 'package:flutter/material.dart';
// class MyGridView extends StatefulWidget {
// @override
// _MyGridViewState createState() => _MyGridViewState();
// }
// class _MyGridViewState extends State<MyGridView> {
// List<List<String>> sections = [["Item 1", "Item 2", "Item 3"]];
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text('GridView Example'),
// ),
// body: Column(
// children: [
// Expanded(
// child: ListView.builder(
// itemCount: sections.length,
// itemBuilder: (context, index) {
// return GridView.count(
// shrinkWrap: true,
// crossAxisCount: 2,
// children: sections[index].map((item) {
// return Card(
// child: Center(
// child: Text(item),
// ),
// );
// }).toList(),
// );
// },
// ),
// ),
// ElevatedButton(
// onPressed: () {
// setState(() {
// sections.add(["Item 1", "Item 2", "Item 3"]);
// });
// },
// child: Icon(Icons.add),
// ),
// ],
// ),
// );
// }
// }
// void main() {
// runApp(MaterialApp(
// home: MyGridView(),
// ));
// }

View File

@ -29,118 +29,122 @@ class _ContactsState extends State<Contacts> {
print(
"Data_newww: ${HiveFunctions.getAllUsers()} ,${HiveFunctions.getAllUsers().length} ");
return Scaffold(
// appBar: AppBar(
// title: const Text('Contacts'),
// ),
body: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment
.center, // Align children to start and end of the row
return SafeArea(
child: Scaffold(
// appBar: AppBar(
// title: const Text('Contacts'),
// ),
body: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment
.center, // Align children to start and end of the row
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 45.0),
child: Text(
_switchValue ? "My Contacts" : "All Contacts",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
color: _switchValue ? Colors.black : Colors.black),
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 45.0),
child: Text(
_switchValue ? "My Contacts" : "All Contacts",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w500,
fontStyle: FontStyle.normal,
color: _switchValue ? Colors.black : Colors.black),
),
),
),
),
// Expanded(
Row(
// Adjust alignment as needed
mainAxisSize: MainAxisSize.min,
children: [
_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
// Expanded(
Row(
// Adjust alignment as needed
mainAxisSize: MainAxisSize.min,
children: [
_switchValue
? const Text(
'My',
'All',
style: TextStyle(
fontSize: 12,
decoration: TextDecoration.lineThrough,
decorationThickness: 0.85,
),
// TODO: implement dispose
)
: const Text('My',
: const Text('All',
style: TextStyle(
fontSize: 12,
)),
)
],
),
// ),
]),
Expanded(
child: ListView.builder(
itemCount: HiveFunctions.getAllUsers().length,
itemBuilder: (BuildContext context, int index) {
var data = HiveFunctions.getAllUsers()[index];
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(
'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(
children: [
ListTile(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => Profile()));
},
// title: Text(_contactbox.values.toString()),
leading: ProfilePicture(
name: data["name"],
radius: 20,
fontsize: 12,
return Column(
children: [
ListTile(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Profile()));
},
// title: Text(_contactbox.values.toString()),
leading: ProfilePicture(
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) {
return Consumer<InteractionProvider>(
builder: (BuildContext context, provider, Widget? child) {
return Scaffold(
appBar: AppBar(
title: Text(
'Interaction Forms',
//style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
),
automaticallyImplyLeading: false,
// backgroundColor: const Color(0xFF2b9af3),
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text(
'Interaction Forms',
//style: TextStyle(fontSize: isTablet ? 22 : 14, color: Colors.white),
),
automaticallyImplyLeading: false,
// backgroundColor: const Color(0xFF2b9af3),
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
),
),
body: Container(
child: Center(
child: ListView.builder(
itemCount: provider.intConfigDataList.length,
cacheExtent: double.parse(
provider.intConfigDataList.length.toString()),
itemBuilder: (context, index) {
return Column(
children: [
ListTile(
title: Row(
children: [
Text(
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),
body: Container(
child: Center(
child: ListView.builder(
itemCount: provider.intConfigDataList.length,
cacheExtent: double.parse(
provider.intConfigDataList.length.toString()),
itemBuilder: (context, index) {
return Column(
children: [
ListTile(
title: Row(
children: [
Text(
provider.intConfigDataList[index].name,
),
),
],
),
trailing: provider.savedList.indexWhere((element) =>
element.form ==
provider.intConfigDataList[index].name) !=
-1
? InkWell(
onTap: () {
if (getCount(
provider
.intConfigDataList[index].name,
provider) !=
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,
)));
}
const SizedBox(
width: 20,
),
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
InteractionScreen(
index: index,
form: 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),
),
icon: const Icon(
Icons.arrow_circle_right_outlined,
size: 30,
color: Color.fromARGB(255, 8, 39, 92),
),
)
: const SizedBox.shrink(),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
InteractionScreen(
index: index,
form: provider
.intConfigDataList[index].name,
)));
},
),
const Divider(),
],
);
})),
),
],
),
trailing: provider.savedList.indexWhere((element) =>
element.form ==
provider
.intConfigDataList[index].name) !=
-1
? InkWell(
onTap: () {
if (getCount(
provider.intConfigDataList[index]
.name,
provider) !=
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');
print("response1");
print("response1_isssss");
// print(response.data.toString());
log('${jsonEncode(response.data)}');
// log(jsonEncode(response.data));
final parsedJson = json.encode(response.data);
print(parsedJson);
return response.data;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -51,219 +51,229 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
FocusScope.of(context).requestFocus(FocusNode());
},
child: OrientationBuilder(builder: (context, orientation) {
return Scaffold(
//resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
widget.saveInteraction.id,
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,
return SafeArea(
child: Scaffold(
//resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text(
widget.saveInteraction.id,
style: TextStyle(
fontSize: isTablet ? 22 : 14, color: Colors.white),
),
),
),
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(),
],
),
),
]);
},
// backgroundColor: const Color(0xFF2b9af3),
automaticallyImplyLeading: false,
leading: InkWell(
onTap: () {
Navigator.pop(context);
},
child: const Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
// 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(
InteractionProvider provider,
String sectionName,
@ -382,77 +474,118 @@ class _ViewInteractionScreenState extends State<ViewInteractionScreen> {
Orientation orientation,
FormFieldData item,
int listIndex) {
List<SectionList> pooja = sectionList;
print("Pooja: $pooja");
List<List<SectionList>> convertedArray = [];
print("Provider Length: ${item.sectionList.length}");
for (int i = 0; i < sectionList.length; i += item.sectionList.length + 1) {
print("Section List11111: $sectionList");
print("item.sectionList.length List11111: ${item.sectionList.length}");
convertedArray
.add(sectionList.sublist(i, i + item.sectionList.length + 1));
}
print("ConvertedArrayEdit.leangth: $convertedArray");
print("ConvertedArray.leangth2323: ${convertedArray.length}");
return Padding(
padding: isTablet
? const EdgeInsets.only(left: 22.0)
: const EdgeInsets.only(left: 12.0, right: 12.0),
child: GridView.count(
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 ||
child: Column(
children: [
for (var i = 0; i < convertedArray.length; i++)
GridView.builder(
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: context.responsive<int>(
1, // default
sm: 1, // small
md: 1, // medium
lg: sectionList.length == 1 ? 1 : 4, // large
xl: 5, // extra large screen
),
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,
itemCount: convertedArray[i].length,
itemBuilder: (context, index) {
// children: List.generate(
// sectionList.length,
// (i) {
// print(sectionList);
// SectionList sectionItem = sectionList[i];
// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
// ? sectionItem.value ?? "Select"
// : ' ';
// List<InputClass> list =
// sectionItem.widget == InteractionWidget.DROPDOWN ||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
// sectionItem.widget == InteractionWidget.MULTISELECT
// ? provider.getData2(sectionItem)
// : [];
// provider.checkboxlist =
// sectionItem.widget == InteractionWidget.CHECKBOX
// ? provider.getData2(sectionItem)
// : [];
SectionList sectionItem = convertedArray[i][index];
dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN
? sectionItem.value ?? "Select"
: ' ';
List<InputClass> list = sectionItem.widget ==
InteractionWidget.DROPDOWN ||
sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
sectionItem.widget == InteractionWidget.MULTISELECT
? provider.getData2(sectionItem)
: [];
provider.checkboxlist =
sectionItem.widget == InteractionWidget.CHECKBOX
? 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,
return SizedBox(
height: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sectionItem.widget == InteractionWidget.BUTTON &&
sectionItem.param == 'add' ||
sectionItem.param == 'deletebtn'
? const SizedBox.shrink()
: Text(
'${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!),
],
),
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!) {
obj.gid = obj.gid ?? item.multipleList!.length;
if (obj.widget == InteractionWidget.TEXT) {
debugPrint("textcontr:${obj.gid}");
debugPrint("textcontr:${obj.selectedValue}");
// debugPrint("textcontr:${obj.controller!.value}");
var textEditingController = TextEditingController();
textEditingController.value = TextEditingValue(
text: obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last ?? ""
: "");
textEditingController.text = obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last ?? ""
: "";
multipletextEditingControllerList.add(textEditingController);
obj.controller = multipletextEditingControllerList.last;
// obj.controller!.value = textEditingController.value;
obj.controller = textEditingController;
// obj.controller = obj.selectedValue.last ?? " ";
}
if (obj.widget == InteractionWidget.DROPDOWN ||
@ -608,6 +617,23 @@ class ViewInteractionProvider extends ChangeNotifier {
// if (interactionReponseList[index].multipleList!.isEmpty) {
// newList = addList;
// } else {
if (addList.isNotEmpty) {
for (SectionList obj in addList) {
// obj.gid = obj.gid ?? addList.length;
if (obj.widget == InteractionWidget.TEXT) {
var textEditingController = TextEditingController();
multipletextEditingControllerList.add(textEditingController);
obj.controller = multipletextEditingControllerList.last;
obj.controller!.text =
obj.selectedValue != null && obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last
: '';
}
// newList.add(obj);
}
}
if (interactionReponseList[index].multipleList == null) {
interactionReponseList[index].multipleList = addList;
} else {
@ -622,10 +648,6 @@ class ViewInteractionProvider extends ChangeNotifier {
for (SectionList obj in interactionReponseList[index].multipleList!) {
obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
if (obj.widget == InteractionWidget.TEXT) {
var textEditingController = TextEditingController();
multipletextEditingControllerList.add(textEditingController);
obj.controller = multipletextEditingControllerList.last;
obj.controller!.text =
obj.selectedValue != null && obj.selectedValue!.isNotEmpty
? obj.selectedValue!.last
@ -653,6 +675,14 @@ class ViewInteractionProvider extends ChangeNotifier {
saveJsonObject(BuildContext context, String form,
SaveInteraction saveInteraction) async {
for (var res in interactionReponseList) {
for (var sec in res.sectionList) {
debugPrint("print ${sec.selectedValue}");
}
for (var sec in res.multipleList!) {
debugPrint("printmultiple ${sec.selectedValue}");
}
}
List<FormFieldData> resultData = interactionReponseList
.map((e) => FormFieldData(
multipleList: e.multipleList == null
@ -793,3 +823,814 @@ class ViewInteractionProvider extends ChangeNotifier {
return false;
}
}
// import 'dart:convert';
// import 'package:dio/dio.dart';
// import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
// import 'package:discover_module/ui_screen/interactionform/model/interaction_config_data.dart';
// import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart';
// import 'package:discover_module/ui_screen/interactionform/model/json_form_data.dart';
// import 'package:discover_module/ui_screen/interactionform/model/location_model.dart';
// import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
// import 'package:discover_module/ui_screen/interactionform/repository/hive_repository.dart';
// import 'package:flutter/cupertino.dart';
// import 'package:flutter/services.dart';
// import 'package:hive_flutter/hive_flutter.dart';
// class ViewInteractionProvider extends ChangeNotifier {
// List<FormFieldData> interactionReponseList = [];
// // List<dynamic> sectionList = [];
// List<SectionList> sectionList = [];
// late Location locationList;
// List<TextEditingController> textEditingControllerList = [];
// List<TextEditingController> multipletextEditingControllerList = [];
// int textfieldIndex = 0;
// List<Country> countryList = [];
// List<States> stateList = [];
// List<City> cityList = [];
// List<InputClass> checkboxlist = [];
// String selectedCountry = 'Selected Country';
// String radioValue = '';
// bool checkboxValue = false;
// late SaveInteraction saveInteraction;
// List<SaveData> saveData = [];
// List<SectionList> newList = [];
// String sectionName = '';
// late String selectedCity = 'Selected City', selectedState = 'Selected State';
// String customdropdownValue = '';
// String? selectedValue;
// List<String> selectedItems = [];
// InputClass? selectedObj;
// List<SaveInteraction> savedList = [];
// List<InteractionConfigData> intConfigDataList = [];
// String? intId, intName;
// final HiveDataRepository _hiveprovider = HiveDataRepository(
// Hive.box<InteractionConfigData>('InteractionConfigDataBox'));
// late final InteractionProvider interactionProvider;
// initConfigData() async {
// intConfigDataList = _hiveprovider.getAllDataFromHive();
// notifyListeners();
// }
// Future<void> getRecords(String formname) async {
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
// savedList = box.values.toList();
// savedList = savedList
// .where(
// (element) => element.form == formname,
// )
// .toList();
// notifyListeners();
// }
// Future<List<SaveInteraction>> getAllRecords() async {
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
// List<SaveInteraction> savedList = box.values.toList();
// return savedList;
// }
// init(int index) async {
// // _hiveprovider = HiveDataRepository(
// // Hive.box<InteractionConfigData>('InteractionConfigDataBox'));
// // intConfigDataList = _hiveprovider.getAllDataFromHive();
// InteractionConfigData interactionConfigData = intConfigDataList[index];
// intId = intConfigDataList[index].id;
// intName = intConfigDataList[index].name;
// print("data $intConfigDataList");
// // await fetchSaveDataJson();
// // await fetchDataSet();
// await fetchData(interactionConfigData.widgets);
// await fetchLocationData();
// }
// initSavedForm(SaveInteraction saveInteractiondata) {
// intConfigDataList
// .indexWhere((element) => element.id == saveInteractiondata.intId);
// interactionReponseList = saveInteractiondata.save
// .map((e) => FormFieldData(
// multipleList: e.multipleList == null
// ? []
// : e.multipleList!
// .map((mobj) => SectionList(
// depid: mobj.depid,
// id: mobj.id,
// inputList: mobj.inputList,
// isRequired: mobj.isRequired,
// extension: mobj.extension,
// fileName: mobj.fileName,
// selectedObject: mobj.selectedObject,
// name: mobj.name,
// param: mobj.param,
// selectedValue: mobj.selectedValue,
// widget: mobj.widget,
// controller: mobj.controller,
// gid: mobj.gid,
// input: mobj.input,
// selectedId: mobj.selectedId,
// value: mobj.value))
// .toList(),
// sectionList: e.sectionList
// .map((obj) => SectionList(
// depid: obj.depid,
// id: obj.id,
// inputList: obj.inputList,
// isRequired: obj.isRequired,
// extension: obj.extension,
// fileName: obj.fileName,
// name: obj.name,
// param: obj.param,
// selectedObject: obj.selectedObject,
// selectedValue: obj.selectedValue,
// widget: obj.widget,
// controller: obj.controller,
// gid: obj.gid,
// input: obj.input,
// selectedId: obj.selectedId,
// value: obj.value))
// .toList(),
// sectionName: e.sectionName,
// multiple: e.multiple))
// .toList();
// textEditingControllerList.clear();
// for (var item in interactionReponseList) {
// sectionList = item.sectionList;
// for (SectionList obj in item.multipleList!) {
// obj.gid = obj.gid ?? item.multipleList!.length;
// if (obj.widget == InteractionWidget.TEXT) {
// var textEditingController = TextEditingController();
// textEditingController.value = TextEditingValue(
// text: obj.selectedValue!.isNotEmpty
// ? obj.selectedValue!.last ?? ""
// : "");
// textEditingController.text = obj.selectedValue!.isNotEmpty
// ? obj.selectedValue!.last ?? ""
// : "";
// multipletextEditingControllerList.add(textEditingController);
// // obj.controller = multipletextEditingControllerList.last;
// obj.controller = textEditingController;
// }
// if (obj.widget == InteractionWidget.DROPDOWN ||
// obj.widget == InteractionWidget.AUTOCOMPLETE ||
// obj.widget == InteractionWidget.MULTISELECT) {
// List<InputClass> list = obj.inputList!;
// if (obj.selectedObject != null) {
// } else {
// obj.selectedObject = obj.selectedValue!.isNotEmpty
// ? getDataObject(obj.id, obj.selectedValue!.last, list)
// : list[0];
// }
// print("value : ${list.first.name} ");
// }
// if (obj.widget == InteractionWidget.CHECKBOX) {
// List<String> selectedvalues = [];
// if (obj.selectedValue!.isNotEmpty) {
// for (var id in obj.selectedValue!) {
// int ind =
// obj.inputList!.indexWhere((element) => element.id == id);
// if (ind != -1) {
// obj.inputList![ind].ischecked = true;
// selectedvalues.add(obj.inputList![ind].name);
// }
// }
// }
// }
// if (obj.widget == InteractionWidget.RADIO) {
// List<InputClass> list = obj.inputList!;
// if (obj.selectedValue!.isNotEmpty) {
// int ind = list
// .indexWhere((element) => element.id == obj.selectedValue!.last);
// if (ind != -1) {
// obj.inputList![ind].ischecked = true;
// radioValue = obj.inputList![ind].name;
// }
// }
// }
// // newList.add(obj);
// }
// for (var sectionItem in item.sectionList) {
// if (sectionItem.widget == InteractionWidget.TEXT) {
// var textEditingController = TextEditingController();
// textEditingController.text = sectionItem.selectedValue!.isNotEmpty
// ? sectionItem.selectedValue!.last ?? " "
// : " ";
// textEditingControllerList.add(textEditingController);
// sectionItem.controller = textEditingControllerList.last;
// }
// if (sectionItem.widget == InteractionWidget.DROPDOWN) {
// List<InputClass> list = sectionItem.inputList!;
// if (sectionItem.selectedObject != null) {
// print("#######not null");
// } else {
// print("#######is_null");
// if (sectionItem.selectedValue == null) {
// print("#######is_null#####");
// } else {
// print('###${sectionItem.selectedValue}');
// }
// sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty
// ? getDataObject(
// sectionItem.id, sectionItem.selectedValue!.last, list)
// : list[0];
// }
// print("valuesssss : ${sectionItem.selectedObject!.name} ");
// }
// if (sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
// sectionItem.widget == InteractionWidget.MULTISELECT) {
// List<InputClass> list = sectionItem.inputList!;
// if (sectionItem.selectedObject != null) {
// } else {
// sectionItem.selectedObject = sectionItem.selectedValue!.isNotEmpty
// ? getDataObject(
// sectionItem.id, sectionItem.selectedValue!.last, list)
// : list[0];
// }
// print("value : ${list.first.name} ");
// }
// if (sectionItem.widget == InteractionWidget.CHECKBOX) {
// List<String> selectedvalues = [];
// if (sectionItem.selectedValue!.isNotEmpty) {
// for (var id in sectionItem.selectedValue!) {
// int ind = sectionItem.inputList!
// .indexWhere((element) => element.id == id);
// if (ind != -1) {
// sectionItem.inputList![ind].ischecked = true;
// selectedvalues.add(sectionItem.inputList![ind].name);
// }
// }
// }
// }
// if (sectionItem.widget == InteractionWidget.RADIO) {
// List<InputClass> list = sectionItem.inputList!;
// if (sectionItem.selectedValue!.isNotEmpty) {
// int ind = list.indexWhere(
// (element) => element.id == sectionItem.selectedValue!.last);
// if (ind != -1) {
// sectionItem.inputList![ind].ischecked = true;
// radioValue = sectionItem.inputList![ind].name;
// }
// }
// }
// if (sectionItem.widget == InteractionWidget.BUTTON &&
// sectionItem.param == 'chooseFile' &&
// sectionItem.selectedValue!.isNotEmpty) {
// print("choosed file");
// print(sectionItem.selectedValue!.last);
// }
// }
// }
// print(interactionReponseList);
// print("check textcontrollers ${textEditingControllerList.length}");
// }
// Future<String> fetchDataSet() async {
// List<InputClass> list = getData("intlocation_1");
// print(list);
// return "success";
// }
// List<InputClass> getData(String widgetId) {
// List<InputClass> list = [];
// return list;
// }
// InputClass getDataObject(String widgetId, String id, List<InputClass> list) {
// // if (id != "") {
// // List<InputClass> list = [];
// InputClass value = InputClass(id: '', name: '');
// if (list.isNotEmpty) {
// int index = list.indexWhere((element) => element.id.toString() == id);
// if (index != -1) {
// value = list[index];
// }
// }
// return value;
// }
// // TODO: Search for widget with depid and check if selected is not null and by selected id get the data of current widget
// List<InputClass> getData2(SectionList sectionItem) {
// List<InputClass> list = [];
// // if (sectionItem.inputList != null) {
// list = sectionItem.inputList!;
// if (sectionItem.depid != "") {
// // print("check depid : ${sectionItem.depid}");
// int i = 0;
// for (var obj in interactionReponseList) {
// i = obj.sectionList
// .indexWhere((element) => element.id == sectionItem.depid);
// // print("check depid index: $i");
// if (i != -1) {
// //print("check depid value: ${obj.sectionList[i].value}");
// if (obj.sectionList[i].value != null) {
// if (list
// .where((element) => element.pid == obj.sectionList[i].value)
// .isNotEmpty) {
// list = list
// .where((element) => element.pid == obj.sectionList[i].value)
// .toList();
// sectionItem.selectedObject = list[0];
// } else {
// // InputClass obj = InputClass(
// // id: "obj.sectionList[i].value",
// // name: "Select ${sectionItem.name}");
// list = [];
// // list.add(obj);
// sectionItem.selectedObject = null;
// }
// } else {
// // int index = obj.sectionList
// // .indexWhere((element) => element.id == sectionItem.id);
// // list = obj.sectionList[index].inputList;
// }
// }
// }
// // int index = data[i].data.indexWhere((element) => element.)
// }
// // }
// print("I_am_Returning_list: $list");
// return list;
// }
// setDropDownValue(String value, SectionList sectionItem, bool multiple,
// InputClass selectedObject) {
// int i = 0;
// for (var obj in interactionReponseList) {
// if (multiple && obj.multipleList != null) {
// i = obj.multipleList!.indexWhere((element) =>
// element.id == sectionItem.id && element.gid == sectionItem.gid);
// if (i != -1) {
// obj.multipleList![i].value = value;
// obj.multipleList![i].tempselectedValue = [];
// obj.multipleList![i].tempselectedValue!.add(value);
// // obj.multipleList![i].selectedObject = selectedObj;
// }
// } else {
// i = obj.sectionList
// .indexWhere((element) => element.id == sectionItem.id);
// if (i != -1) {
// obj.sectionList[i].value = value;
// obj.sectionList[i].tempselectedValue = [];
// obj.sectionList[i].tempselectedValue!.add(value);
// // obj.sectionList[i].selectedObject = selectedObj;
// }
// }
// }
// notifyListeners();
// }
// Future<void> disposeValues() async {
// print("dispose called");
// // await _hiveprovider.closeHiveBox();
// for (var obj in interactionReponseList) {
// obj.multipleList!.clear();
// // for (var obj2 in obj.sectionList) {
// // obj2.selectedObject = null;
// // }
// obj.sectionList.clear();
// }
// interactionReponseList.clear();
// }
// setTextValue(String value, SectionList sectionItem, bool multiple) {
// int i = 0;
// for (var obj in interactionReponseList) {
// if (multiple && obj.multipleList != null) {
// i = obj.multipleList!.indexWhere((element) =>
// element.id == sectionItem.id && element.gid == sectionItem.gid);
// if (i != -1) {
// obj.multipleList![i].value = value;
// obj.multipleList![i].selectedValue!.add(value);
// }
// } else {
// i = obj.sectionList
// .indexWhere((element) => element.id == sectionItem.id);
// if (i != -1) {
// obj.sectionList[i].value = value;
// obj.sectionList[i].selectedValue!.add(value);
// }
// }
// }
// notifyListeners();
// }
// setAutoCompleteValue(String value, SectionList sectionItem, bool multiple) {
// int i = 0;
// for (var obj in interactionReponseList) {
// if (multiple && obj.multipleList != null) {
// i = obj.multipleList!.indexWhere((element) =>
// element.id == sectionItem.id && element.gid == sectionItem.gid);
// if (i != -1) {
// obj.multipleList![i].value = value;
// obj.multipleList![i].tempselectedValue = [];
// obj.multipleList![i].tempselectedValue!.add(value);
// }
// } else {
// i = obj.sectionList
// .indexWhere((element) => element.id == sectionItem.id);
// if (i != -1) {
// obj.sectionList[i].value = value;
// obj.sectionList[i].tempselectedValue = [];
// obj.sectionList[i].tempselectedValue!.add(value);
// }
// }
// }
// notifyListeners();
// }
// String getDropDownValue(
// String value, SectionList sectionItem, List<InputClass> list) {
// int i = 0;
// String svalue = '';
// i = list.indexWhere((element) => element.id == value);
// if (i != -1) {
// svalue = list[i].name;
// } else {
// svalue = list[0].name;
// }
// return svalue;
// }
// Future<String> fetchData(InteractionResultData interactionResultData) async {
// InteractionResultData interactionConfig = interactionResultData;
// print("itemCategoryModel Item = + ${interactionConfig.result}");
// interactionReponseList = interactionConfig.result;
// print("check stored: $interactionReponseList");
// textEditingControllerList.clear();
// for (var item in interactionReponseList) {
// sectionList = item.sectionList;
// for (var sectionItem in item.sectionList) {
// if (sectionItem.widget == InteractionWidget.TEXT) {
// var textEditingController = TextEditingController();
// textEditingControllerList.add(textEditingController);
// sectionItem.controller = textEditingControllerList.last;
// }
// if (sectionItem.widget == InteractionWidget.DROPDOWN ||
// sectionItem.widget == InteractionWidget.AUTOCOMPLETE ||
// sectionItem.widget == InteractionWidget.MULTISELECT) {
// List<InputClass> list = sectionItem.inputList!;
// sectionItem.value = list[0].name;
// print("value : ${list.first} ");
// }
// }
// }
// print(interactionReponseList);
// print("check textcontrollers ${textEditingControllerList.length}");
// return "success";
// }
// Future<String> fetchLocationData() async {
// var data =
// await rootBundle.loadString("assets/images/locationdetailsform.json");
// Locations loc =
// Locations(location: Location.fromJson(json.decode(data)["location"]));
// locationList = loc.location;
// countryList = locationList.country;
// stateList = locationList.state;
// cityList = locationList.city;
// print(locationList);
// notifyListeners();
// return "success";
// }
// List<States> getState(String cid) {
// List<States> states =
// stateList.where((element) => element.countryId == cid).toList();
// return states;
// }
// List<City> getCity(String sid) {
// List<City> city =
// cityList.where((element) => element.stateId == sid).toList();
// return city;
// }
// String getCountryId(String name) {
// if (countryList.isNotEmpty) {
// int i = countryList.indexWhere((element) => element.countryName == name);
// return countryList[i].countryId;
// }
// return '';
// }
// String getStateId(String name) {
// if (stateList.isNotEmpty) {
// int i = stateList.indexWhere((element) => element.stateName == name);
// return stateList[i].stateId;
// }
// return '';
// }
// String getCityId(String name) {
// if (cityList.isNotEmpty) {
// int i = cityList.indexWhere((element) => element.cityName == name);
// return cityList[i].distId;
// }
// return '';
// }
// setRadioValue(SectionList sectionItem) {
// List<InputClass> list = (sectionItem.input as List)
// .map((itemWord) => InputClass.fromJson(itemWord))
// .toList();
// radioValue = list[0].name;
// notifyListeners();
// }
// setcheckBoxValue(SectionList sectionItem, String sectionName, bool newValue,
// String id, bool multiple) {
// int index =
// sectionItem.inputList!.indexWhere((element) => element.id == id);
// sectionItem.inputList![index].ischecked = newValue;
// // sectionItem.selectedValue.add(data[i].data[index].id);
// int index2 = 0;
// for (var obj in interactionReponseList) {
// if (multiple && obj.multipleList != null) {
// index2 = obj.multipleList!.indexWhere((element) =>
// element.id == sectionItem.id && element.gid == sectionItem.gid);
// if (index2 != -1) {
// obj.multipleList![index2].value = sectionItem.inputList![index].id;
// obj.multipleList![index2].selectedValue!
// .add(sectionItem.inputList![index].id);
// }
// } else {
// index2 = obj.sectionList
// .indexWhere((element) => element.id == sectionItem.id);
// if (index2 != -1) {
// obj.sectionList[index2].value = sectionItem.inputList![index].id;
// obj.sectionList[index2].selectedValue!
// .add(sectionItem.inputList![index].id);
// }
// }
// }
// notifyListeners();
// }
// getSectionItem(String sectionName) {
// newList = [];
// List<SectionList> addList = [];
// int index = interactionReponseList
// .indexWhere((element) => element.sectionName == sectionName);
// addList = interactionReponseList[index]
// .sectionList
// .map((e) => SectionList(
// depid: e.depid,
// id: e.id,
// inputList: e.inputList,
// isRequired: e.isRequired,
// name: e.name,
// param: e.param,
// selectedValue: [],
// widget: e.widget,
// controller: e.controller,
// gid: e.gid,
// input: e.input,
// selectedId: e.selectedId,
// value: e.value))
// .toList();
// SectionList delItem = SectionList(
// name: "delete",
// param: "deletebtn",
// id: "deletebtn",
// selectedValue: [],
// depid: "",
// widget: InteractionWidget.BUTTON,
// inputList: [],
// isRequired: true);
// addList.add(delItem);
// // if (interactionReponseList[index].multipleList!.isEmpty) {
// // newList = addList;
// // } else {
// if (interactionReponseList[index].multipleList == null) {
// interactionReponseList[index].multipleList = addList;
// } else {
// interactionReponseList[index].multipleList =
// interactionReponseList[index].multipleList! + addList;
// }
// newList = interactionReponseList[index].multipleList!;
// // newList = newList + addList;
// // }
// if (interactionReponseList[index].multipleList != null) {
// for (SectionList obj in interactionReponseList[index].multipleList!) {
// obj.gid = obj.gid ?? interactionReponseList[index].multipleList!.length;
// if (obj.widget == InteractionWidget.TEXT) {
// var textEditingController = TextEditingController();
// multipletextEditingControllerList.add(textEditingController);
// obj.controller = multipletextEditingControllerList.last;
// obj.controller!.text =
// obj.selectedValue != null && obj.selectedValue!.isNotEmpty
// ? obj.selectedValue!.last
// : '';
// }
// // newList.add(obj);
// }
// }
// print(
// "check length : ${interactionReponseList[index].multipleList!.length}");
// notifyListeners();
// }
// deleteMultipleRows(
// int gid, SectionList sectionItem, String selectedSectionName) {
// int index = interactionReponseList
// .indexWhere((element) => element.sectionName == selectedSectionName);
// interactionReponseList[index]
// .multipleList!
// .removeWhere((item) => item.gid == gid);
// notifyListeners();
// }
// saveJsonObject(BuildContext context, String form,
// SaveInteraction saveInteraction) async {
// List<FormFieldData> resultData = interactionReponseList
// .map((e) => FormFieldData(
// multipleList: e.multipleList == null
// ? []
// : e.multipleList!
// .map((mobj) => SectionList(
// depid: mobj.depid,
// id: mobj.id,
// inputList: mobj.inputList,
// isRequired: mobj.isRequired,
// extension: mobj.extension,
// fileName: mobj.fileName,
// name: mobj.name,
// param: mobj.param,
// selectedValue:
// mobj.tempselectedValue ?? mobj.selectedValue,
// widget: mobj.widget,
// gid: mobj.gid,
// input: mobj.input,
// selectedId: mobj.selectedId,
// value: mobj.value))
// .toList(),
// sectionList: e.sectionList
// .map((obj) => SectionList(
// depid: obj.depid,
// id: obj.id,
// inputList: obj.inputList,
// extension: obj.extension,
// fileName: obj.fileName,
// isRequired: obj.isRequired,
// name: obj.name,
// param: obj.param,
// selectedValue: obj.tempselectedValue ?? obj.selectedValue,
// widget: obj.widget,
// controller: obj.controller,
// gid: obj.gid,
// input: obj.input,
// selectedId: obj.selectedId,
// value: obj.value))
// .toList(),
// sectionName: e.sectionName,
// multiple: e.multiple,
// ))
// .toList();
// final data = SaveInteraction(
// save: resultData,
// id: saveInteraction.id,
// updatedTime: DateTime.now().toString(),
// form: saveInteraction.form,
// intId: saveInteraction.intId,
// intName: saveInteraction.intName,
// );
// var box = Hive.box<SaveInteraction>('InteractionDataBox');
// if (!box.isOpen) {
// box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
// }
// int index =
// box.values.toList().indexWhere((element) => element.id == data.id);
// box.putAt(index, data);
// await getRecords(saveInteraction.form!);
// // box.close();
// // await MockApiCall().postFormData(data);
// }
// Future<void> deleteRecord(SaveInteraction saveInteraction) async {
// var box = await Hive.openBox<SaveInteraction>('InteractionDataBox');
// final Map<dynamic, SaveInteraction> deliveriesmap = box.toMap();
// dynamic deleteKey;
// deliveriesmap.forEach((key, value) {
// if (value.id == saveInteraction.id) {
// deleteKey = key;
// }
// });
// box.delete(deleteKey);
// await getRecords(saveInteraction.form!);
// //box.close();
// }
// List<MultipleSectionList> getModifiedList(List<SectionList> sectionList) {
// List<MultipleSectionList> newSectionList = [];
// for (var obj in sectionList) {
// if (obj.id != 'deletebtn') {
// if (obj.id == 'chooseFile') {
// List<MultipartFile> files = [];
// if (obj.selectedValue!.isNotEmpty && obj.selectedValue != null) {
// for (var file in obj.selectedValue!) {
// files.add(MultipartFile.fromFileSync(file));
// }
// }
// MultipleSectionList newobj = MultipleSectionList(
// id: obj.id,
// selectedValue: files,
// );
// newSectionList.add(newobj);
// } else {
// MultipleSectionList newobj = MultipleSectionList(
// id: obj.id,
// selectedValue: obj.selectedValue!,
// );
// newSectionList.add(newobj);
// }
// }
// }
// return newSectionList;
// }
// bool validateMultipleRows() {
// for (var obj in interactionReponseList) {
// if (obj.multipleList != null) {
// for (var mulobj in obj.multipleList!) {
// if (mulobj.widget == InteractionWidget.TEXT) {
// if (mulobj.controller!.text.isEmpty) {
// return true;
// }
// }
// }
// }
// }
// return false;
// }
// bool validateTextFields() {
// for (var obj in interactionReponseList) {
// for (var mulobj in obj.sectionList) {
// if (mulobj.widget == InteractionWidget.TEXT) {
// if (mulobj.controller!.text.isEmpty) {
// return true;
// }
// }
// }
// }
// return false;
// }
// }

View File

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

View File

@ -8,82 +8,84 @@ class DataTableDemo extends StatefulWidget {
class _DataTableDemoState extends State<DataTableDemo> {
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
fontStyle: FontStyle.normal),
return SafeArea(
child: Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
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> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Form List"),
),
body: ListView(
children: [
ListTile(
title: const Text(
"Add My Event",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text("Form List"),
),
body: ListView(
children: [
ListTile(
title: const Text(
"Add My Event",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIData123();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => AddEventScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
Divider(),
ListTile(
title: const Text(
"Interaction",
style: TextStyle(fontSize: 18.0),
await configDataProvider.initConfigUIData123();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => AddEventScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
onTap: () async {
print("I am Interaction");
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
Divider(),
ListTile(
title: const Text(
"Interaction",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
print("I am Interaction");
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIData();
// Navigator.push(context, MaterialPageRoute(builder: (context)))=> InteractionScreen();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InteractionListScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
const Divider(),
ListTile(
title: const Text(
"New Medical Insight",
style: TextStyle(fontSize: 18.0),
await configDataProvider.initConfigUIData();
// Navigator.push(context, MaterialPageRoute(builder: (context)))=> InteractionScreen();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => InteractionListScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
const Divider(),
ListTile(
title: const Text(
"New Medical Insight",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIDataMedical();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
},
trailing: Icon(Icons.arrow_forward_ios),
),
Divider(),
ListTile(
title: const Text(
"Engagement",
style: TextStyle(fontSize: 18.0),
await configDataProvider.initConfigUIDataMedical();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
},
trailing: Icon(Icons.arrow_forward_ios),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIDataEng();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const InteractionListScreen()));
},
trailing: const Icon(Icons.arrow_forward_ios),
),
Divider(),
],
Divider(),
ListTile(
title: const Text(
"Engagement",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIDataEng();
Navigator.push(
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> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Profile'),
actions: const [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("View Similar"),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Request Profile"),
)
],
),
body: ListView(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: [
const Padding(
padding: EdgeInsets.all(10.0),
child: ProfilePicture(
name: 'Gerosa, Gino',
radius: 31,
fontsize: 21,
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: const Text('Profile'),
actions: const [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("View Similar"),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Request Profile"),
)
],
),
body: ListView(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: [
const Padding(
padding: EdgeInsets.all(10.0),
child: ProfilePicture(
name: 'Gerosa, Gino',
radius: 31,
fontsize: 21,
),
),
),
Column(
children: [
// Text(
// "Gerosa, Gino",
// style: TextStyle(
// fontSize: 22.0,
// color: Colors.black,
// ),
// ),
Text1(
title: "Gerosa, Gino",
txtcolor: Colors.black,
txtfont: 22.0),
// Text(
// "Cardiac Surgery",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
Text1(
title: "Cardiac Surgery",
Column(
children: [
// Text(
// "Gerosa, Gino",
// style: TextStyle(
// fontSize: 22.0,
// color: Colors.black,
// ),
// ),
Text1(
title: "Gerosa, Gino",
txtcolor: Colors.black,
txtfont: 22.0),
// Text(
// "Cardiac Surgery",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
Text1(
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,
txtfont: 14.0,
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,
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(
// "Azienda Ospedaliera di Padova",
// "Via Giustiniani, 2, Padova, Veneto 35128, Italy",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
child: Text1(
title: "Azienda Ospedaliera di Padova",
txtcolor: Colors.black,
txtfont: 14.0,
fontweight: FontWeight.bold,
)),
]),
const SizedBox(
height: 8.0,
),
Row(children: [
const Icon(
Icons.location_pin,
color: Color.fromARGB(255, 0, 71, 132),
),
title:
"Via Giustiniani, 2, Padova, Veneto 35128, Italy",
txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
),
]),
const SizedBox(
width: 3.0,
height: 8.0,
),
Expanded(
// child: Text(
// "Via Giustiniani, 2, Padova, Veneto 35128, Italy",
Row(children: [
const Icon(
Icons.phone,
color: Color.fromARGB(255, 0, 71, 132),
),
const SizedBox(
width: 3.0,
),
// Text(
// "+390498212410 X 12",
// style: TextStyle(
// fontWeight: FontWeight.bold, fontSize: 14.0),
// ),
child: Text1(
title:
"Via Giustiniani, 2, Padova, Veneto 35128, Italy",
Text1(
title: "+390498212410 X 12",
txtcolor: Colors.black,
fontweight: FontWeight.bold,
txtfont: 14.0),
),
]),
const SizedBox(
height: 8.0,
),
Row(children: [
const Icon(
Icons.phone,
color: Color.fromARGB(255, 0, 71, 132),
),
]),
const SizedBox(
width: 3.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),
height: 8.0,
),
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(
width: 3.0,
height: 8.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.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),
)
],
),
Row(children: [
const Icon(
Icons.email,
color: Color.fromARGB(255, 0, 71, 132),
),
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),
)
],
),
const SizedBox(
width: 3.0,
),
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),
)
],
),
),
],
),
// 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(
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:io';
import 'dart:js_interop';
import 'package:discover_module/custom_widget/floating_btn.dart';
import 'package:discover_module/custom_widget/show_alert.dart';
@ -19,8 +20,9 @@ class Ranking extends StatefulWidget {
}
class _RankingState extends State<Ranking> {
late _DataSource _dataSource; // Instance variable for _DataSource
late _DataSource _dataSource;
List<int> selectedno = [];
@override
void initState() {
super.initState();
@ -28,146 +30,153 @@ class _RankingState extends State<Ranking> {
_dataSource = _DataSource(context); // Initialize _DataSource
}
@override
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
fontStyle: FontStyle.normal),
return SafeArea(
child: Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
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,
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,
),
],
),
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');
],
),
floatingActionButton: Visibility(
visible: true,
child: FloatingBtn(
icon: Icons.add,
title: "add",
onTap: () async {
List<int> selectedRowIds = _dataSource.getSelectedRowIds();
// Do something with selectedRowIds
print('Selected Row IDstrndsss: $selectedRowIds');
for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}");
for (int i = 0; i < selectedRowIds.length; i++) {
print('The id id : ${selectedRowIds[i]}');
// _contactbox.put(i, selectedRowIds[i]);
print("checking_value_istrends: ${selectedRowIds[i]}");
HiveFunctions.createUser({
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
}
showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
// selectedno.add(selectedRowIds[i]);
HiveFunctions.addno(selectedRowIds[i]);
// _contactbox.put(i, selectedRowIds[i]);
HiveFunctions.createUser({
"name": "Gerosa,Gino",
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
},
)),
}
showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
});
},
)),
),
);
}
@ -291,6 +300,7 @@ class HiveFunctions {
// String userHiveBox="User Box";
// Box which will use to store the things
static final _contactbox = Hive.box("mycontact");
static var box1 = Hive.box('checkvalue');
static createUser(Map data) {
_contactbox.add(data);
@ -337,11 +347,35 @@ class HiveFunctions {
return data.reversed.toList();
}
static addno(int selectedRowId) {
// final box1 = Hive.box("mycontact");
print("SelectedStoredvaluessss: $selectedRowId");
box1.add(selectedRowId);
}
static getno() {
// final box1 = Hive.box("mycontact");
return box1.values;
}
}
class _Row {
_Row(this.identifier, this.valueA, this.valueC, this.valueD, this.valueE,
this.valueF, this.valueG, this.valueH, this.valueI);
_Row(
this.identifier,
this.valueA,
this.valueC,
this.valueD,
this.valueE,
this.valueF,
this.valueG,
this.valueH,
this.valueI,
this.selected, // Add selected parameter
);
final int identifier;
final String valueA;
@ -360,17 +394,18 @@ class _DataSource extends DataTableSource {
final BuildContext context;
late List<_Row> _rows;
// late List<int> _selectedRowsIndexes = []; // List to track selected rows
final List<String> _selectedRowIds = [];
final List<int> _selectedRowIds = [];
_DataSource(this.context) {
_rows = <_Row>[
for (int i = 0; i < 20; i++)
_Row(i, 'Gerosa, Gino', 'Tier1', '1', '0', '0', '0', '0', '0'),
_Row(
i, 'Gerosa, Gino', 'Tier1', '1', '0', '0', '0', '0', '0', check(i)),
];
//}
}
List<String> getSelectedRowIds() {
List<int> getSelectedRowIds() {
return _selectedRowIds; // Return a copy to prevent direct modification
}
@ -392,11 +427,11 @@ class _DataSource extends DataTableSource {
if (value) {
print("Selected");
_selectedRowIds.add(row.valueA); // Add the row ID to the list
_selectedRowIds.add(row.identifier); // Add the row ID to the list
print("Selected_selectedRowIds :$_selectedRowIds");
} else {
_selectedRowIds
.remove(row.valueA); // Remove the row ID from the list
.remove(row.identifier); // Remove the row ID from the list
}
notifyListeners();
@ -433,4 +468,17 @@ class _DataSource extends DataTableSource {
@override
int get selectedRowCount => _selectedCount;
bool check(int i) {
// print("I_am_i: $i");
print("_selectedRowIds_i: ${HiveFunctions.getno()}");
//HiveFunctions.getno();
if (HiveFunctions.getno().contains(i)) {
print("Iam_in: $i");
return true;
}
return false;
}
}

View File

@ -23,114 +23,116 @@ class RisingStarState extends State<RisingStar> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
fontStyle: FontStyle.normal),
return SafeArea(
child: Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
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,
// 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,
),
],
),
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');
],
),
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++) {
print("checking_value_istrends: ${selectedRowIds[i]}");
for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}");
// _contactbox.put(i, selectedRowIds[i]);
// _contactbox.put(i, selectedRowIds[i]);
HiveFunctions.createUser({
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
}
showDialog(
context: context,
builder: (_) {
return Alert(
data: "User Added Successfully",
);
HiveFunctions.createUser({
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
},
)),
}
showDialog(
context: context,
builder: (_) {
return Alert(
data: "User Added Successfully",
);
});
},
)),
),
);
}
}

View File

@ -22,88 +22,90 @@ class _TrendsState extends State<Trends> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
fontStyle: FontStyle.normal),
return SafeArea(
child: Scaffold(
body: ListView(
padding: const EdgeInsets.all(3),
children: [
PaginatedDataTable(
header: const Text(
'HCP RANKING',
style: TextStyle(
fontWeight: FontWeight.bold,
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,
// 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,
),
],
),
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');
],
),
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++) {
print("checking_value_istrends: ${selectedRowIds[i]}");
for (int i = 0; i < selectedRowIds.length; i++) {
print("checking_value_istrends: ${selectedRowIds[i]}");
// _contactbox.put(i, selectedRowIds[i]);
// _contactbox.put(i, selectedRowIds[i]);
HiveFunctions.createUser({
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
}
showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
HiveFunctions.createUser({
"name": selectedRowIds[i],
"org": "Azienda Ospedaliera di Padova",
"adrr": "Via Giustiniani 2, Padova, Veneto 35128, Italy",
"phone": "+390498212410X12",
"Pphone": "+390498212410X12",
"email": "Gerosa,Gino@gmail.com",
"affno": "75",
"eveno": "8",
"pubno": "251",
"trailno": "1"
});
},
)),
}
showDialog(
context: context,
builder: (_) {
return Alert(data: "User Added Successfully");
});
},
)),
),
);
}
}