DiscoverModule/lib/ui_screen/newformlist.dart

313 lines
13 KiB
Dart
Raw Normal View History

2024-05-20 10:29:02 +00:00
import 'package:discover_module/ui_screen/interactionform/configprovider.dart';
2024-07-08 04:58:57 +00:00
import 'package:discover_module/ui_screen/interactionform/interaction_screen.dart';
2024-05-20 10:29:02 +00:00
import 'package:discover_module/ui_screen/interactionform/interactionlistscreen.dart';
2024-07-05 08:48:29 +00:00
import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
2024-07-08 04:58:57 +00:00
import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
2024-07-19 08:45:14 +00:00
import 'package:discover_module/ui_screen/interactionform/new_dynamicform.dart';
2024-07-08 04:58:57 +00:00
import 'package:discover_module/ui_screen/interactionform/view_forms_list.dart';
2024-07-24 08:23:02 +00:00
import 'package:discover_module/ui_screen/medical_insight.dart';
2024-05-20 10:29:02 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
2024-07-05 08:48:29 +00:00
import 'package:provider/provider.dart';
2024-05-20 10:29:02 +00:00
class FormList extends StatefulWidget {
const FormList({super.key});
@override
State<FormList> createState() => _FormListState();
}
class _FormListState extends State<FormList> {
2024-07-08 04:58:57 +00:00
List<SaveInteraction> savedList = [];
2024-07-05 08:48:29 +00:00
@override
void initState() {
2024-07-08 04:58:57 +00:00
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// if (!mytimer!.isActive) {
// activateTimer();
// }
print("interactionListt");
init();
});
2024-07-05 08:48:29 +00:00
super.initState();
2024-07-08 04:58:57 +00:00
}
2024-07-05 08:48:29 +00:00
2024-07-08 04:58:57 +00:00
init() async {
print("init");
await Provider.of<InteractionProvider>(context, listen: false)
.initConfigData();
print("init1");
await Provider.of<InteractionProvider>(context, listen: false).getRecords();
print("init2");
//setState(() {});
2024-07-05 08:48:29 +00:00
}
2024-07-08 04:58:57 +00:00
Future<int> getCount(String form, InteractionProvider provider) async {
await provider.getRecords();
2024-07-05 08:48:29 +00:00
2024-07-08 04:58:57 +00:00
return provider.savedList.where((element) => element.form == form).length;
2024-07-05 08:48:29 +00:00
}
2024-05-20 10:29:02 +00:00
@override
Widget build(BuildContext context) {
2024-07-08 04:58:57 +00:00
return Consumer<InteractionProvider>(
builder: (BuildContext context, provider, Widget? child) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
title: Text("Form List"),
),
body: provider.intConfigDataList.length == 1
? ListView.builder(
itemCount: provider.intConfigDataList.length,
cacheExtent: double.parse(
provider.intConfigDataList.length.toString()),
itemBuilder: (context, index) {
print("checkkkk");
return Column(
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),
// ),
// 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),
// ),
ListTile(
title: const Text(
"Interaction",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
print(
"I am Interaction:${index}, ${provider.intConfigDataList[index].name}");
// final ConfigDataProvider configDataProvider =
// ConfigDataProvider();
// await configDataProvider.initConfigUIData();
// // Navigator.push(context, MaterialPageRoute(builder: (context)))=> InteractionScreen();
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => InteractionListScreen()));
if (provider.intConfigDataList.length == 1) {
setState(() {});
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIData();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
2024-07-19 08:45:14 +00:00
InteractionScreen1(
2024-07-08 04:58:57 +00:00
index: index,
form: provider
.intConfigDataList[index].name,
)));
} else {
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),
),
2024-07-24 08:23:02 +00:00
Divider(),
2024-07-08 04:58:57 +00:00
ListTile(
title: const Text(
2024-07-24 08:23:02 +00:00
"Engagement",
2024-07-08 04:58:57 +00:00
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
2024-07-24 08:23:02 +00:00
await configDataProvider.initConfigUIDataEng();
2024-07-08 04:58:57 +00:00
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
const InteractionListScreen()));
},
2024-07-24 08:23:02 +00:00
trailing: const Icon(Icons.arrow_forward_ios),
2024-07-08 04:58:57 +00:00
),
2024-07-24 08:23:02 +00:00
const Divider(),
2024-07-08 04:58:57 +00:00
ListTile(
title: const Text(
2024-07-24 08:23:02 +00:00
"Medical Insight",
2024-07-08 04:58:57 +00:00
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
2024-07-24 08:23:02 +00:00
await configDataProvider.initConfigUIDataMedical();
2024-07-26 07:17:34 +00:00
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// const MedicalInsight1()));
2024-07-08 04:58:57 +00:00
},
2024-07-24 08:23:02 +00:00
trailing: Icon(Icons.arrow_forward_ios),
2024-07-08 04:58:57 +00:00
),
const Divider(),
],
);
})
: 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),
),
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),
),
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),
),
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(),
2024-07-24 08:23:02 +00:00
ListTile(
title: const Text(
"Medical Insight",
style: TextStyle(fontSize: 18.0),
),
onTap: () async {
final ConfigDataProvider configDataProvider =
ConfigDataProvider();
await configDataProvider.initConfigUIDataEng();
Navigator.push(
context,
MaterialPageRoute(
2024-07-26 07:17:34 +00:00
builder: (context) => const MedicalInsight1()));
2024-07-24 08:23:02 +00:00
},
trailing: const Icon(Icons.arrow_forward_ios),
),
Divider(),
2024-07-08 04:58:57 +00:00
],
),
2024-06-10 11:11:00 +00:00
),
2024-07-08 04:58:57 +00:00
);
});
2024-05-20 10:29:02 +00:00
}
}