325 lines
14 KiB
Dart
325 lines
14 KiB
Dart
|
// import 'package:konectar_events/ui_screen/interactionform/configprovider.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/interaction_screen.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/interactionlistscreen.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/interactionprovider.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/model/save_interaction.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/new_dynamicform.dart';
|
||
|
// import 'package:konectar_events/ui_screen/interactionform/view_forms_list.dart';
|
||
|
// import 'package:konectar_events/ui_screen/medical_insight.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/configprovider.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionlistscreen.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/interactionprovider.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/model/save_interaction.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/interactionform/new_dynamicform.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/medical_insight.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter/widgets.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class FormList extends StatefulWidget {
|
||
|
const FormList({super.key});
|
||
|
|
||
|
@override
|
||
|
State<FormList> createState() => _FormListState();
|
||
|
}
|
||
|
|
||
|
class _FormListState extends State<FormList> {
|
||
|
List<SaveInteraction> savedList = [];
|
||
|
@override
|
||
|
void initState() {
|
||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||
|
// if (!mytimer!.isActive) {
|
||
|
// activateTimer();
|
||
|
// }
|
||
|
print("interactionListt");
|
||
|
init();
|
||
|
});
|
||
|
|
||
|
super.initState();
|
||
|
}
|
||
|
|
||
|
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(() {});
|
||
|
}
|
||
|
|
||
|
Future<int> getCount(String form, InteractionProvider provider) async {
|
||
|
await provider.getRecords();
|
||
|
|
||
|
return provider.savedList.where((element) => element.form == form).length;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
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) =>
|
||
|
InteractionScreen1(
|
||
|
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),
|
||
|
),
|
||
|
|
||
|
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),
|
||
|
),
|
||
|
|
||
|
const Divider(),
|
||
|
|
||
|
ListTile(
|
||
|
title: const Text(
|
||
|
"Medical Insight",
|
||
|
style: TextStyle(fontSize: 18.0),
|
||
|
),
|
||
|
onTap: () async {
|
||
|
final ConfigDataProvider configDataProvider =
|
||
|
ConfigDataProvider();
|
||
|
|
||
|
await configDataProvider.initConfigUIDataMedical();
|
||
|
// Navigator.push(
|
||
|
// context,
|
||
|
// MaterialPageRoute(
|
||
|
// builder: (context) =>
|
||
|
// const MedicalInsight1()));
|
||
|
},
|
||
|
trailing: Icon(Icons.arrow_forward_ios),
|
||
|
),
|
||
|
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(),
|
||
|
ListTile(
|
||
|
title: const Text(
|
||
|
"Medical Insight",
|
||
|
style: TextStyle(fontSize: 18.0),
|
||
|
),
|
||
|
onTap: () async {
|
||
|
final ConfigDataProvider configDataProvider =
|
||
|
ConfigDataProvider();
|
||
|
await configDataProvider.initConfigUIDataEng();
|
||
|
Navigator.push(
|
||
|
context,
|
||
|
MaterialPageRoute(
|
||
|
builder: (context) => const MedicalInsight1()));
|
||
|
},
|
||
|
trailing: const Icon(Icons.arrow_forward_ios),
|
||
|
),
|
||
|
Divider(),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
void dispose() {
|
||
|
// TODO: implement dispose
|
||
|
super.dispose();
|
||
|
}
|
||
|
}
|