431 lines
18 KiB
Dart
431 lines
18 KiB
Dart
// import 'package:discover_module/ui_screen/interactionform/configprovider.dart';
|
|
// import 'package:discover_module/ui_screen/interactionform/interaction_screen.dart';
|
|
// import 'package:discover_module/ui_screen/interactionform/interactionlistscreen.dart';
|
|
// import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart';
|
|
// import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart';
|
|
// import 'package:discover_module/ui_screen/interactionform/view_forms_list.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();
|
|
|
|
// await Provider.of<InteractionProvider>(context, listen: false).getRecords();
|
|
// 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: ListView.builder(
|
|
// itemCount: provider.intConfigDataList.length,
|
|
// cacheExtent:
|
|
// double.parse(provider.intConfigDataList.length.toString()),
|
|
// itemBuilder: (context, index) {
|
|
// 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) =>
|
|
// InteractionScreen(
|
|
// 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),
|
|
// ),
|
|
// 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: 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),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// trailing: provider.savedList.indexWhere((element) =>
|
|
// element.form ==
|
|
// provider.intConfigDataList[index].name) !=
|
|
// -1
|
|
// ? InkWell(
|
|
// onTap: () {
|
|
// print("inwesm Screenindex $index");
|
|
|
|
// 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(),
|
|
// ],
|
|
// );
|
|
// }),
|
|
// ),
|
|
// );
|
|
// });
|
|
// }
|
|
// }
|
|
|
|
import 'package:discover_module/ui_screen/interactionform/configprovider.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/interactionlistscreen.dart';
|
|
import 'package:discover_module/ui_screen/interactionform/interactionprovider.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> {
|
|
var formdata;
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
|
|
idata();
|
|
}
|
|
|
|
idata() {
|
|
var iprovider = Provider.of<InteractionProvider>(context, listen: false);
|
|
|
|
setState(() {
|
|
formdata = iprovider.intConfigDataList;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
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),
|
|
// ),
|
|
// 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");
|
|
|
|
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(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|