diff --git a/lib/constants.dart b/lib/constants.dart index 2466d1a..7a78000 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -2,4 +2,7 @@ import 'dart:ui'; class Constants { static Color k2color = Color.fromARGB(255, 0, 71, 132); + + //static const url = "http://192.168.172.50:8082/api"; + static const url = 'http://192.168.2.143:8081/api'; } diff --git a/lib/custom_widget/text.dart b/lib/custom_widget/text.dart index 30e59ce..e74ef75 100644 --- a/lib/custom_widget/text.dart +++ b/lib/custom_widget/text.dart @@ -23,6 +23,7 @@ class _Text1State extends State { Widget build(BuildContext context) { return Text( widget.title, + softWrap: true, style: TextStyle( color: widget.txtcolor, fontSize: widget.txtfont, diff --git a/lib/main.dart b/lib/main.dart index 5fd087d..7372550 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,9 @@ +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:discover_module/provider_class/events_provider.dart'; import 'package:discover_module/provider_class/hcp%20_provider.dart'; +import 'package:discover_module/provider_class/publications_provider.dart'; import 'package:discover_module/provider_class/single_hcpprovider.dart'; +import 'package:discover_module/provider_class/trials_provider.dart'; import 'package:discover_module/ui_screen/contacts.dart'; import 'package:discover_module/ui_screen/discover.dart'; import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; @@ -11,6 +15,7 @@ import 'package:discover_module/ui_screen/interactionform/repository/hive_reposi import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart'; import 'package:discover_module/ui_screen/listview.dart'; import 'package:discover_module/ui_screen/filters_menu.dart'; +import 'package:discover_module/ui_screen/new_contacts.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; @@ -61,6 +66,10 @@ Future main() async { ChangeNotifierProvider(create: (_) => ViewInteractionProvider()), ChangeNotifierProvider(create: (_) => hcpProvider()), ChangeNotifierProvider(create: (_) => Singlehcpdetails()), + ChangeNotifierProvider(create: (_) => AffiliationsProvider()), + ChangeNotifierProvider(create: (_) => PublicatioProvider()), + ChangeNotifierProvider(create: (_) => EventProvider()), + ChangeNotifierProvider(create: (_) => TrialsProvider()), //ChangeNotifierProvider(create: (_) => ConfigDataProvider()), ChangeNotifierProvider( create: (_) => HiveDataRepository( @@ -171,7 +180,7 @@ class _MyHomePageState extends State { body: TabBarView( children: [ - Center(child: Contacts()), + Center(child: const Contacts1()), Center(child: Discover(outerTabValue)), Center(child: DataTableDemo()), ], diff --git a/lib/model_class/affiliations.dart b/lib/model_class/affiliations.dart new file mode 100644 index 0000000..73ed0ea --- /dev/null +++ b/lib/model_class/affiliations.dart @@ -0,0 +1,63 @@ +// To parse this JSON data, do +// +// final affiliations = affiliationsFromJson(jsonString); + +import 'dart:convert'; + +List affiliationsFromJson(String str) => List.from( + json.decode(str).map((x) => Affiliations.fromJson(x))); + +String affiliationsToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + +class Affiliations { + int id; + int userId; + String orgName; + String dept; + String role; + String timeFrame; + String orgType; + String emgType; + dynamic createdAt; + dynamic updatedAt; + + Affiliations({ + required this.id, + required this.userId, + required this.orgName, + required this.dept, + required this.role, + required this.timeFrame, + required this.orgType, + required this.emgType, + required this.createdAt, + required this.updatedAt, + }); + + factory Affiliations.fromJson(Map json) => Affiliations( + id: json["id"], + userId: json["user_id"], + orgName: json["org_name"], + dept: json["dept"], + role: json["role"], + timeFrame: json["time_frame"], + orgType: json["org_type"], + emgType: json["emg_type"], + createdAt: json["created_at"], + updatedAt: json["updated_at"], + ); + + Map toJson() => { + "id": id, + "user_id": userId, + "org_name": orgName, + "dept": dept, + "role": role, + "time_frame": timeFrame, + "org_type": orgType, + "emg_type": emgType, + "created_at": createdAt, + "updated_at": updatedAt, + }; +} diff --git a/lib/model_class/event_model.dart b/lib/model_class/event_model.dart new file mode 100644 index 0000000..b32fa3f --- /dev/null +++ b/lib/model_class/event_model.dart @@ -0,0 +1,59 @@ +// To parse this JSON data, do +// +// final events = eventsFromJson(jsonString); + +import 'dart:convert'; + +List eventsFromJson(String str) => + List.from(json.decode(str).map((x) => Events.fromJson(x))); + +String eventsToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + +class Events { + int id; + int userId; + String eventName; + String sessionType; + String topic; + String role; + DateTime? createdAt; + DateTime? updatedAt; + + Events({ + required this.id, + required this.userId, + required this.eventName, + required this.sessionType, + required this.topic, + required this.role, + required this.createdAt, + required this.updatedAt, + }); + + factory Events.fromJson(Map json) => Events( + id: json["id"], + userId: json["user_id"], + eventName: json["event_name"], + sessionType: json["session_type"], + topic: json["topic"], + role: json["role"], + createdAt: json["created_at"] == null + ? null + : DateTime.parse(json["created_at"]), + updatedAt: json["updated_at"] == null + ? null + : DateTime.parse(json["updated_at"]), + ); + + Map toJson() => { + "id": id, + "user_id": userId, + "event_name": eventName, + "session_type": sessionType, + "topic": topic, + "role": role, + "created_at": createdAt?.toIso8601String(), + "updated_at": updatedAt?.toIso8601String(), + }; +} diff --git a/lib/model_class/publication_model.dart b/lib/model_class/publication_model.dart new file mode 100644 index 0000000..75aa74b --- /dev/null +++ b/lib/model_class/publication_model.dart @@ -0,0 +1,55 @@ +// To parse this JSON data, do +// +// final publications = publicationsFromJson(jsonString); + +import 'dart:convert'; + +List publicationsFromJson(String str) => List.from( + json.decode(str).map((x) => Publications.fromJson(x))); + +String publicationsToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + +class Publications { + int id; + int userId; + String articalTitle; + String journalName; + DateTime date; + String author; + dynamic createdAt; + dynamic updatedAt; + + Publications({ + required this.id, + required this.userId, + required this.articalTitle, + required this.journalName, + required this.date, + required this.author, + required this.createdAt, + required this.updatedAt, + }); + + factory Publications.fromJson(Map json) => Publications( + id: json["id"], + userId: json["user_id"], + articalTitle: json["artical_title"], + journalName: json["journal_name"], + date: DateTime.parse(json["date"]), + author: json["author"], + createdAt: json["created_at"], + updatedAt: json["updated_at"], + ); + + Map toJson() => { + "id": id, + "user_id": userId, + "artical_title": articalTitle, + "journal_name": journalName, + "date": date.toIso8601String(), + "author": author, + "created_at": createdAt, + "updated_at": updatedAt, + }; +} diff --git a/lib/model_class/trials.dart b/lib/model_class/trials.dart new file mode 100644 index 0000000..a4fb391 --- /dev/null +++ b/lib/model_class/trials.dart @@ -0,0 +1,67 @@ +// To parse this JSON data, do +// +// final trials = trialsFromJson(jsonString); + +import 'dart:convert'; + +List trialsFromJson(String str) => + List.from(json.decode(str).map((x) => Trials.fromJson(x))); + +String trialsToJson(List data) => + json.encode(List.from(data.map((x) => x.toJson()))); + +class Trials { + int id; + int userId; + String ctId; + String trialName; + String status; + String sponsors; + String condition; + String intervention; + String phase; + dynamic createdAt; + dynamic updatedAt; + + Trials({ + required this.id, + required this.userId, + required this.ctId, + required this.trialName, + required this.status, + required this.sponsors, + required this.condition, + required this.intervention, + required this.phase, + required this.createdAt, + required this.updatedAt, + }); + + factory Trials.fromJson(Map json) => Trials( + id: json["id"], + userId: json["user_id"], + ctId: json["ct_id"], + trialName: json["trial_name"], + status: json["status"], + sponsors: json["sponsors"], + condition: json["condition"], + intervention: json["intervention"], + phase: json["phase"], + createdAt: json["created_at"], + updatedAt: json["updated_at"], + ); + + Map toJson() => { + "id": id, + "user_id": userId, + "ct_id": ctId, + "trial_name": trialName, + "status": status, + "sponsors": sponsors, + "condition": condition, + "intervention": intervention, + "phase": phase, + "created_at": createdAt, + "updated_at": updatedAt, + }; +} diff --git a/lib/provider_class/affiliationsprovider.dart b/lib/provider_class/affiliationsprovider.dart new file mode 100644 index 0000000..73cd034 --- /dev/null +++ b/lib/provider_class/affiliationsprovider.dart @@ -0,0 +1,31 @@ +import 'package:discover_module/model_class/affiliations.dart'; +import 'package:discover_module/service.dart/service.dart'; +import 'package:flutter/cupertino.dart'; + +class AffiliationsProvider extends ChangeNotifier { + final affapi = Callapi(); + + List affiliations1 = []; + List allaffiliations1 = []; + + List get adddta => affiliations1; + List get affiliationsAll => allaffiliations1; + + getAffiliationsdata() async { + print("Affiliations_is: "); + final affdata = await affapi.getaffiliationsdata(); + print("Affiliations_is after:$affdata "); + + affiliations1 = affdata; + notifyListeners(); + } + + getAllAffiliationsdata() async { + print("Affiliations_is: "); + final affdata = await affapi.getallaffiliationsdata(); + print("Affiliations_is after:$affdata "); + + allaffiliations1 = affdata; + notifyListeners(); + } +} diff --git a/lib/provider_class/events_provider.dart b/lib/provider_class/events_provider.dart new file mode 100644 index 0000000..00ef464 --- /dev/null +++ b/lib/provider_class/events_provider.dart @@ -0,0 +1,28 @@ +import 'package:discover_module/service.dart/service.dart'; +import 'package:flutter/cupertino.dart'; + +class EventProvider extends ChangeNotifier { + final apicall = Callapi(); + + List eventlist = []; + + List get EventsList => eventlist; + + List alleventlist = []; + + List get allEventsList => alleventlist; + + geteventdata() async { + final events = await apicall.geteventsdata(); + + eventlist = events; + notifyListeners(); + } + + allgeteventdata() async { + final events = await apicall.allgeteventsdata(); + + alleventlist = events; + notifyListeners(); + } +} diff --git a/lib/provider_class/publications_provider.dart b/lib/provider_class/publications_provider.dart new file mode 100644 index 0000000..94ddc26 --- /dev/null +++ b/lib/provider_class/publications_provider.dart @@ -0,0 +1,25 @@ +import 'package:discover_module/service.dart/service.dart'; +import 'package:flutter/cupertino.dart'; + +class PublicatioProvider extends ChangeNotifier { + final apicall = Callapi(); + List publist = []; + + List get publicationlist => publist; + + List allpublist = []; + + List get allpublicationlist => allpublist; + + publicatininfo() async { + final publication_result = await apicall.getpublicationsdata(); + publist = publication_result; + notifyListeners(); + } + + allpublicatininfo() async { + final publication_result = await apicall.getallpublicationsdata(); + allpublist = publication_result; + notifyListeners(); + } +} diff --git a/lib/provider_class/trials_provider.dart b/lib/provider_class/trials_provider.dart new file mode 100644 index 0000000..1d938bb --- /dev/null +++ b/lib/provider_class/trials_provider.dart @@ -0,0 +1,16 @@ +import 'package:discover_module/service.dart/service.dart'; +import 'package:flutter/cupertino.dart'; + +class TrialsProvider extends ChangeNotifier { + final callapi = Callapi(); + + List trials = []; + + List get trialsinfo => trials; + + trialsdata() async { + final jsonres = await callapi.getalltrials(); + trials = jsonres; + notifyListeners(); + } +} diff --git a/lib/service.dart/service.dart b/lib/service.dart/service.dart index 739120c..3098a05 100644 --- a/lib/service.dart/service.dart +++ b/lib/service.dart/service.dart @@ -1,14 +1,20 @@ import 'dart:convert'; import 'package:dio/dio.dart'; +import 'package:discover_module/constants.dart'; import 'package:discover_module/hive_fun.dart'; import 'package:hive_flutter/hive_flutter.dart'; +const String curl = Constants.url; + class Callapi { getallhcpdata() async { // const url = 'http://127.0.0.1:8000/api/users'; - //const url = 'http://192.168.2.143:8080/api/users'; - const url = 'http://192.168.172.50:8080/api/users'; + // const url = 'http://192.168.2.143:8082/api/users'; + // const url = 'http://192.168.172.50:8082/api/users'; + // const url = 'http://192.168.172.50:8081/api/users'; + + const url = '$curl/users'; final response = await Dio().get(url); @@ -47,8 +53,9 @@ class Callapi { getsinglehcpdata() async { // const url = 'http://127.0.0.1:8000/api/users/1'; - // const url = 'http://192.168.2.143:8080/api/users/1'; - const url = 'http://192.168.172.50:8080/api/users/1'; + // const url = 'http://192.168.2.143:8082/api/users/1'; + // const url = 'http://192.168.172.50:8081/api/users/1'; + const url = '$curl/users/1'; final responsehcp = await Dio().post(url); final jsonresponse1 = responsehcp.data; @@ -58,4 +65,91 @@ class Callapi { print("Singlejsondata : ${jsonresponse1}"); return jsonresponse1; } + + getaffiliationsdata() async { + // const url = 'http://192.168.2.143:8082/api/affiliations'; + // const url = 'http://192.168.172.50:8081/api/affiliations'; + const url = '$curl/affiliations'; + + final affiliationres = await Dio().get(url); + final jsonresponse2 = affiliationres.data.take(2).toList(); + + return jsonresponse2; + } + + getpublicationsdata() async { + //const url = 'http://192.168.2.143:8082/api/publications'; + // const url = 'http://192.168.172.50:8081/api/publications'; + const url = '$curl/publications'; + + final affiliationres = await Dio().get(url); + final jsonresponse2 = affiliationres.data.take(2).toList(); + + return jsonresponse2; + } + + geteventsdata() async { + // const url = 'http://192.168.2.143:8082/api/events'; + // const url = 'http://192.168.172.50:8081/api/events'; + const url = '$curl/events'; + + final events = await Dio().get(url); + // final jsonEvent = events.data; + final jsonEvent = events.data; + print("All_event: $jsonEvent"); + final jsonEvent1 = events.data.take(2).toList(); + + print("only few : $jsonEvent1"); + + return jsonEvent1; + } + + getallaffiliationsdata() async { + // const url = 'http://192.168.2.143:8082/api/affiliations'; + //const url = 'http://192.168.172.50:8081/api/affiliations'; + const url = '$curl/affiliations'; + + final events = await Dio().get(url); + // final jsonEvent = events.data; + final jsonEvent = events.data; + print("All_event: $jsonEvent"); + + return jsonEvent; + } + + getallpublicationsdata() async { + // const url = 'http://192.168.2.143:8082/api/publications'; + //const url = 'http://192.168.172.50:8081/api/publications'; + const url = '$curl/publications'; + + final events = await Dio().get(url); + // final jsonEvent = events.data; + final jsonEvent = events.data; + print("All_event: $jsonEvent"); + + return jsonEvent; + } + + allgeteventsdata() async { + //const url = 'http://192.168.2.143:8082/api/events'; + //const url = 'http://192.168.172.50:8081/api/events'; + const url = '$curl/events'; + + final events = await Dio().get(url); + // final jsonEvent = events.data; + final jsonEvent = events.data; + print("All_event: $jsonEvent"); + + return jsonEvent; + } + + getalltrials() async { + // const url = 'http://192.168.2.143:8082/api/trails'; + const url = '$curl/trails'; + + final trials = await Dio().get(url); + final jsontrials = trials.data; + print("All_trialsss: $jsontrials"); + return jsontrials; + } } diff --git a/lib/ui_screen/affiliation_data.dart b/lib/ui_screen/affiliation_data.dart new file mode 100644 index 0000000..996f903 --- /dev/null +++ b/lib/ui_screen/affiliation_data.dart @@ -0,0 +1,99 @@ +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class AffiliationsData extends StatefulWidget { + const AffiliationsData({super.key}); + + @override + State createState() => _AffiliationsDataState(); +} + +class _AffiliationsDataState extends State { + List hcpaffiliations = []; + @override + void initState() { + // TODO: implement initState + super.initState(); + + affdata(); + } + + affdata() async { + final affprovider = + Provider.of(context, listen: false); + await affprovider.getAllAffiliationsdata(); + + final affdata = affprovider.affiliationsAll; + setState(() { + hcpaffiliations = affdata; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Affiliations'), + ), + body: Scrollbar( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Container( + constraints: + BoxConstraints(minWidth: MediaQuery.of(context).size.width), + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn(label: Expanded(child: Text('sl no'))), + DataColumn( + label: Expanded( + child: Text('Organization Name'), + )), + DataColumn( + label: + Expanded(child: Text('Department', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Role', softWrap: true))), + DataColumn( + label: + Expanded(child: Text('Time Frame', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Org Type', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Eng Type', softWrap: true))), + // Add more columns as needed + ], + rows: List.generate( + hcpaffiliations.length, + (index) => DataRow( + cells: [ + DataCell(Text(hcpaffiliations[index]['id'].toString(), + softWrap: true)), + DataCell(Text( + hcpaffiliations[index]['org_name'].toString(), + softWrap: true)), + DataCell(Text(hcpaffiliations[index]['dept'].toString(), + softWrap: true)), + DataCell(Text(hcpaffiliations[index]['role'].toString(), + softWrap: true)), + DataCell(Text( + hcpaffiliations[index]['time_frame'].toString(), + softWrap: true)), + DataCell(Text( + hcpaffiliations[index]['org_type'].toString(), + softWrap: true)), + DataCell(Text( + hcpaffiliations[index]['emg_type'].toString(), + softWrap: true)), + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + )); + } +} diff --git a/lib/ui_screen/contacts.dart b/lib/ui_screen/contacts.dart index dcba0bf..1a8b39c 100644 --- a/lib/ui_screen/contacts.dart +++ b/lib/ui_screen/contacts.dart @@ -285,6 +285,7 @@ import 'package:discover_module/provider_class/hcp%20_provider.dart'; import 'package:discover_module/ui_screen/interactionform/NewtworkConnectivity.dart'; +import 'package:discover_module/ui_screen/new_profile.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_profile_picture/flutter_profile_picture.dart'; @@ -417,20 +418,34 @@ class _ContactsState extends State { var data = value.list[index]; return ListTile( onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => Profile( + // text: data, + // ), + // ), + // ); + Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Profile( - text: data, - ), - ), - ); + context, + MaterialPageRoute( + builder: (_) => + NewProfile(text: data))); }, - leading: ProfilePicture( - name: data["name"], - radius: 20, - fontsize: 12, - ), + leading: data["img_path"] == null + ? ProfilePicture( + name: data["name"], + radius: 20, + fontsize: 12, + ) + : ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(20), + child: Image.network(data["img_path"], + fit: BoxFit.cover), + ), + ), title: Text( data["name"], style: TextStyle( diff --git a/lib/ui_screen/events_data.dart b/lib/ui_screen/events_data.dart new file mode 100644 index 0000000..67a3a01 --- /dev/null +++ b/lib/ui_screen/events_data.dart @@ -0,0 +1,91 @@ +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:discover_module/provider_class/events_provider.dart'; +import 'package:discover_module/provider_class/publications_provider.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class EventsData extends StatefulWidget { + const EventsData({super.key}); + + @override + State createState() => _EventsDataState(); +} + +class _EventsDataState extends State { + List hcppublication = []; + @override + void initState() { + // TODO: implement initState + super.initState(); + + affdata(); + } + + affdata() async { + final affprovider = Provider.of(context, listen: false); + await affprovider.allgeteventdata(); + + final affdata = affprovider.allEventsList; + setState(() { + hcppublication = affdata; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Publications'), + ), + body: Scrollbar( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Container( + constraints: + BoxConstraints(minWidth: MediaQuery.of(context).size.width), + child: DataTable( + columns: const [ + DataColumn( + label: Expanded(child: Text('sl no', softWrap: true))), + DataColumn( + label: Expanded( + child: Text('Event Name', softWrap: true), + )), + DataColumn( + label: Expanded( + child: Text('Session Type', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Topic', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Role', softWrap: true))), + + // Add more columns as needed + ], + rows: List.generate( + hcppublication.length, + (index) => DataRow( + cells: [ + DataCell(Text(hcppublication[index]['id'].toString(), + softWrap: true)), + DataCell(Text( + hcppublication[index]['event_name'].toString(), + softWrap: true)), + DataCell(Text( + hcppublication[index]['session_type'].toString(), + softWrap: true)), + DataCell(Text(hcppublication[index]['topic'].toString(), + softWrap: true)), + DataCell(Text(hcppublication[index]['role'].toString(), + softWrap: true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + )); + } +} diff --git a/lib/ui_screen/interactionform/NewtworkConnectivity.dart b/lib/ui_screen/interactionform/NewtworkConnectivity.dart index 3c8177f..f9b0c8c 100644 --- a/lib/ui_screen/interactionform/NewtworkConnectivity.dart +++ b/lib/ui_screen/interactionform/NewtworkConnectivity.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:connectivity_plus/connectivity_plus.dart'; +import 'package:dio/dio.dart'; class NetworkConnectivity { // Future isInternetAvailable() async { @@ -14,9 +15,13 @@ class NetworkConnectivity { return false; } else { try { - final result = await InternetAddress.lookup('google.com'); - if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { + // final result = await InternetAddress.lookup('google.com'); + final result = await Dio().get('www.google.com'); + + if (result.statusCode == 200) { + // if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { return true; + //} } return false; } on SocketException catch (_) { diff --git a/lib/ui_screen/interactionform/edit_interaction_screen.dart b/lib/ui_screen/interactionform/edit_interaction_screen.dart index a7cf2b7..aeaf60b 100644 --- a/lib/ui_screen/interactionform/edit_interaction_screen.dart +++ b/lib/ui_screen/interactionform/edit_interaction_screen.dart @@ -107,7 +107,6 @@ class _EditInteractionScreenState extends State { child: OrientationBuilder(builder: (context, orientation) { return SafeArea( child: Scaffold( - //resizeToAvoidBottomInset: false, appBar: AppBar( title: Text( widget.saveInteraction.id, @@ -130,6 +129,7 @@ class _EditInteractionScreenState extends State { ), ), body: Column( + mainAxisSize: MainAxisSize.min, children: [ Expanded( child: ListView.builder( @@ -140,10 +140,17 @@ class _EditInteractionScreenState extends State { itemBuilder: (context, index) { var item = provider.interactionReponseList[index]; sectionList = item.sectionList; - return Card( + return Container( + //elevation: 4, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(0.0), + // ), + color: Constants.k2color, child: ExpansionTile( maintainState: true, // backgroundColor: Colors.white, + backgroundColor: Constants.k2color, + // collapsedBackgroundColor: Color(0xFF2b9af3), initiallyExpanded: true, title: Stack( @@ -152,7 +159,7 @@ class _EditInteractionScreenState extends State { Container( // height: double.infinity, width: double.infinity, - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.all(0.0), decoration: BoxDecoration( // color: Color(0xFF2b9af3), color: Constants.k2color), @@ -185,23 +192,15 @@ class _EditInteractionScreenState extends State { : const SizedBox.shrink() ]), 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: 14.0) - : const EdgeInsets.only( - left: 12.0, right: 12.0), - child: GridView.count( + Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + GridView.count( physics: const NeverScrollableScrollPhysics(), // crossAxisCount: @@ -231,25 +230,6 @@ class _EditInteractionScreenState extends State { : 3.5, shrinkWrap: true, padding: EdgeInsets.zero, - // childAspectRatio: - // sectionList.length == 1 || - // !isTablet - // ? orientation == - // Orientation.landscape - // ? 10 - // : 3.8 - // : 2.4, - - // childAspectRatio: - // sectionList.length == 1 - // ? orientation == - // Orientation - // .landscape - // ? 10 - // : 4.8 - // : isTablet - // ? 3.6 - // : 3.0, childAspectRatio: sectionList.length == 1 @@ -260,7 +240,7 @@ class _EditInteractionScreenState extends State { : 4.8 : isTablet ? 2.8 - : 3.0, + : 3.5, children: List.generate( sectionList.length, (i) { @@ -341,9 +321,10 @@ class _EditInteractionScreenState extends State { ), ), ), - SizedBox( - height: isTablet ? 15 : 5, - ), + // SizedBox( + // height: + // isTablet ? 15 : 5, + // ), returnWidget( sectionItem: sectionItem, @@ -363,26 +344,26 @@ class _EditInteractionScreenState extends State { }, ), ), - ), - 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(), - ], + // 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(), + ], + ), ), ), ]), @@ -496,18 +477,21 @@ class _EditInteractionScreenState extends State { ? buildDateWidget(sectionItem) : sectionItem.input == "textArea" ? Expanded( - child: InteractionTextField( - maxchars: int.parse(sectionItem.chars ?? "0"), - controller: sectionItem.controller!, - labelText: sectionItem.name, - // maxlines: 4, - // minlines: 3, - onChanged: (val) { - sectionItem.selectedValue = []; - setState(() {}); + child: Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: InteractionTextField( + maxchars: int.parse(sectionItem.chars ?? "0"), + controller: sectionItem.controller!, + labelText: sectionItem.name, + // maxlines: 4, + // minlines: 3, + onChanged: (val) { + sectionItem.selectedValue = []; + setState(() {}); - sectionItem.selectedValue!.add(val); - }, + sectionItem.selectedValue!.add(val); + }, + ), ), ) : Expanded( @@ -542,50 +526,54 @@ class _EditInteractionScreenState extends State { } Widget buildDateWidget(SectionList sectionItem) { - return SizedBox( - // width: isTablet ? 200 : MediaQuery.of(context).size.width, - width: MediaQuery.of(context).size.width, + return Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: SizedBox( + // width: isTablet ? 200 : MediaQuery.of(context).size.width, + width: MediaQuery.of(context).size.width, - height: isTablet ? 50 : 40, - child: TextField( - controller: - sectionItem.controller, //editing controller of this TextField - decoration: InputDecoration( - // border: OutlineInputBorder(), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10.0), - ), - labelStyle: const TextStyle(fontSize: 16), - suffixIcon: const Icon(Icons.calendar_today), //icon of text field - labelText: "Enter Date" //label text of field - ), - readOnly: true, //set it true, so that user will not able to edit text - onTap: () async { - DateTime? pickedDate = await showDatePicker( - context: context, - initialDate: DateTime.now(), - firstDate: DateTime( - 2000), //DateTime.now() - not to allow to choose before today. - lastDate: DateTime(2101)); + // height: isTablet ? 50 : 40, + child: TextField( + controller: + sectionItem.controller, //editing controller of this TextField + decoration: InputDecoration( + // border: OutlineInputBorder(), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10.0), + ), + labelStyle: const TextStyle(fontSize: 16), + suffixIcon: const Icon(Icons.calendar_today), //icon of text field + labelText: "Enter Date" //label text of field + ), + readOnly: true, //set it true, so that user will not able to edit text + onTap: () async { + DateTime? pickedDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime( + 2000), //DateTime.now() - not to allow to choose before today. + lastDate: DateTime(2101)); - if (pickedDate != null) { - print( - pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 - String formattedDate = DateFormat('yyyy-MM-dd').format(pickedDate); - print( - formattedDate); //formatted date output using intl package => 2021-03-16 - //you can implement different kind of Date Format here according to your requirement + if (pickedDate != null) { + print( + pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 + String formattedDate = + DateFormat('yyyy-MM-dd').format(pickedDate); + print( + formattedDate); //formatted date output using intl package => 2021-03-16 + //you can implement different kind of Date Format here according to your requirement - setState(() { - sectionItem.controller!.text = formattedDate; - sectionItem.selectedValue = []; - sectionItem.selectedValue! - .add(formattedDate); //set output date to TextField value. - }); - } else { - print("Date is not selected"); - } - }, + setState(() { + sectionItem.controller!.text = formattedDate; + sectionItem.selectedValue = []; + sectionItem.selectedValue! + .add(formattedDate); //set output date to TextField value. + }); + } else { + print("Date is not selected"); + } + }, + ), ), ); } @@ -597,7 +585,8 @@ class _EditInteractionScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Padding( - padding: const EdgeInsets.all(4.0), + //padding: const EdgeInsets.all(4.0), + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 5.0), child: CustomButton( backgroundColor: Colors.green.shade500, onPressed: () async { @@ -688,7 +677,8 @@ class _EditInteractionScreenState extends State { for (var value in provider.checkboxlist) Row( children: [ - Checkbox( + CheckboxListTile( + dense: true, value: value.ischecked ?? false, activeColor: Colors.black, checkColor: Colors.white, @@ -732,11 +722,12 @@ class _EditInteractionScreenState extends State { child: DropdownButtonFormField2( isExpanded: true, decoration: InputDecoration( + isDense: true, // Add Horizontal padding using menuItemStyleData.padding so it matches // the menu padding when button's width is not specified. contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10.0), ), // Add more decoration.. ), @@ -827,7 +818,7 @@ class _EditInteractionScreenState extends State { // the menu padding when button's width is not specified. contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10), ), // Add more decoration.. ), @@ -894,12 +885,12 @@ class _EditInteractionScreenState extends State { isDense: true, contentPadding: const EdgeInsets.symmetric( horizontal: 10, - vertical: 8, + vertical: 18, ), hintText: 'Search for an item...', hintStyle: const TextStyle(fontSize: 12), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(10), ), ), ), @@ -938,11 +929,12 @@ class _EditInteractionScreenState extends State { child: DropdownButtonFormField2( isExpanded: true, decoration: InputDecoration( + isDense: true, // Add Horizontal padding using menuItemStyleData.padding so it matches // the menu padding when button's width is not specified. contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10), ), // Add more decoration.. ), @@ -1231,198 +1223,193 @@ class _EditInteractionScreenState extends State { } print("ConvertedArrayEditMulti.leangth: $convertedArray"); print("ConvertedArray.leangth: ${convertedArray.length}"); - return Padding( - padding: isTablet - ? const EdgeInsets.only(left: 0.0) - : const EdgeInsets.only(left: 12.0, right: 12.0), - child: Column( - children: [ - for (var i = 0; i < convertedArray.length; i++) - DecoratedBox( - decoration: BoxDecoration( - color: i % 2 == 0 - ? Color.fromARGB(133, 213, 241, 254) - : Colors.white, - ), - child: Wrap( - children: [ - //GestureDetector(child: Text("data")), - GridView.builder( - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: context.responsive( - 1, - sm: 1, // small - md: 2, // medium - lg: sectionList.length == 1 - ? 1 - : (sectionList.length >= 1 ? 3 : 3), // large - xl: 3, // extra large screen - ), - mainAxisSpacing: - sectionList.length == 1 || !isTablet ? 1 : 2, - childAspectRatio: sectionList.length == 1 - ? orientation == Orientation.landscape - ? 10 - : 4.8 - : isTablet - ? 2.8 - : 3.0, + return Column( + children: [ + for (var i = 0; i < convertedArray.length; i++) + DecoratedBox( + decoration: BoxDecoration( + color: i % 2 == 0 + ? Color.fromARGB(133, 213, 241, 254) + : Colors.white, + ), + child: Wrap( + children: [ + //GestureDetector(child: Text("data")), + GridView.builder( + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: context.responsive( + 1, + sm: 1, // small + md: 2, // medium + lg: sectionList.length == 1 + ? 1 + : (sectionList.length >= 1 ? 3 : 3), // large + xl: 3, // extra large screen ), - shrinkWrap: true, - padding: EdgeInsets.zero, - itemCount: convertedArray[i].length, - itemBuilder: (context, index) { - SectionList sectionItem = convertedArray[i][index]; - dropdownvalue = - sectionItem.widget == InteractionWidget.DROPDOWN - ? sectionItem.value ?? "Select" - : ' '; - List 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 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() - : Padding( - padding: const EdgeInsets.only( - left: 8.0, right: 8.0), - child: Text( - sectionItem.isRequired - ? '${sectionItem.name}:*' - : '${sectionItem.name}:', - style: TextStyle( - color: Colors.orange.shade800, - fontSize: 18.0, - // fontSize: isTablet - // ? 18 - // : 12, - ), - )), - const SizedBox( - height: 15, - ), - sectionItem.widget == InteractionWidget.BUTTON - ? sectionItem.input == 'chooseFile' - ? Row( - children: [ - CustomButton( - backgroundColor: - const Color.fromARGB( - 255, 233, 229, 229), - onPressed: () async { - if (sectionItem.selectedValue! - .isNotEmpty) { - showFilesAlertDialog( - context, - sectionItem.fileName! - .join(','), - sectionItem); - } else { - sectionItem.selectedValue = - []; - sectionItem.extension = []; - sectionItem.fileName = []; - await getEncodedFile( - sectionItem); - } - setState(() {}); - }, - width: 120, - height: 40, - fontsize: 12, - textColor: Colors.black, - title: sectionItem.name), - const SizedBox( - width: 5, - ), - Text( - sectionItem - .selectedValue!.isNotEmpty - ? 'File uploaded' - : 'No file uploaded', - style: TextStyle( - color: sectionItem - .selectedValue! - .isNotEmpty - ? Colors.green - : Colors.red), - ), - ], - ) - : isTablet - ? IconButton( - onPressed: () { - provider.deleteMultipleRows( - sectionItem.gid!, - sectionList[i], - sectionName); + mainAxisSpacing: + sectionList.length == 1 || !isTablet ? 1 : 2, + childAspectRatio: sectionList.length == 1 + ? orientation == Orientation.landscape + ? 10 + : 4.8 + : isTablet + ? 2.8 + : 3.0, + ), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemCount: convertedArray[i].length, + itemBuilder: (context, index) { + SectionList sectionItem = convertedArray[i][index]; + dropdownvalue = + sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List 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 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() + : Padding( + padding: const EdgeInsets.only( + left: 8.0, right: 8.0), + child: Text( + sectionItem.isRequired + ? '${sectionItem.name}:*' + : '${sectionItem.name}:', + style: TextStyle( + color: Colors.orange.shade800, + fontSize: 18.0, + // fontSize: isTablet + // ? 18 + // : 12, + ), + )), + const SizedBox( + height: 15, + ), + sectionItem.widget == InteractionWidget.BUTTON + ? sectionItem.input == 'chooseFile' + ? Row( + children: [ + CustomButton( + backgroundColor: + const Color.fromARGB( + 255, 233, 229, 229), + onPressed: () async { + if (sectionItem.selectedValue! + .isNotEmpty) { + showFilesAlertDialog( + context, + sectionItem.fileName! + .join(','), + sectionItem); + } else { + sectionItem.selectedValue = + []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile( + sectionItem); + } setState(() {}); }, - icon: const Icon( - Icons.cancel, - size: 30, - color: Color.fromARGB( - 255, 8, 39, 92), - ), - ) - : Padding( - padding: const EdgeInsets.only( - left: 3.0, top: 5), - child: CustomButton( - backgroundColor: - const Color.fromARGB( - 255, 233, 75, 75), - onPressed: () { - provider.deleteMultipleRows( - sectionItem.gid!, - sectionList[i], - sectionName); + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem + .selectedValue!.isNotEmpty + ? 'File uploaded' + : 'No file uploaded', + style: TextStyle( + color: sectionItem + .selectedValue! + .isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ) + : isTablet + ? IconButton( + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); - setState(() {}); - }, - // width: 80, - // height: 30, - height: 40, - fontsize: 12, - textColor: Colors.white, - title: "Delete"), - ) - : returnWidget( - sectionItem: sectionItem, - item: item, - provider: provider, - list: list, - gridIndex: i, - listIndex: listIndex, - widgetData: sectionItem.widget!, - multiple: true), - ], - ), - ); - }), - ], - ), + setState(() {}); + }, + icon: const Icon( + Icons.cancel, + size: 30, + color: Color.fromARGB( + 255, 8, 39, 92), + ), + ) + : Padding( + padding: const EdgeInsets.only( + left: 8.0, right: 8.0), + child: CustomButton( + backgroundColor: + const Color.fromARGB( + 255, 233, 75, 75), + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); + + setState(() {}); + }, + // width: 80, + // height: 30, + height: 40, + fontsize: 12, + textColor: Colors.white, + title: "Delete"), + ) + : returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: listIndex, + widgetData: sectionItem.widget!, + multiple: true), + ], + ), + ); + }), + ], ), - ], - ), + ), + ], ); } @@ -1647,9 +1634,26 @@ class _EditInteractionScreenState extends State { -// import 'dart:convert'; + + + + + + + + + + + + + + + +//import 'dart:convert'; // import 'dart:io'; +// import 'package:discover_module/constants.dart'; +// import 'package:discover_module/textScalar.dart'; // import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; // import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart'; // import 'package:discover_module/ui_screen/interactionform/util.dart'; @@ -1658,6 +1662,7 @@ class _EditInteractionScreenState extends State { // import 'package:discover_module/ui_screen/interactionform/widget/customrangeslider.dart'; // import 'package:discover_module/ui_screen/interactionform/widget/interatciontextfield.dart'; // import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; +// import 'package:flutter/cupertino.dart'; // import 'package:flutter/material.dart'; // import 'package:flutter/services.dart'; // import 'package:intl/intl.dart'; @@ -1745,239 +1750,283 @@ class _EditInteractionScreenState extends State { // return Consumer( // builder: (BuildContext context, provider, Widget? child) { // // print("build context"); -// // print("${provider.interactionReponseList}"); +// // print("Providerr_is: ${provider.multipletextEditingControllerList}"); // return GestureDetector( // onTap: () { // 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, -// actions: [saveActions(provider)], -// leading: InkWell( -// onTap: () async { -// await provider.disposeValues().then((value) { -// 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, -// padding: EdgeInsets.zero, -// cacheExtent: double.parse( -// provider.interactionReponseList.length.toString()), -// itemBuilder: (context, index) { -// var item = provider.interactionReponseList[index]; -// sectionList = item.sectionList; -// return Card( -// child: ExpansionTile( -// maintainState: true, -// // backgroundColor: Colors.white, -// // collapsedBackgroundColor: Color(0xFF2b9af3), -// initiallyExpanded: true, -// title: Stack( -// alignment: AlignmentDirectional.center, -// children: [ -// Container( -// // height: double.infinity, -// width: double.infinity, -// padding: const EdgeInsets.all(8.0), -// decoration: const BoxDecoration( -// color: Color(0xFF2b9af3), -// ), -// child: Text( -// item.sectionName, -// style: const TextStyle( -// color: Colors.white, -// fontWeight: FontWeight.bold, -// fontSize: 18.0), -// )), -// item.multiple -// ? Align( -// alignment: Alignment.centerRight, -// child: IconButton( -// onPressed: () { -// provider.getSectionItem( -// item.sectionName); -// // print("index is $listIndex"); -// setState(() { -// // for (var item -// }); -// }, -// icon: const Icon( -// Icons.add_circle_outline, -// size: 30, -// color: Colors.white, -// ), -// ), -// ) -// : const SizedBox.shrink() -// ]), -// 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: 14.0) -// : const EdgeInsets.only( -// left: 12.0, right: 12.0), -// child: GridView.count( -// physics: -// const NeverScrollableScrollPhysics(), -// crossAxisCount: -// context.responsive( -// 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.4, -// 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.input == -// '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!, -// multiple: false), -// // 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, +// actions: [saveActions(provider)], +// leading: InkWell( +// onTap: () async { +// await provider.disposeValues().then((value) { +// 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, +// padding: EdgeInsets.zero, +// cacheExtent: double.parse( +// provider.interactionReponseList.length.toString()), +// itemBuilder: (context, index) { +// var item = provider.interactionReponseList[index]; +// sectionList = item.sectionList; +// return Card( +// child: ExpansionTile( +// maintainState: true, +// // backgroundColor: Colors.white, +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// 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), +// )), +// item.multiple +// ? Align( +// alignment: Alignment.centerRight, +// child: IconButton( +// onPressed: () { +// provider.getSectionItem( +// item.sectionName); +// // print("index is $listIndex"); +// setState(() { +// // for (var item +// }); +// }, +// icon: const Icon( +// Icons.add_circle_outline, +// size: 30, +// color: Colors.white, +// ), +// ), +// ) +// : const SizedBox.shrink() +// ]), +// 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: 14.0) +// : const EdgeInsets.only( +// left: 12.0, right: 12.0), +// child: GridView.count( +// physics: +// const NeverScrollableScrollPhysics(), +// // crossAxisCount: +// // context.responsive( +// // 1, +// // sm: 1, // small +// // md: 1, // medium +// // lg: sectionList.length == 1 +// // ? 1 +// // : 4, // large +// // xl: 3, // extra large screen +// // ), +// crossAxisCount: +// context.responsive( +// 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, +// shrinkWrap: true, +// padding: EdgeInsets.zero, + +// childAspectRatio: +// sectionList.length == 1 +// ? orientation == +// Orientation +// .landscape +// ? 10 +// : 4.8 +// : isTablet +// ? 2.8 +// : 3.5, +// 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.input == +// 'add' +// ? const SizedBox +// .shrink() +// : Padding( +// padding: +// const EdgeInsets +// .only( +// left: 8.0, +// right: 8.0), +// // child: Text( +// // '${sectionItem.name}:*', +// // style: TextStyle( +// // color: Colors +// // .orange +// // .shade800, +// // fontSize: +// // isTablet +// // ? 18 +// // : 12, +// // ), +// // ), +// child: Text( +// sectionItem +// .isRequired +// ? '${sectionItem.name}:*' +// : '${sectionItem.name}:', +// style: TextStyle( +// color: Colors +// .orange +// .shade800, +// fontSize: 18.0, +// // 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!, +// multiple: false), +// // 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), +// ], +// )), +// ); // }), // ); // }); @@ -2008,12 +2057,11 @@ class _EditInteractionScreenState extends State { // return customMultiselectDropdown(sectionItem, provider, list, multiple); // case InteractionWidget.RADIO: -// // return (sectionItem.inputList!.length >= 5) -// // ? customdropdown( -// // sectionItem, provider, sectionItem.inputList!, multiple) -// // : buildRadio(sectionItem, provider); -// return customdropdown( -// sectionItem, provider, sectionItem.inputList!, multiple); +// print("Radiiooooo"); +// return (sectionItem.inputList!.length >= 5) +// ? customdropdown( +// sectionItem, provider, sectionItem.inputList!, multiple) +// : buildRadio(sectionItem, provider); // case InteractionWidget.LABEL: // return Text(sectionItem.input!); @@ -2080,44 +2128,59 @@ class _EditInteractionScreenState extends State { // ? buildDateWidget(sectionItem) // : sectionItem.input == "textArea" // ? Expanded( -// child: InteractionTextField( -// maxchars: int.parse(sectionItem.chars ?? "0"), -// controller: sectionItem.controller!, -// labelText: sectionItem.name, -// // maxlines: 4, -// // minlines: 3, -// onChanged: (val) { -// sectionItem.selectedValue = []; -// setState(() {}); +// child: Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: InteractionTextField( +// maxchars: int.parse(sectionItem.chars ?? "0"), +// controller: sectionItem.controller!, +// labelText: sectionItem.name, +// // maxlines: 4, +// // minlines: 3, +// onChanged: (val) { +// sectionItem.selectedValue = []; +// setState(() {}); -// sectionItem.selectedValue!.add(val); -// }, +// sectionItem.selectedValue!.add(val); +// }, +// ), // ), // ) -// : SizedBox( -// width: isTablet ? 200 : MediaQuery.of(context).size.width, -// height: isTablet ? 50 : 40, -// child: InteractionTextField( -// maxchars: int.parse(sectionItem.chars ?? "0"), -// controller: sectionItem.controller!, -// inputType: sectionItem.input == "number" -// ? TextInputType.number -// : TextInputType.name, -// labelText: sectionItem.name, -// onChanged: (val) { -// sectionItem.selectedValue = []; -// provider.setTextValue(val, sectionItem, multiple); -// }, +// : Expanded( +// child: Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: isTablet ? 200 : MediaQuery.of(context).size.width, +// width: MediaQuery.of(context).size.width, + +// height: isTablet ? 50 : 40, +// child: InteractionTextField( +// maxchars: int.parse(sectionItem.chars ?? "0"), +// controller: sectionItem.controller!, +// inputType: sectionItem.input == "number" +// ? TextInputType.number +// : TextInputType.name, +// labelText: sectionItem.name, +// onChanged: (val) { +// sectionItem.selectedValue = []; +// provider.setTextValue(val, sectionItem, multiple); +// }, +// ), +// ), // ), // ); -// default: -// return customdropdown(sectionItem, provider, list, multiple); +// case InteractionWidget.DROPDOWN: +// // return customdropdown(sectionItem, provider, list, multiple); + +// return customAutoCompletedropdown( +// sectionItem, provider, list, multiple); // } // } // Widget buildDateWidget(SectionList sectionItem) { // return SizedBox( -// width: isTablet ? 200 : MediaQuery.of(context).size.width, +// // width: isTablet ? 200 : MediaQuery.of(context).size.width, +// width: MediaQuery.of(context).size.width, + // height: isTablet ? 50 : 40, // child: TextField( // controller: @@ -2168,23 +2231,38 @@ class _EditInteractionScreenState extends State { // child: Row( // mainAxisAlignment: MainAxisAlignment.spaceEvenly, // children: [ -// CustomButton( -// backgroundColor: Colors.green.shade900, -// onPressed: () async { -// // if (textFieldsValidation(provider).isEmpty) { -// print("widget.saveInteraction ${widget.saveInteraction.intId}"); -// await provider.saveJsonObject(context, -// widget.saveInteraction.intId, widget.saveInteraction); -// showAlertDialog(context, widget.saveInteraction.id); -// // } else { -// // _displaySnackBar(textFieldsValidation(provider)); -// // } -// }, -// textColor: Colors.white, -// title: "Update", -// height: 40, -// width: isTablet ? 120 : 80, -// fontsize: isTablet ? 15 : 12, +// Padding( +// padding: const EdgeInsets.all(4.0), +// child: CustomButton( +// backgroundColor: Colors.green.shade500, +// onPressed: () async { +// // if (textFieldsValidation(provider).isEmpty) { +// await provider.saveJsonObject(context, +// widget.saveInteraction.intId, widget.saveInteraction); + +// // showAlertDialog(context, widget.saveInteraction.id); + +// print("Validation_isss: ${provider.isLoading}"); + +// if (provider.isLoading == false) { +// print("Validation_false"); +// showAlertDialog1(context, "Please fill all the fields"); +// } else { +// showAlertDialog(context, widget.saveInteraction.id); +// print("Validation_True"); +// } +// // } else { +// // _displaySnackBar(textFieldsValidation(provider)); +// // } +// }, +// textColor: Colors.white, +// title: "Update", +// // height: 40, +// // width: isTablet ? 120 : 80, +// height: MediaQuery.of(context).size.height * 0.2, + +// fontsize: isTablet ? 16 : 12, +// ), // ), // SizedBox( // width: isTablet ? 20 : 2, @@ -2198,59 +2276,69 @@ class _EditInteractionScreenState extends State { // List list = provider.getData2(sectionItem); // // .map((itemWord) => InputClass.fromJson(itemWord)) // // .toList(); -// return SizedBox( -// width: isTablet ? 250 : MediaQuery.of(context).size.width, -// child: Row( -// children: [ -// for (InputClass value in list) -// Row( -// children: [ -// Radio( -// value: value.name, -// activeColor: Colors.black, -// groupValue: provider.radioValue, -// onChanged: (String? value) { -// setState(() { -// // print(value); -// provider.radioValue = value!; -// int index = -// list.indexWhere((element) => element.name == value); -// sectionItem.selectedValue!.add(list[index].id); -// }); -// }, -// ), -// Text(value.name), -// ], -// ), -// ], +// return Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: isTablet ? 250 : MediaQuery.of(context).size.width, +// width: MediaQuery.of(context).size.width, + +// child: Row( +// children: [ +// for (InputClass value in list) +// Row( +// children: [ +// Radio( +// value: value.name, +// activeColor: Colors.black, +// groupValue: provider.radioValue, +// onChanged: (String? value) { +// setState(() { +// // print(value); +// provider.radioValue = value!; +// int index = +// list.indexWhere((element) => element.name == value); +// sectionItem.selectedValue!.add(list[index].id); +// }); +// }, +// ), +// Text(value.name), +// ], +// ), +// ], +// ), // ), // ); // } // Widget buildCheckbox(SectionList sectionItem, String sectionName, // ViewInteractionProvider provider, bool multiple) { -// return SizedBox( -// width: 250, -// child: Row( -// children: [ -// for (var value in provider.checkboxlist) -// Row( -// children: [ -// Checkbox( -// value: value.ischecked ?? false, -// activeColor: Colors.black, -// checkColor: Colors.white, -// onChanged: (bool? newvalue) { -// value.ischecked = newvalue!; -// provider.setcheckBoxValue( -// sectionItem, sectionName, newvalue, value.id, multiple); -// //setState(() {}); -// }, -// ), -// Text(value.name), -// ], -// ), -// ], +// return Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: 250, +// width: MediaQuery.of(context).size.width, + +// child: Row( +// children: [ +// for (var value in provider.checkboxlist) +// Row( +// children: [ +// Checkbox( +// value: value.ischecked ?? false, +// activeColor: Colors.black, +// checkColor: Colors.white, +// onChanged: (bool? newvalue) { +// value.ischecked = newvalue!; +// provider.setcheckBoxValue(sectionItem, sectionName, +// newvalue, value.id, multiple); +// //setState(() {}); +// }, +// ), +// Text(value.name), +// ], +// ), +// ], +// ), // ), // ); // } @@ -2258,8 +2346,10 @@ class _EditInteractionScreenState extends State { // Widget customdropdown(SectionList sectionItem, // ViewInteractionProvider provider, List list, bool multiple) { // // sectionItem.value = ''; - +// // print("%%%%${sectionItem.selectedValue!.last}"); +// print("ItemList_is: $list"); // if (list.isEmpty) { +// print("###list empty###"); // list = []; // InputClass inputClass = // InputClass(id: "no value", name: "Select ${sectionItem.name}"); @@ -2267,75 +2357,84 @@ class _EditInteractionScreenState extends State { // sectionItem.selectedObject = list[0]; // } // // InputClass selectedObj = list[0]; -// return SizedBox( -// width: isTablet ? 200 : MediaQuery.of(context).size.width, -// height: isTablet ? 60 : 40, -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), +// return Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: isTablet ? 200 : MediaQuery.of(context).size.width, +// // height: isTablet ? 60 : 40, +// width: MediaQuery.of(context).size.width, + +// child: DropdownButtonFormField2( +// isExpanded: true, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), +// ), +// // Add more decoration.. // ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select ${sectionItem.name}', -// style: const TextStyle(fontSize: 14), -// ), -// items: list -// .map((item) => DropdownMenuItem( -// value: item, -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, +// hint: Text( +// 'Select ${sectionItem.name}', +// style: const TextStyle(fontSize: 14), +// ), +// items: list +// .map((item) => DropdownMenuItem( +// value: item, +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), // ), -// ), -// )) -// .toList(), -// value: sectionItem.selectedObject ?? list[0], -// // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) -// // sectionItem.value ?? list[0].name, -// validator: (value) { -// if (value == null) { -// return 'Please select ${sectionItem.name}'; -// } -// return null; -// }, -// onChanged: (value) { -// //Do something when selected item is changed. -// sectionItem.selectedObject = value!; -// sectionItem.value = value.id; -// provider.setDropDownValue(value.id, sectionItem, multiple, value); -// print("selected ${sectionItem.value}"); -// // setState(() {}); -// }, -// onSaved: (value) { -// sectionItem.selectedObject = value!; -// sectionItem.value = value.id; -// provider.setDropDownValue(value.id, sectionItem, multiple, value); -// // setState(() {}); -// }, -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.only(right: 8), -// ), -// iconStyleData: const IconStyleData( -// icon: Icon( -// Icons.arrow_drop_down, -// color: Colors.black45, +// )) +// .toList(), +// value: sectionItem.selectedValue!.isNotEmpty +// ? list[list.indexWhere( +// (element) => element.id == sectionItem.selectedValue!.last, +// )] +// : list[0], +// // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) +// // sectionItem.value ?? list[0].name, +// validator: (value) { +// if (value == null) { +// return 'Please select ${sectionItem.name}'; +// } +// return null; +// }, +// onChanged: (value) { +// //Do something when selected item is changed. +// sectionItem.selectedObject = value!; +// sectionItem.value = value.id; +// provider.setDropDownValue(value.id, sectionItem, multiple, value); +// print("selected ${sectionItem.value}"); +// // setState(() {}); +// }, +// onSaved: (value) { +// sectionItem.selectedObject = value!; +// sectionItem.value = value.id; +// provider.setDropDownValue(value.id, sectionItem, multiple, value); +// // setState(() {}); +// }, +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.only(right: 8), // ), -// iconSize: 24, -// ), -// dropdownStyleData: DropdownStyleData( -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(15), +// iconStyleData: const IconStyleData( +// icon: Icon( +// Icons.arrow_drop_down, +// color: Colors.black45, +// ), +// iconSize: 24, +// ), +// dropdownStyleData: DropdownStyleData( +// decoration: BoxDecoration( +// borderRadius: BorderRadius.circular(15), +// ), +// ), +// menuItemStyleData: const MenuItemStyleData( +// padding: EdgeInsets.symmetric(horizontal: 16), // ), -// ), -// menuItemStyleData: const MenuItemStyleData( -// padding: EdgeInsets.symmetric(horizontal: 16), // ), // ), // ); @@ -2348,104 +2447,109 @@ class _EditInteractionScreenState extends State { // list = sectionItem.inputList!; // } // //InputClass selectedObj = list[0]; -// return SizedBox( -// width: isTablet ? 200 : MediaQuery.of(context).size.width, -// height: isTablet ? 60 : 40, -// child: DropdownButtonHideUnderline( -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), -// ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select Item', -// style: TextStyle( -// fontSize: 14, -// color: Theme.of(context).hintColor, -// ), -// ), -// items: list -// .map((item) => DropdownMenuItem( -// value: item, -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, -// ), -// ), -// )) -// .toList(), -// value: sectionItem.selectedObject, -// onSaved: (value) { -// sectionItem.selectedObject = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// onChanged: (value) { -// // setState(() { -// sectionItem.selectedObject = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// // setState(() {}); -// //}); -// }, +// return Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: isTablet ? 200 : MediaQuery.of(context).size.width, +// // height: isTablet ? 60 : 40, +// width: MediaQuery.of(context).size.width, -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.symmetric(horizontal: 16), -// height: 40, -// width: 200, -// ), -// dropdownStyleData: const DropdownStyleData( -// maxHeight: 200, -// ), -// menuItemStyleData: const MenuItemStyleData( -// height: 40, -// ), -// dropdownSearchData: DropdownSearchData( -// searchController: textEditingController, -// searchInnerWidgetHeight: 50, -// searchInnerWidget: Container( -// height: 50, -// padding: const EdgeInsets.only( -// top: 8, -// bottom: 4, -// right: 8, -// left: 8, +// child: DropdownButtonHideUnderline( +// child: DropdownButtonFormField2( +// isExpanded: true, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), // ), -// child: TextFormField( -// expands: true, -// maxLines: null, -// controller: textEditingController, -// decoration: InputDecoration( -// isDense: true, -// contentPadding: const EdgeInsets.symmetric( -// horizontal: 10, -// vertical: 8, -// ), -// hintText: 'Search for an item...', -// hintStyle: const TextStyle(fontSize: 12), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(8), +// // Add more decoration.. +// ), +// hint: Text( +// 'Select Item', +// style: TextStyle( +// fontSize: 14, +// color: Theme.of(context).hintColor, +// ), +// ), +// items: list +// .map((item) => DropdownMenuItem( +// value: item, +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), +// ), +// )) +// .toList(), +// value: sectionItem.selectedObject, +// onSaved: (value) { +// sectionItem.selectedObject = value!; +// provider.setAutoCompleteValue(value.id, sectionItem, multiple); +// sectionItem.value = value.name; +// }, +// onChanged: (value) { +// // setState(() { +// sectionItem.selectedObject = value!; +// provider.setAutoCompleteValue(value.id, sectionItem, multiple); +// sectionItem.value = value.name; +// // setState(() {}); +// //}); +// }, + +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.symmetric(horizontal: 16), +// height: 40, +// width: 200, +// ), +// dropdownStyleData: const DropdownStyleData( +// maxHeight: 200, +// ), +// menuItemStyleData: const MenuItemStyleData( +// height: 40, +// ), +// dropdownSearchData: DropdownSearchData( +// searchController: textEditingController, +// searchInnerWidgetHeight: 50, +// searchInnerWidget: Container( +// height: 50, +// padding: const EdgeInsets.only( +// top: 8, +// bottom: 4, +// right: 8, +// left: 8, +// ), +// child: TextFormField( +// expands: true, +// maxLines: null, +// controller: textEditingController, +// decoration: InputDecoration( +// isDense: true, +// contentPadding: const EdgeInsets.symmetric( +// horizontal: 10, +// vertical: 8, +// ), +// hintText: 'Search for an item...', +// hintStyle: const TextStyle(fontSize: 12), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(8), +// ), // ), // ), // ), +// searchMatchFn: (item, searchValue) { +// return item.value!.name.toString().contains(searchValue); +// }, // ), -// searchMatchFn: (item, searchValue) { -// return item.value!.name.toString().contains(searchValue); +// //This to clear the search value when you close the menu +// onMenuStateChange: (isOpen) { +// if (!isOpen) { +// textEditingController.clear(); +// } // }, // ), -// //This to clear the search value when you close the menu -// onMenuStateChange: (isOpen) { -// if (!isOpen) { -// textEditingController.clear(); -// } -// }, // ), // ), // ); @@ -2458,118 +2562,285 @@ class _EditInteractionScreenState extends State { // } // InputClass selectedObj = list[0]; -// return SizedBox( -// width: isTablet ? 200 : MediaQuery.of(context).size.width, -// height: isTablet ? 60 : 40, -// child: DropdownButtonHideUnderline( -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), +// return Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: isTablet ? 200 : MediaQuery.of(context).size.width, +// // height: isTablet ? 60 : 40, +// width: MediaQuery.of(context).size.width, + +// child: DropdownButtonHideUnderline( +// child: DropdownButtonFormField2( +// isExpanded: true, +// decoration: InputDecoration( +// // Add Horizontal padding using menuItemStyleData.padding so it matches +// // the menu padding when button's width is not specified. +// contentPadding: const EdgeInsets.symmetric(vertical: 5), +// border: OutlineInputBorder( +// borderRadius: BorderRadius.circular(15), +// ), +// // Add more decoration.. // ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select Items', -// style: TextStyle( -// fontSize: 14, -// color: Theme.of(context).hintColor, +// hint: Text( +// 'Select Items', +// style: TextStyle( +// fontSize: 14, +// color: Theme.of(context).hintColor, +// ), // ), -// ), -// items: list.map((item) { -// return DropdownMenuItem( -// value: item, -// //disable default onTap to avoid closing menu when selecting an item -// enabled: false, -// child: StatefulBuilder( -// builder: (context, menuSetState) { -// final isSelected = -// sectionItem.selectedValue!.contains(item.name); -// return InkWell( -// onTap: () { -// isSelected -// ? sectionItem.selectedValue!.remove(item.name) -// : sectionItem.selectedValue!.add(item.name); -// //This rebuilds the StatefulWidget to update the button's text -// setState(() {}); -// //This rebuilds the dropdownMenu Widget to update the check mark -// menuSetState(() {}); -// }, -// child: Container( -// height: double.infinity, -// padding: const EdgeInsets.symmetric(horizontal: 16.0), -// child: Row( -// children: [ -// if (isSelected) -// const Icon(Icons.check_box_outlined) -// else -// const Icon(Icons.check_box_outline_blank), -// const SizedBox(width: 16), -// Expanded( -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, +// items: list.map((item) { +// return DropdownMenuItem( +// value: item, +// //disable default onTap to avoid closing menu when selecting an item +// enabled: false, +// child: StatefulBuilder( +// builder: (context, menuSetState) { +// final isSelected = +// sectionItem.selectedValue!.contains(item.name); +// return InkWell( +// onTap: () { +// isSelected +// ? sectionItem.selectedValue!.remove(item.name) +// : sectionItem.selectedValue!.add(item.name); +// //This rebuilds the StatefulWidget to update the button's text +// setState(() {}); +// //This rebuilds the dropdownMenu Widget to update the check mark +// menuSetState(() {}); +// }, +// child: Container( +// height: double.infinity, +// padding: const EdgeInsets.symmetric(horizontal: 16.0), +// child: Row( +// children: [ +// if (isSelected) +// const Icon(Icons.check_box_outlined) +// else +// const Icon(Icons.check_box_outline_blank), +// const SizedBox(width: 16), +// Expanded( +// child: Text( +// item.name, +// style: const TextStyle( +// fontSize: 14, +// ), // ), // ), -// ), -// ], +// ], +// ), // ), +// ); +// }, +// ), +// ); +// }).toList(), +// //Use last selected item as the current value so if we've limited menu height, it scroll to last item. +// value: selectedObj, +// // ? null +// // : provider.selectedItems.last, +// onChanged: (value) { +// selectedObj = value!; +// provider.setAutoCompleteValue(value.id, sectionItem, multiple); +// sectionItem.value = value.name; +// }, +// onSaved: (value) { +// selectedObj = value!; +// provider.setAutoCompleteValue(value.id, sectionItem, multiple); +// sectionItem.value = value.name; +// }, +// selectedItemBuilder: (context) { +// return list.map( +// (item) { +// return Container( +// alignment: AlignmentDirectional.center, +// child: Text( +// sectionItem.selectedValue!.join(', '), +// style: const TextStyle( +// fontSize: 14, +// overflow: TextOverflow.ellipsis, +// ), +// maxLines: 1, // ), // ); // }, -// ), -// ); -// }).toList(), -// //Use last selected item as the current value so if we've limited menu height, it scroll to last item. -// value: selectedObj, -// // ? null -// // : provider.selectedItems.last, -// onChanged: (value) { -// selectedObj = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// onSaved: (value) { -// selectedObj = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// selectedItemBuilder: (context) { -// return list.map( -// (item) { -// return Container( -// alignment: AlignmentDirectional.center, -// child: Text( -// sectionItem.selectedValue!.join(', '), -// style: const TextStyle( -// fontSize: 14, -// overflow: TextOverflow.ellipsis, -// ), -// maxLines: 1, -// ), -// ); -// }, -// ).toList(); -// }, -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.only(left: 16, right: 8), -// height: 40, -// width: 140, -// ), -// menuItemStyleData: const MenuItemStyleData( -// height: 40, -// padding: EdgeInsets.zero, +// ).toList(); +// }, +// buttonStyleData: const ButtonStyleData( +// padding: EdgeInsets.only(left: 16, right: 8), +// height: 40, +// width: 140, +// ), +// menuItemStyleData: const MenuItemStyleData( +// height: 40, +// padding: EdgeInsets.zero, +// ), // ), // ), // ), // ); // } +// // Widget gridViewWidget( +// // ViewInteractionProvider provider, +// // String sectionName, +// // List sectionList, +// // Orientation orientation, +// // FormFieldData item, +// // int listIndex) { +// // print("SectionListtt:isss: $sectionList"); +// // return Padding( +// // padding: isTablet +// // ? const EdgeInsets.only(left: 8.0) +// // : const EdgeInsets.only(left: 12.0, right: 12.0), +// // child: GridView.count( +// // physics: const NeverScrollableScrollPhysics(), +// // crossAxisCount: context.responsive( +// // 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 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, +// // ), +// // sectionItem.widget == InteractionWidget.BUTTON +// // ? sectionItem.input == 'chooseFile' +// // ? Row( +// // children: [ +// // CustomButton( +// // backgroundColor: const Color.fromARGB( +// // 255, 233, 229, 229), +// // onPressed: () async { +// // if (sectionItem +// // .selectedValue!.isNotEmpty) { +// // showFilesAlertDialog( +// // context, +// // sectionItem.fileName!.join(','), +// // sectionItem); +// // } else { +// // sectionItem.selectedValue = []; +// // sectionItem.extension = []; +// // sectionItem.fileName = []; +// // await getEncodedFile(sectionItem); +// // } +// // setState(() {}); +// // }, +// // width: 120, +// // height: 40, +// // fontsize: 12, +// // textColor: Colors.black, +// // title: sectionItem.name), +// // const SizedBox( +// // width: 5, +// // ), +// // Text( +// // sectionItem.selectedValue!.isNotEmpty +// // ? 'File uploaded' +// // : 'No file uploaded', +// // style: TextStyle( +// // color: +// // sectionItem.selectedValue!.isNotEmpty +// // ? Colors.green +// // : Colors.red), +// // ), +// // ], +// // ) +// // : isTablet +// // ? IconButton( +// // onPressed: () { +// // provider.deleteMultipleRows( +// // sectionItem.gid!, +// // sectionList[i], +// // sectionName); + +// // setState(() {}); +// // }, +// // icon: const Icon( +// // Icons.cancel, +// // size: 30, +// // color: Color.fromARGB(255, 8, 39, 92), +// // ), +// // ) +// // : Padding( +// // padding: +// // const EdgeInsets.only(left: 3.0, top: 5), +// // child: CustomButton( +// // backgroundColor: const Color.fromARGB( +// // 255, 233, 75, 75), +// // onPressed: () { +// // provider.deleteMultipleRows( +// // sectionItem.gid!, +// // sectionList[i], +// // sectionName); + +// // setState(() {}); +// // }, +// // width: 80, +// // height: 30, +// // fontsize: 12, +// // textColor: Colors.white, +// // title: "Delete"), +// // ) +// // : returnWidget( +// // sectionItem: sectionItem, +// // item: item, +// // provider: provider, +// // list: list, +// // gridIndex: i, +// // listIndex: listIndex, +// // widgetData: sectionItem.widget!, +// // multiple: true), +// // ], +// // ), +// // ]); +// // }, +// // ), +// // ), +// // ); +// // } + // Widget gridViewWidget( // ViewInteractionProvider provider, // String sectionName, @@ -2577,156 +2848,215 @@ class _EditInteractionScreenState extends State { // Orientation orientation, // FormFieldData item, // int listIndex) { +// print("SectionListtt:isss: $sectionList"); + +// List pooja = sectionList; + +// print("Pooja: $pooja"); + +// List> 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("ConvertedArrayEditMulti.leangth: $convertedArray"); +// print("ConvertedArray.leangth: ${convertedArray.length}"); // return Padding( // padding: isTablet -// ? const EdgeInsets.only(left: 8.0) +// ? const EdgeInsets.only(left: 0.0) // : const EdgeInsets.only(left: 12.0, right: 12.0), -// child: GridView.count( -// physics: const NeverScrollableScrollPhysics(), -// crossAxisCount: context.responsive( -// 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 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, +// child: Column( +// children: [ +// for (var i = 0; i < convertedArray.length; i++) +// DecoratedBox( +// decoration: BoxDecoration( +// color: i % 2 == 0 +// ? Color.fromARGB(133, 213, 241, 254) +// : Colors.white, +// ), +// child: Wrap( // 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, -// ), +// //GestureDetector(child: Text("data")), +// GridView.builder( +// physics: const NeverScrollableScrollPhysics(), +// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( +// crossAxisCount: context.responsive( +// 1, +// sm: 1, // small +// md: 2, // medium +// lg: sectionList.length == 1 +// ? 1 +// : (sectionList.length >= 1 ? 3 : 3), // large +// xl: 3, // extra large screen // ), -// const SizedBox( -// height: 15, -// ), -// sectionItem.widget == InteractionWidget.BUTTON -// ? sectionItem.input == 'chooseFile' -// ? Row( -// children: [ -// CustomButton( -// backgroundColor: const Color.fromARGB( -// 255, 233, 229, 229), -// onPressed: () async { -// if (sectionItem -// .selectedValue!.isNotEmpty) { -// showFilesAlertDialog( -// context, -// sectionItem.fileName!.join(','), -// sectionItem); -// } else { -// sectionItem.selectedValue = []; -// sectionItem.extension = []; -// sectionItem.fileName = []; -// await getEncodedFile(sectionItem); -// } -// setState(() {}); -// }, -// width: 120, -// height: 40, -// fontsize: 12, -// textColor: Colors.black, -// title: sectionItem.name), -// const SizedBox( -// width: 5, -// ), -// Text( -// sectionItem.selectedValue!.isNotEmpty -// ? 'File uploaded' -// : 'No file uploaded', -// style: TextStyle( -// color: -// sectionItem.selectedValue!.isNotEmpty -// ? Colors.green -// : Colors.red), -// ), -// ], -// ) -// : isTablet -// ? IconButton( -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); +// mainAxisSpacing: +// sectionList.length == 1 || !isTablet ? 1 : 2, +// childAspectRatio: sectionList.length == 1 +// ? orientation == Orientation.landscape +// ? 10 +// : 4.8 +// : isTablet +// ? 2.8 +// : 3.0, +// ), +// shrinkWrap: true, +// padding: EdgeInsets.zero, +// itemCount: convertedArray[i].length, +// itemBuilder: (context, index) { +// SectionList sectionItem = convertedArray[i][index]; +// dropdownvalue = +// sectionItem.widget == InteractionWidget.DROPDOWN +// ? sectionItem.value ?? "Select" +// : ' '; +// List 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) +// : []; -// setState(() {}); -// }, -// icon: const Icon( -// Icons.cancel, -// size: 30, -// color: Color.fromARGB(255, 8, 39, 92), -// ), -// ) -// : Padding( -// padding: -// const EdgeInsets.only(left: 3.0, top: 5), -// child: CustomButton( -// backgroundColor: const Color.fromARGB( -// 255, 233, 75, 75), -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); +// 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() +// : Padding( +// padding: const EdgeInsets.only( +// left: 8.0, right: 8.0), +// child: Text( +// sectionItem.isRequired +// ? '${sectionItem.name}:*' +// : '${sectionItem.name}:', +// style: TextStyle( +// color: Colors.orange.shade800, +// fontSize: 18.0, +// // fontSize: isTablet +// // ? 18 +// // : 12, +// ), +// )), +// const SizedBox( +// height: 15, +// ), +// sectionItem.widget == InteractionWidget.BUTTON +// ? sectionItem.input == 'chooseFile' +// ? Row( +// children: [ +// CustomButton( +// backgroundColor: +// const Color.fromARGB( +// 255, 233, 229, 229), +// onPressed: () async { +// if (sectionItem.selectedValue! +// .isNotEmpty) { +// showFilesAlertDialog( +// context, +// sectionItem.fileName! +// .join(','), +// sectionItem); +// } else { +// sectionItem.selectedValue = +// []; +// sectionItem.extension = []; +// sectionItem.fileName = []; +// await getEncodedFile( +// sectionItem); +// } +// setState(() {}); +// }, +// width: 120, +// height: 40, +// fontsize: 12, +// textColor: Colors.black, +// title: sectionItem.name), +// const SizedBox( +// width: 5, +// ), +// Text( +// sectionItem +// .selectedValue!.isNotEmpty +// ? 'File uploaded' +// : 'No file uploaded', +// style: TextStyle( +// color: sectionItem +// .selectedValue! +// .isNotEmpty +// ? Colors.green +// : Colors.red), +// ), +// ], +// ) +// : isTablet +// ? IconButton( +// onPressed: () { +// provider.deleteMultipleRows( +// sectionItem.gid!, +// sectionList[i], +// sectionName); -// setState(() {}); -// }, -// width: 80, -// height: 30, -// fontsize: 12, -// textColor: Colors.white, -// title: "Delete"), -// ) -// : returnWidget( -// sectionItem: sectionItem, -// item: item, -// provider: provider, -// list: list, -// gridIndex: i, -// listIndex: listIndex, -// widgetData: sectionItem.widget!, -// multiple: true), +// setState(() {}); +// }, +// icon: const Icon( +// Icons.cancel, +// size: 30, +// color: Color.fromARGB( +// 255, 8, 39, 92), +// ), +// ) +// : Padding( +// padding: const EdgeInsets.only( +// left: 3.0, top: 5), +// child: CustomButton( +// backgroundColor: +// const Color.fromARGB( +// 255, 233, 75, 75), +// onPressed: () { +// provider.deleteMultipleRows( +// sectionItem.gid!, +// sectionList[i], +// sectionName); + +// setState(() {}); +// }, +// // width: 80, +// // height: 30, +// height: 40, +// fontsize: 12, +// textColor: Colors.white, +// title: "Delete"), +// ) +// : returnWidget( +// sectionItem: sectionItem, +// item: item, +// provider: provider, +// list: list, +// gridIndex: i, +// listIndex: listIndex, +// widgetData: sectionItem.widget!, +// multiple: true), +// ], +// ), +// ); +// }), // ], // ), -// ]); -// }, -// ), +// ), +// ], // ), // ); // } @@ -2848,6 +3178,35 @@ class _EditInteractionScreenState extends State { // ); // } +// showAlertDialog1(BuildContext context, String record) { +// // set up the buttons +// // ViewInteractionProvider provider = +// // Provider.of(context, listen: false); +// Widget cancelButton = TextButton( +// child: const Text("Ok"), +// onPressed: () async { +// Navigator.of(context).pop(); +// }, +// ); + +// // set up the AlertDialog +// AlertDialog alert = AlertDialog( +// title: const Text(""), +// content: Text(record), +// actions: [ +// cancelButton, +// ], +// ); + +// // show the dialog +// showDialog( +// context: context, +// builder: (BuildContext context) { +// return alert; +// }, +// ); +// } + // showFilesAlertDialog( // BuildContext context, String files, SectionList sectionItem) { // // set up the buttons @@ -2888,3 +3247,31 @@ class _EditInteractionScreenState extends State { // ); // } // } + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/ui_screen/interactionform/interaction_screen.dart b/lib/ui_screen/interactionform/interaction_screen.dart index 246ca02..65b0b4d 100644 --- a/lib/ui_screen/interactionform/interaction_screen.dart +++ b/lib/ui_screen/interactionform/interaction_screen.dart @@ -1,10 +1,7 @@ import 'dart:convert'; import 'dart:io'; -// import 'dart:js_interop'; -// import 'dart:js_util'; import 'package:discover_module/constants.dart'; -import 'package:discover_module/custom_widget/floating_btn.dart'; import 'package:discover_module/ui_screen/add_event/add_hcp.dart'; import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; @@ -103,6 +100,7 @@ class _InteractionScreenState extends State { ), ), body: Column( + mainAxisSize: MainAxisSize.min, children: [ Expanded( child: ListView.builder( @@ -113,370 +111,272 @@ class _InteractionScreenState extends State { itemBuilder: (context, index) { var item = provider.interactionReponseList[index]; sectionList = item.sectionList; - return ExpansionTile( - maintainState: true, - // backgroundColor: Colors.white, - // collapsedBackgroundColor: Color(0xFF2b9af3), - 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: isTablet ? 18 : 14 - ), - )), - item.multiple - ? Align( - alignment: Alignment.centerRight, - child: IconButton( - onPressed: () { - if (item.sectionName == "HCP") { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - Addhcp())); - - provider.getSectionItem( - item.sectionName, - ); - // print("index is $listIndex"); - setState(() { - // for (var item - }); - } else { - provider.getSectionItem( - item.sectionName, - ); - // print("index is $listIndex"); - setState(() {}); - } - }, - icon: const Icon( - Icons.add_circle_outline, - size: 30, - color: Colors.white, + return Column( + children: [ + Card( + color: Constants.k2color, + child: ExpansionTile( + maintainState: true, + backgroundColor: Constants.k2color, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Stack( + alignment: AlignmentDirectional.center, + children: [ + Container( + // height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.all(0.0), + decoration: BoxDecoration( + // color: Color(0xFF2b9af3), + color: Constants.k2color, ), - ), - ) - : const SizedBox.shrink() - ]), - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, + child: Text( + item.sectionName, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + // fontSize: isTablet ? 18 : 14 + ), + )), + item.multiple + ? Align( + alignment: + Alignment.centerRight, + child: IconButton( + onPressed: () { + if (item.sectionName == + "HCP") { + Navigator.push( + context, + MaterialPageRoute( + builder: + (context) => + Addhcp())); + + provider.getSectionItem( + item.sectionName, + ); + // print("index is $listIndex"); + setState(() { + // for (var item + }); + } else { + provider.getSectionItem( + item.sectionName, + ); + // print("index is $listIndex"); + setState(() {}); + } + }, + icon: const Icon( + Icons.add_circle_outline, + size: 30, + color: Colors.white, + ), + ), + ) + : const SizedBox.shrink() + ]), children: [ - Padding( - padding: isTablet - ? const EdgeInsets.only(left: 14.0) - : const EdgeInsets.only( - left: 12.0, right: 12.0), - child: GridView.count( - physics: - const NeverScrollableScrollPhysics(), - // crossAxisCount: - // context.responsive( - // 1, - // sm: 1, // small - // md: 1, // medium - // lg: sectionList.length == 1 - // ? 1 - // : 3, // large - // xl: 3, // extra large screen - // ), + Container( + color: Colors.white, + child: Padding( + padding: + const EdgeInsets.only(top: 8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + GridView.count( + physics: + const NeverScrollableScrollPhysics(), - crossAxisCount: context.responsive( - 1, - sm: 1, // small - md: isTablet - ? 2 - : orientation == - Orientation.landscape - ? 2 - : 1, // medium - lg: sectionList.length == 1 - ? 1 - : 3, // large - xl: 3, // extra large screen - ), + crossAxisCount: + context.responsive( + 1, + sm: 1, // small + md: isTablet + ? 2 + : orientation == + Orientation + .landscape + ? 2 + : 1, // medium + lg: sectionList.length == 1 + ? 1 + : 3, // large + xl: 3, // extra large screen + ), - // crossAxisCount: - // orientation == Orientation.portrait - // ? 1 - // : 3, - // crossAxisCount: (MediaQuery.of(context) - // .orientation == - // Orientation.landscape) - // ? 3 - // : 1, + mainAxisSpacing: + sectionList.length == 1 || + !isTablet + ? 1 + : 3.5, + // mainAxisSpacing: + // orientation == Orientation.portrait + // ? 1 + // : 3, + shrinkWrap: true, + padding: EdgeInsets.zero, - mainAxisSpacing: - sectionList.length == 1 || !isTablet - ? 1 - : 3.5, - // mainAxisSpacing: - // orientation == Orientation.portrait - // ? 1 - // : 3, - shrinkWrap: true, - padding: EdgeInsets.zero, - // childAspectRatio: MediaQuery.of(context) - // .size - // .aspectRatio * - // 0.10, - // childAspectRatio: - // sectionList.length == 1 - // ? orientation == - // Orientation.landscape - // ? 10 - // : 3.8 - // : 2.4, - // childAspectRatio: - // sectionList.length == 1 - // ? orientation == - // Orientation.landscape - // ? 10 - // : 3.8 - // : isTablet - // ? 2.8 - // : 3.8, + // childAspectRatio: + // sectionList.length == 1 + // ? orientation == + // Orientation.landscape + // ? 10 + // : 4.8 + // : isTablet + // ? 2.8 + // : 3.0, - childAspectRatio: - sectionList.length == 1 - ? orientation == - Orientation.landscape - ? 10 - : 4.8 - : isTablet - ? 2.8 - : 3.0, - // /:2.4, - // childAspectRatio: 3.8, + childAspectRatio: + sectionList.length == 1 + ? orientation == + Orientation + .landscape + ? 10 + : 4.8 + : isTablet + ? 2.8 + : 3.5, - children: List.generate( - sectionList.length, - (i) { - SectionList sectionItem = - sectionList[i]; - dropdownvalue = sectionItem - .widget == - InteractionWidget.DROPDOWN - ? sectionItem.value ?? "Select" - : ' '; - List 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) - : []; + children: List.generate( + sectionList.length, + (i) { + 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.input == - 'add' - ? const SizedBox.shrink() - : Padding( - padding: - const EdgeInsets - .only( - left: 8.0, - right: 8.0), - child: FittedBox( - fit: BoxFit.scaleDown, - child: Text( - sectionItem - .validation! - .isRequired - ? '${sectionItem.name}:*' - : '${sectionItem.name}:', - style: TextStyle( - color: Colors - .orange - .shade800, - fontSize: 18.0, - // fontSize: isTablet - // ? 18 - // : 12, + return Column( + //mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + sectionItem.widget == + InteractionWidget + .BUTTON && + sectionItem + .input == + 'add' + ? const SizedBox + .shrink() + : Padding( + padding: + const EdgeInsets + .only( + left: 8.0, + right: + 8.0), + child: FittedBox( + fit: BoxFit + .scaleDown, + child: Text( + sectionItem + .validation! + .isRequired + ? '${sectionItem.name}:*' + : '${sectionItem.name}:', + style: + TextStyle( + color: Colors + .orange + .shade800, + fontSize: + 18.0, + // 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!, - multiple: false), - // SizedBox( - // height: isTablet ? 15 : 5, - // ), - - // sectionItem.depid == 'pooja' - // ? Text( - // sectionItem.validation! - // .isRequired - // ? '${sectionItem.depid}:*' - // : '${sectionItem.depid}:', - // style: TextStyle( - // color: Colors - // .orange.shade800, - // fontSize: isTablet - // ? 18 - // : 12, - // ), - // ) - // : const SizedBox.shrink(), - ], - ); - }, + returnWidget( + sectionItem: + sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: index, + widgetData: + sectionItem + .widget!, + multiple: false), + ], + ); + }, + ), + ), + // 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(), + ], ), ), ), - // 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), - Align( - alignment: Alignment.bottomRight, - child: Container( - height: 80.0, - width: 80.0, - child: _offsetPopup(provider.interactionReponseList))) + // Align( + // alignment: Alignment.bottomRight, + // child: Container( + // height: 80.0, + // width: 80.0, + // child: _offsetPopup(provider.interactionReponseList))) ], ), - // floatingActionButton: FloatingBtn( - // title: "data", - // icon: Icons.add, - // onTap: () { - // showPopover( - // context: context, - // bodyBuilder: (context) { - // return Padding( - // padding: const EdgeInsets.symmetric(vertical: 8), - // child: ListView( - // padding: const EdgeInsets.all(8), - // children: [ - // InkWell( - // onTap: () { - - // }, - // child: Container( - // height: 50, - // color: Colors.amber[100], - // child: const Center(child: Text('Entry A')), - // ), - // ), - // const Divider(), - // Container( - // height: 50, - // color: Colors.amber[200], - // child: const Center(child: Text('Entry B')), - // ), - // const Divider(), - // Container( - // height: 50, - // color: Colors.amber[300], - // child: const Center(child: Text('Entry C')), - // ), - // const Divider(), - // Container( - // height: 50, - // color: Colors.amber[400], - // child: const Center(child: Text('Entry D')), - // ), - // const Divider(), - // Container( - // height: 50, - // color: Colors.amber[500], - // child: const Center(child: Text('Entry E')), - // ), - // const Divider(), - // Container( - // height: 50, - // color: Colors.amber[600], - // child: const Center(child: Text('Entry F')), - // ), - // ], - // ), - // ); - // }, - // ); - - // var itemsectionname = - // provider.interactionReponseList.length; - - // print("ItemSectionname: $itemsectionname"); - - // for (int i = 0; i < itemsectionname; i++) { - // var item = provider.interactionReponseList[i]; - - // print( - // "Check_ProviderNameL ${item.sectionName}, ${item.multiple}"); - // } - - // // provider.getSectionItem( - // // item.sectionName, - // // ); - // }, - // ) ), ); }), @@ -578,18 +478,21 @@ class _InteractionScreenState extends State { ? buildDateWidget(sectionItem) : sectionItem.input == "textArea" ? Expanded( - child: InteractionTextField( - // maxchars: int.parse(sectionItem.validation!.chars ?? "0"), - controller: sectionItem.controller!, - labelText: sectionItem.name, - // maxlines: 8, - //minlines: 4, - onChanged: (val) { - sectionItem.selectedValue = []; - setState(() {}); + child: Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: InteractionTextField( + // maxchars: int.parse(sectionItem.validation!.chars ?? "0"), + controller: sectionItem.controller!, + labelText: sectionItem.name, + // maxlines: 8, + //minlines: 4, + onChanged: (val) { + sectionItem.selectedValue = []; + setState(() {}); - sectionItem.selectedValue!.add(val); - }, + sectionItem.selectedValue!.add(val); + }, + ), ), ) ////Poojaaaaa @@ -704,7 +607,9 @@ class _InteractionScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Padding( - padding: const EdgeInsets.all(4.0), + // padding: const EdgeInsets.all(4.0), + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0, right: 5.0), + child: CustomButton( backgroundColor: Colors.red.shade800, onPressed: () { @@ -713,10 +618,6 @@ class _InteractionScreenState extends State { in provider.textEditingControllerList) { textcontrollers.text = ''; } - - // setState(() { - // provider.resetAllWidgetsData(); - // }); }, textColor: Colors.white, title: "Reset", @@ -724,49 +625,23 @@ class _InteractionScreenState extends State { // width: isTablet ? 100 : 80, height: MediaQuery.of(context).size.height * 0.2, - fontsize: isTablet ? 15 : 10.2, + // fontsize: isTablet ? 15 : 10.2, + fontsize: isTablet ? 16 : 12, ), ), SizedBox( - width: isTablet ? 20 : 4, + //width: isTablet ? 20 : 4, + width: isTablet ? 20 : 2, ), Padding( - padding: const EdgeInsets.all(4.0), + // padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), + child: CustomButton( backgroundColor: Colors.green.shade500, onPressed: () async { - // if (textFieldsValidation(provider).isEmpty) { - // print("Form_issss: ${widget.form}"); - // String record = - // await provider.saveJsonObject(context, widget.form); - // showAlertDialog(context, record); - // } else { - // _displaySnackBar(textFieldsValidation(provider)); - // } - - ////////////////////////////////////////////////actual code/////////////////// - /// - // String record = - // await provider.saveJsonObject(context, widget.form); - // showAlertDialog(context, record); - - ///Cnahging Code////////////// - /// - /// - ///validateTextFields - - // if (provider.validateTextFields()) { - // print("Form_issss: ${widget.form}"); String record = await provider.saveJsonObject(context, widget.form); - // showAlertDialog(context, record); - - // for (int i = 0; i < sectionList.length; i++) { - // SectionList sectionItem = sectionList[i]; - - // print( - // "ValidationMandotary_isss: ${sectionItem.validation!.isRequired}"); - // } print("Validation_isss: ${provider.isLoading}"); @@ -777,11 +652,6 @@ class _InteractionScreenState extends State { showAlertDialog(context, "Form $record Saved Successfully!"); print("Validation_True"); } - - // print("Interaction_Type:"); - // } else { - // _displaySnackBar(textFieldsValidation(provider)); - // } }, textColor: Colors.white, title: "Save", @@ -854,7 +724,9 @@ class _InteractionScreenState extends State { children: [ FittedBox( fit: BoxFit.scaleDown, - child: Checkbox( + child: CheckboxListTile( + dense: true, + //contentPadding: const EdgeInsets.symmetric(vertical: 5), value: value.ischecked ?? false, activeColor: Colors.black, checkColor: Colors.white, @@ -897,9 +769,10 @@ class _InteractionScreenState extends State { decoration: InputDecoration( // Add Horizontal padding using menuItemStyleData.padding so it matches // the menu padding when button's width is not specified. + isDense: true, contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10.0), ), // Add more decoration.. ), @@ -953,7 +826,7 @@ class _InteractionScreenState extends State { ), dropdownStyleData: DropdownStyleData( decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10.0), ), ), menuItemStyleData: const MenuItemStyleData( @@ -966,10 +839,6 @@ class _InteractionScreenState extends State { Widget customAutoCompletedropdown(SectionList sectionItem, InteractionProvider provider, List list, bool multiple) { - // sectionItem.value = list[0].name; - - // if (list.isEmpty) { - // print("list is empty"); list = sectionItem.inputList!; print("***Autocomplete list ${list[0].name}"); //} @@ -987,9 +856,10 @@ class _InteractionScreenState extends State { decoration: InputDecoration( // Add Horizontal padding using menuItemStyleData.padding so it matches // the menu padding when button's width is not specified. + isDense: true, contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10.0), ), // Add more decoration.. ), @@ -1056,12 +926,12 @@ class _InteractionScreenState extends State { isDense: true, contentPadding: const EdgeInsets.symmetric( horizontal: 10, - vertical: 8, + vertical: 18, ), hintText: 'Search for an item...', hintStyle: const TextStyle(fontSize: 12), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(10.0), ), ), ), @@ -1103,9 +973,10 @@ class _InteractionScreenState extends State { decoration: InputDecoration( // Add Horizontal padding using menuItemStyleData.padding so it matches // the menu padding when button's width is not specified. + isDense: true, contentPadding: const EdgeInsets.symmetric(vertical: 5), border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15), + borderRadius: BorderRadius.circular(10.0), ), // Add more decoration.. ), @@ -1227,12 +1098,6 @@ class _InteractionScreenState extends State { print("Pooja_leangth_isss: ${pooja.length}"); ////////////////////////////////////mycode/////////////////////////// - /// - /// - // final provider = context.read(); - // var yourVariable = provider.ge; - // print("ProviderLength: $yourVariable"); - // print("ProviderLength: ${yourVariable.length}"); List> convertedArray = []; print("Provider_leangth: ${item.sectionList.length}"); @@ -1245,192 +1110,182 @@ class _InteractionScreenState extends State { print("ConvertedArray.leangth: $convertedArray"); print("ConvertedArray.leangth: ${convertedArray.length}"); - return Padding( - padding: isTablet - ? const EdgeInsets.only(left: 0.0) - : const EdgeInsets.only(left: 12.0, right: 12.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - for (var i = 0; i < convertedArray.length; i++) - DecoratedBox( - decoration: BoxDecoration( - // border: Border.all(color: Colors.black), - // borderRadius: BorderRadius.circular(10.0), - color: i % 2 == 0 - ? Color.fromARGB(133, 213, 241, 254) - : Colors.white, - ), - child: GridView.builder( - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: context.responsive( - 1, - sm: 1, // small - md: isTablet - ? 2 - : orientation == Orientation.landscape - ? 2 - : 1, // medium - lg: sectionList.length == 1 ? 1 : 3, // large - xl: 3, // extra large screen - ), - mainAxisSpacing: - sectionList.length == 1 || !isTablet ? 1 : 1, - childAspectRatio: sectionList.length == 1 - ? orientation == Orientation.landscape - ? 10 - : 4.8 - : isTablet - ? 2.8 - : 3.0, + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + for (var i = 0; i < convertedArray.length; i++) + DecoratedBox( + decoration: BoxDecoration( + // border: Border.all(color: Colors.black), + // borderRadius: BorderRadius.circular(10.0), + color: i % 2 == 0 + ? Color.fromARGB(133, 213, 241, 254) + : Colors.white, + ), + child: GridView.builder( + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: context.responsive( + 1, + sm: 1, // small + md: isTablet + ? 2 + : orientation == Orientation.landscape + ? 2 + : 1, // medium + lg: sectionList.length == 1 ? 1 : 3, // large + xl: 3, // extra large screen ), - shrinkWrap: true, - padding: EdgeInsets.zero, - itemCount: convertedArray[i].length, - itemBuilder: (context, index) { - SectionList sectionItem = convertedArray[i][index]; - dropdownvalue = - sectionItem.widget == InteractionWidget.DROPDOWN - ? sectionItem.value ?? "Select" - : ' '; - List 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 SizedBox( - height: MediaQuery.of(context).size.height, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - sectionItem.widget == InteractionWidget.BUTTON && - sectionItem.input == 'add' || - sectionItem.input == 'deletebtn' - ? const SizedBox.shrink() - : Padding( - padding: const EdgeInsets.only( - left: 8.0, right: 8.0), - child: FittedBox( - fit: BoxFit.scaleDown, - child: Text( - sectionItem.validation!.isRequired - ? "${sectionItem.name}*" - : sectionItem.name, - style: TextStyle( - color: Colors.orange.shade800, - fontSize: 18), - ), - ), - ), - // const SizedBox( - // height: 15, - // ), - sectionItem.widget == InteractionWidget.BUTTON - ? sectionItem.input == 'chooseFile' - ? Row( - children: [ - CustomButton( - backgroundColor: - const Color.fromARGB( - 255, 233, 229, 229), - onPressed: () async { - sectionItem.selectedValue = []; - sectionItem.extension = []; - sectionItem.fileName = []; - await getEncodedFile(sectionItem); - - setState(() {}); - }, - width: 120, - height: 40, - fontsize: 12, - textColor: Colors.black, - title: sectionItem.name), - const SizedBox( - width: 5, - ), - Text( - sectionItem.selectedValue!.isNotEmpty - ? sectionItem - .selectedValue!.isNotEmpty - ? 'File uploaded' - : "Files Uploaded" - : 'No file uploaded', - style: TextStyle( - color: sectionItem - .selectedValue!.isNotEmpty - ? Colors.green - : Colors.red), - ), - ], - ) - : isTablet - ? IconButton( - onPressed: () { - provider.deleteMultipleRows( - sectionItem.gid!, - sectionList[i], - sectionName); + mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 1, + childAspectRatio: sectionList.length == 1 + ? orientation == Orientation.landscape + ? 10 + : 4.8 + : isTablet + ? 2.8 + : 3.7, + ), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemCount: convertedArray[i].length, + itemBuilder: (context, index) { + SectionList sectionItem = convertedArray[i][index]; + dropdownvalue = + sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List 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 Padding( + padding: const EdgeInsets.only(top: 12.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // sectionItem.widget == InteractionWidget.BUTTON && + // sectionItem.input == 'add' || + // sectionItem.input == 'deletebtn' + // ? const SizedBox.shrink() + // : + Padding( + padding: const EdgeInsets.only(left: 8.0, right: 8.0), + child: FittedBox( + fit: BoxFit.scaleDown, + child: Text( + sectionItem.validation!.isRequired + ? "${sectionItem.name}*" + : sectionItem.name, + style: TextStyle( + color: Colors.orange.shade800, fontSize: 18), + ), + ), + ), + // const SizedBox( + // height: 15, + // ), + sectionItem.widget == InteractionWidget.BUTTON + ? sectionItem.input == 'chooseFile' + ? Row( + children: [ + CustomButton( + backgroundColor: const Color.fromARGB( + 255, 233, 229, 229), + onPressed: () async { + sectionItem.selectedValue = []; + sectionItem.extension = []; + sectionItem.fileName = []; + await getEncodedFile(sectionItem); setState(() {}); }, - icon: const Icon( - Icons.cancel, - size: 30, - color: - Color.fromARGB(255, 8, 39, 92), - ), - ) - : Padding( - padding: const EdgeInsets.only( - left: 3.0, top: 5), - child: CustomButton( - backgroundColor: - const Color.fromARGB( - 255, 233, 75, 75), - onPressed: () { - provider.deleteMultipleRows( - sectionItem.gid!, - sectionList[i], - sectionName); + width: 120, + height: 40, + fontsize: 12, + textColor: Colors.black, + title: sectionItem.name), + const SizedBox( + width: 5, + ), + Text( + sectionItem.selectedValue!.isNotEmpty + ? sectionItem + .selectedValue!.isNotEmpty + ? 'File uploaded' + : "Files Uploaded" + : 'No file uploaded', + style: TextStyle( + color: sectionItem + .selectedValue!.isNotEmpty + ? Colors.green + : Colors.red), + ), + ], + ) + : isTablet + ? IconButton( + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); - setState(() {}); - }, - // width: 80, - // height: 30, + setState(() {}); + }, + icon: const Icon( + Icons.cancel, + size: 30, + color: Color.fromARGB(255, 8, 39, 92), + ), + ) + : Padding( + padding: const EdgeInsets.only( + left: 8.0, right: 8.0), + child: CustomButton( + backgroundColor: + const Color.fromARGB( + 255, 233, 75, 75), + onPressed: () { + provider.deleteMultipleRows( + sectionItem.gid!, + sectionList[i], + sectionName); - height: 40, + setState(() {}); + }, + height: 40, - // height: - // MediaQuery.of(context).size.height * - // 0.2, - fontsize: 12, - textColor: Colors.white, - title: "Delete"), - ) - : returnWidget( - sectionItem: sectionItem, - item: item, - provider: provider, - list: list, - gridIndex: i, - listIndex: listIndex, - widgetData: sectionItem.widget!, - multiple: true), - ], - ), - ); - }), - ) - ], - ), + // height: + // MediaQuery.of(context).size.height * + // 0.2, + fontsize: 12, + textColor: Colors.white, + title: "Delete"), + ) + : returnWidget( + sectionItem: sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: listIndex, + widgetData: sectionItem.widget!, + multiple: true), + ], + ), + ); + }), + ) + ], ); //); } @@ -1446,25 +1301,6 @@ class _InteractionScreenState extends State { } String textFieldsValidation(InteractionProvider provider) { - // if (provider.sectionList - // .any((element) => element.widget == InteractionWidget.TEXT)) { - // if (provider.sectionList - // .any((element) => element.controller!.text.isEmpty)) { - // return 'Fields cannot be empty'; - // } - // if (provider.textEditingControllerList.isNotEmpty) { - // if (provider.validateTextFields()) { - // return 'Fields cannot be empty'; - // } - // } - - // if (provider.multipletextEditingControllerList.isNotEmpty) { - // if (provider.validateMultipleRows()) { - // return 'Fields cannot be empty'; - // } - // } - // } - return ''; } @@ -1529,9 +1365,6 @@ class _InteractionScreenState extends State { } showAlertDialog(BuildContext context, String record) { - // set up the buttons - // ViewInteractionProvider provider = - // Provider.of(context, listen: false); Widget cancelButton = TextButton( child: const Text("Ok"), onPressed: () async { @@ -1559,9 +1392,6 @@ class _InteractionScreenState extends State { } showAlertDialog1(BuildContext context, String record) { - // set up the buttons - // ViewInteractionProvider provider = - // Provider.of(context, listen: false); Widget cancelButton = TextButton( child: const Text("Ok"), onPressed: () async { @@ -1587,114 +1417,68 @@ class _InteractionScreenState extends State { ); } - Widget _offsetPopup(List interactionReponseList) => PopupMenuButton< - int>( - itemBuilder: (context) { - return List.generate(interactionReponseList.length, (index) { - var provider = - Provider.of(context, listen: false); + Widget _offsetPopup(List interactionReponseList) => + PopupMenuButton( + itemBuilder: (context) { + return List.generate(interactionReponseList.length, (index) { + var provider = + Provider.of(context, listen: false); - var item = provider.interactionReponseList[index]; + var item = provider.interactionReponseList[index]; - return PopupMenuItem( - value: index, - child: item.multiple - ? GestureDetector( - onTap: () { - print("Clicked Section ${item.sectionName}"); - // provider.getSectionItem( - // item.sectionName, - // ); - setState(() { - provider.getSectionItem( - item.sectionName, - ); - }); + return PopupMenuItem( + value: index, + child: item.multiple + ? GestureDetector( + onTap: () { + print("Clicked Section ${item.sectionName}"); + // provider.getSectionItem( + // item.sectionName, + // ); + setState(() { + provider.getSectionItem( + item.sectionName, + ); + }); - const DecoratedBox( - decoration: BoxDecoration( - // border: Border.all(color: Colors.black), - // borderRadius: BorderRadius.circular(10.0), - border: Border( - bottom: BorderSide(width: 1.5, color: Colors.black), - //top: BorderSide(width: 1.5, color: Colors.black), - ), - ), - ); - }, - child: Text(' ${item.sectionName}')) - : Container(), - ); - }); - }, - // itemBuilder: (context) => [ - - // const PopupMenuItem( - // value: 1, - // child: Text( - // "Flutter Open", - // style: - // TextStyle(color: Colors.black, fontWeight: FontWeight.w700), - // ), - // ), - // const PopupMenuItem( - // value: 2, - // child: Text( - // "Flutter Tutorial", - // style: - // TextStyle(color: Colors.black, fontWeight: FontWeight.w700), - // ), - // ), - // ], - icon: Container( - height: double.infinity, - width: double.infinity, - decoration: const ShapeDecoration( - color: Color.fromARGB(255, 8, 39, 92), - shape: StadiumBorder( - side: BorderSide(color: Colors.white, width: 2), - ), - ), - child: Icon(Icons.add, color: Colors.white), - )); + const DecoratedBox( + decoration: BoxDecoration( + // border: Border.all(color: Colors.black), + // borderRadius: BorderRadius.circular(10.0), + border: Border( + bottom: + BorderSide(width: 1.5, color: Colors.black), + //top: BorderSide(width: 1.5, color: Colors.black), + ), + ), + ); + }, + child: Text(' ${item.sectionName}')) + : Container(), + ); + }); + }, + icon: Container( + height: double.infinity, + width: double.infinity, + decoration: const ShapeDecoration( + color: Color.fromARGB(255, 8, 39, 92), + shape: StadiumBorder( + side: BorderSide(color: Colors.white, width: 2), + ), + ), + child: Icon(Icons.add, color: Colors.white), + )); } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +////////////////////////////////////////////////////////////////////////////////////////// // import 'dart:convert'; // import 'dart:io'; -// import 'dart:js_util'; +// // import 'dart:js_interop'; +// // import 'dart:js_util'; // import 'package:discover_module/constants.dart'; +// import 'package:discover_module/custom_widget/floating_btn.dart'; // import 'package:discover_module/ui_screen/add_event/add_hcp.dart'; // import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; // import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; @@ -1703,11 +1487,14 @@ class _InteractionScreenState extends State { // import 'package:discover_module/ui_screen/interactionform/widget/customrangeslider.dart'; // import 'package:discover_module/ui_screen/interactionform/widget/interatciontextfield.dart'; // import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; +// import 'package:flutter/cupertino.dart'; // import 'package:flutter/material.dart'; +// import 'package:flutter/rendering.dart'; // import 'package:flutter/services.dart'; // import 'package:flutter/widgets.dart'; // import 'package:intl/intl.dart'; // import 'package:path_provider/path_provider.dart'; +// import 'package:popover/popover.dart'; // import 'package:provider/provider.dart'; // import 'package:dropdown_button2/dropdown_button2.dart'; @@ -1716,6 +1503,8 @@ class _InteractionScreenState extends State { // import 'package:permission_handler/permission_handler.dart'; // import 'package:path/path.dart' as p; +// // import 'package:popover/popover.dart'; + // class InteractionScreen extends StatefulWidget { // int index; // String form; @@ -1760,7 +1549,8 @@ class _InteractionScreenState extends State { // FocusScope.of(context).requestFocus(FocusNode()); // }, // child: OrientationBuilder(builder: (context, orientation) { -// return Scaffold( +// return SafeArea( +// child: Scaffold( // //resizeToAvoidBottomInset: false, // appBar: AppBar( // title: const FittedBox( @@ -1834,25 +1624,18 @@ class _InteractionScreenState extends State { // Addhcp())); // provider.getSectionItem( -// item.sectionName, -// item.sectionList.length); +// item.sectionName, +// ); // // print("index is $listIndex"); // setState(() { // // for (var item // }); // } else { // provider.getSectionItem( -// item.sectionName, -// item.sectionList.length); +// item.sectionName, +// ); // // print("index is $listIndex"); -// setState(() { -// // provider.getSectionItem( -// // item.sectionName, -// // item.sectionList.length); - -// // item.sectionList.length = -// // item.sectionList.length; -// }); +// setState(() {}); // } // }, // icon: const Icon( @@ -1870,10 +1653,6 @@ class _InteractionScreenState extends State { // child: Column( // crossAxisAlignment: CrossAxisAlignment.center, // children: [ -// // const SizedBox( -// // height: 20, -// // ), - // Padding( // padding: isTablet // ? const EdgeInsets.only(left: 14.0) @@ -1882,15 +1661,32 @@ class _InteractionScreenState extends State { // child: GridView.count( // physics: // const NeverScrollableScrollPhysics(), +// // crossAxisCount: +// // context.responsive( +// // 1, +// // sm: 1, // small +// // md: 1, // medium +// // lg: sectionList.length == 1 +// // ? 1 +// // : 3, // large +// // xl: 3, // extra large screen +// // ), + // crossAxisCount: context.responsive( // 1, // sm: 1, // small -// md: 1, // medium +// md: isTablet +// ? 2 +// : orientation == +// Orientation.landscape +// ? 2 +// : 1, // medium // lg: sectionList.length == 1 // ? 1 // : 3, // large // xl: 3, // extra large screen // ), + // // crossAxisCount: // // orientation == Orientation.portrait // // ? 1 @@ -2072,8 +1868,91 @@ class _InteractionScreenState extends State { // ), // // const Spacer(), // // saveActions(provider), +// Align( +// alignment: Alignment.bottomRight, +// child: Container( +// height: 80.0, +// width: 80.0, +// child: _offsetPopup(provider.interactionReponseList))) // ], -// )); +// ), +// // floatingActionButton: FloatingBtn( +// // title: "data", +// // icon: Icons.add, +// // onTap: () { +// // showPopover( +// // context: context, +// // bodyBuilder: (context) { +// // return Padding( +// // padding: const EdgeInsets.symmetric(vertical: 8), +// // child: ListView( +// // padding: const EdgeInsets.all(8), +// // children: [ +// // InkWell( +// // onTap: () { + +// // }, +// // child: Container( +// // height: 50, +// // color: Colors.amber[100], +// // child: const Center(child: Text('Entry A')), +// // ), +// // ), +// // const Divider(), +// // Container( +// // height: 50, +// // color: Colors.amber[200], +// // child: const Center(child: Text('Entry B')), +// // ), +// // const Divider(), +// // Container( +// // height: 50, +// // color: Colors.amber[300], +// // child: const Center(child: Text('Entry C')), +// // ), +// // const Divider(), +// // Container( +// // height: 50, +// // color: Colors.amber[400], +// // child: const Center(child: Text('Entry D')), +// // ), +// // const Divider(), +// // Container( +// // height: 50, +// // color: Colors.amber[500], +// // child: const Center(child: Text('Entry E')), +// // ), +// // const Divider(), +// // Container( +// // height: 50, +// // color: Colors.amber[600], +// // child: const Center(child: Text('Entry F')), +// // ), +// // ], +// // ), +// // ); +// // }, +// // ); + +// // var itemsectionname = +// // provider.interactionReponseList.length; + +// // print("ItemSectionname: $itemsectionname"); + +// // for (int i = 0; i < itemsectionname; i++) { +// // var item = provider.interactionReponseList[i]; + +// // print( +// // "Check_ProviderNameL ${item.sectionName}, ${item.multiple}"); +// // } + +// // // provider.getSectionItem( +// // // item.sectionName, +// // // ); +// // }, +// // ) +// ), +// ); // }), // ); // }); @@ -2174,7 +2053,7 @@ class _InteractionScreenState extends State { // : sectionItem.input == "textArea" // ? Expanded( // child: InteractionTextField( -// maxchars: int.parse(sectionItem.validation!.chars ?? "0"), +// // maxchars: int.parse(sectionItem.validation!.chars ?? "0"), // controller: sectionItem.controller!, // labelText: sectionItem.name, // // maxlines: 8, @@ -2194,29 +2073,39 @@ class _InteractionScreenState extends State { // style: TextStyle( // fontSize: 18.0, fontWeight: FontWeight.normal), // ) -// : Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: -// // isTablet ? 200 : MediaQuery.of(context).size.width, -// //height: isTablet ? 50 : 40, -// width: MediaQuery.of(context).size.width, -// child: InteractionTextField( -// inputType: sectionItem.input == "number" -// ? TextInputType.number -// : TextInputType.name, -// maxchars: int.parse(sectionItem.chars ?? "0"), -// controller: sectionItem.controller!, -// labelText: sectionItem.name, -// onChanged: (val) { -// sectionItem.selectedValue = []; -// provider.setTextValue(val, sectionItem, multiple); -// }, +// : Expanded( +// child: Padding( +// padding: const EdgeInsets.only(left: 8.0, right: 8.0), +// child: SizedBox( +// // width: +// // isTablet ? 200 : MediaQuery.of(context).size.width, +// //height: isTablet ? 50 : 40, +// width: MediaQuery.of(context).size.width, +// height: isTablet ? 50 : 40, + +// child: InteractionTextField( +// inputType: sectionItem.input == "number" +// ? TextInputType.number +// : TextInputType.name, +// maxchars: int.parse(sectionItem.chars ?? "0"), +// controller: sectionItem.controller!, +// labelText: sectionItem.name, +// onChanged: (val) { +// sectionItem.selectedValue = []; +// // sectionItem.selectedValue!.clear(); + +// provider.setTextValue( +// val, sectionItem, multiple); +// }, +// ), // ), // ), // ); // case InteractionWidget.DROPDOWN: -// return customdropdown(sectionItem, provider, list, multiple); +// // return customdropdown(sectionItem, provider, list, multiple); + +// return customAutoCompletedropdown( +// sectionItem, provider, list, multiple); // } // } @@ -2322,12 +2211,51 @@ class _InteractionScreenState extends State { // onPressed: () async { // // if (textFieldsValidation(provider).isEmpty) { // // print("Form_issss: ${widget.form}"); -// String record = -// await provider.saveJsonObject(context, widget.form); -// showAlertDialog(context, record); +// // String record = +// // await provider.saveJsonObject(context, widget.form); +// // showAlertDialog(context, record); // // } else { // // _displaySnackBar(textFieldsValidation(provider)); -// //} +// // } + +// ////////////////////////////////////////////////actual code/////////////////// +// /// +// // String record = +// // await provider.saveJsonObject(context, widget.form); +// // showAlertDialog(context, record); + +// ///Cnahging Code////////////// +// /// +// /// +// ///validateTextFields + +// // if (provider.validateTextFields()) { +// // print("Form_issss: ${widget.form}"); +// String record = +// await provider.saveJsonObject(context, widget.form); +// // showAlertDialog(context, record); + +// // for (int i = 0; i < sectionList.length; i++) { +// // SectionList sectionItem = sectionList[i]; + +// // print( +// // "ValidationMandotary_isss: ${sectionItem.validation!.isRequired}"); +// // } + +// print("Validation_isss: ${provider.isLoading}"); + +// if (provider.isLoading == false) { +// print("Validation_false"); +// showAlertDialog1(context, "Please fill all the fields"); +// } else { +// showAlertDialog(context, "Form $record Saved Successfully!"); +// print("Validation_True"); +// } + +// // print("Interaction_Type:"); +// // } else { +// // _displaySnackBar(textFieldsValidation(provider)); +// // } // }, // textColor: Colors.white, // title: "Save", @@ -2753,200 +2681,6 @@ class _InteractionScreenState extends State { // ); // } -// // Widget gridViewWidget( -// // InteractionProvider provider, -// // String sectionName, -// // List sectionList, -// // Orientation orientation, -// // FormFieldData item, -// // int listIndex) { -// // print("ListInex: $listIndex"); -// // print("sectionName: $sectionName"); -// // print("sectionName: $sectionName"); - -// // print("gridsectionlost_is: $sectionList"); -// // print("gridsectionlostleangth_is: ${sectionList.length}"); - -// // List pooja = sectionList; - -// // print("Pooja_isss: $pooja"); - -// // return Padding( -// // padding: isTablet -// // ? const EdgeInsets.only(left: 8.0) -// // : const EdgeInsets.only(left: 12.0, right: 12.0), -// // child: GridView.count( -// // physics: const NeverScrollableScrollPhysics(), -// // // crossAxisCount: context.responsive( -// // // 1, // default -// // // sm: 1, // small -// // // md: 1, // medium -// // // lg: sectionList.length == 1 ? 1 : 4, // large -// // // xl: 5, // extra large screen -// // // ), -// // crossAxisCount: context.responsive( -// // 1, -// // sm: 1, // small -// // md: 1, // medium -// // lg: sectionList.length == 1 -// // ? 1 -// // : (sectionList.length >= 1 ? 3 : 3), // large -// // xl: 3, // 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, -// // // childAspectRatio: sectionList.length == 1 -// // // ? orientation == Orientation.landscape -// // // ? 10 -// // // : 4.8 -// // // : isTablet -// // // ? 2.8 -// // // : 3.0, -// // childAspectRatio: MediaQuery.of(context).size.width / -// // (MediaQuery.of(context).size.height / 3), -// // children: List.generate( -// // sectionList.length, -// // (i) { -// // print(sectionList); -// // SectionList sectionItem = sectionList[i]; -// // dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN -// // ? sectionItem.value ?? "Select" -// // : ' '; -// // List 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.input == 'add' || -// // sectionItem.input == 'deletebtn' -// // ? const SizedBox.shrink() -// // : Text( -// // '${sectionItem.name}:*', -// // style: TextStyle( -// // color: Colors.orange.shade800, -// // fontSize: isTablet ? 18 : 14, -// // ), -// // ), -// // // const SizedBox( -// // // height: 15, -// // // ), -// // sectionItem.widget == InteractionWidget.BUTTON -// // ? sectionItem.input == 'chooseFile' -// // ? Row( -// // children: [ -// // CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 229, 229), -// // onPressed: () async { -// // sectionItem.selectedValue = []; -// // sectionItem.extension = []; -// // sectionItem.fileName = []; -// // await getEncodedFile(sectionItem); - -// // setState(() {}); -// // }, -// // width: 120, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.black, -// // title: sectionItem.name), -// // const SizedBox( -// // width: 5, -// // ), -// // Text( -// // sectionItem.selectedValue!.isNotEmpty -// // ? sectionItem.selectedValue!.isNotEmpty -// // ? 'File uploaded' -// // : "Files Uploaded" -// // : 'No file uploaded', -// // style: TextStyle( -// // color: -// // sectionItem.selectedValue!.isNotEmpty -// // ? Colors.green -// // : Colors.red), -// // ), -// // ], -// // ) -// // : isTablet -// // ? IconButton( -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); - -// // setState(() {}); -// // }, -// // icon: const Icon( -// // Icons.cancel, -// // size: 30, -// // color: Color.fromARGB(255, 8, 39, 92), -// // ), -// // ) -// // : Padding( -// // padding: -// // const EdgeInsets.only(left: 3.0, top: 5), -// // child: CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 75, 75), -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); - -// // setState(() {}); -// // }, -// // // width: 80, -// // // height: 30, - -// // height: 40, - -// // // height: -// // // MediaQuery.of(context).size.height * -// // // 0.2, -// // fontsize: 12, -// // textColor: Colors.white, -// // title: "Delete"), -// // ) -// // : returnWidget( -// // sectionItem: sectionItem, -// // item: item, -// // provider: provider, -// // list: list, -// // gridIndex: i, -// // listIndex: listIndex, -// // widgetData: sectionItem.widget!, -// // multiple: true), -// // ], -// // ), -// // ]); -// // }, -// // ), -// // ), -// // ); -// // } -// //////////////////////////////////////Poojaaaa///////////////////// -// /// -// /// - // Widget gridViewWidget( // InteractionProvider provider, // String sectionName, @@ -2987,190 +2721,192 @@ class _InteractionScreenState extends State { // return Padding( // padding: isTablet -// ? const EdgeInsets.only(left: 8.0) +// ? const EdgeInsets.only(left: 0.0) // : const EdgeInsets.only(left: 12.0, right: 12.0), // child: Column( // crossAxisAlignment: CrossAxisAlignment.start, // children: [ // for (var i = 0; i < convertedArray.length; i++) -// GridView.builder( -// physics: const NeverScrollableScrollPhysics(), -// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( -// crossAxisCount: context.responsive( -// 1, -// sm: 1, // small -// md: 1, // medium -// lg: sectionList.length == 1 -// ? 1 -// : (sectionList.length >= 1 ? 3 : 3), // large -// xl: 3, // extra large screen +// DecoratedBox( +// decoration: BoxDecoration( +// // border: Border.all(color: Colors.black), +// // borderRadius: BorderRadius.circular(10.0), +// color: i % 2 == 0 +// ? Color.fromARGB(133, 213, 241, 254) +// : Colors.white, +// ), +// child: GridView.builder( +// physics: const NeverScrollableScrollPhysics(), +// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( +// crossAxisCount: context.responsive( +// 1, +// sm: 1, // small +// md: isTablet +// ? 2 +// : orientation == Orientation.landscape +// ? 2 +// : 1, // medium +// lg: sectionList.length == 1 ? 1 : 3, // large +// xl: 3, // extra large screen +// ), +// mainAxisSpacing: +// sectionList.length == 1 || !isTablet ? 1 : 1, +// childAspectRatio: sectionList.length == 1 +// ? orientation == Orientation.landscape +// ? 10 +// : 4.8 +// : isTablet +// ? 2.8 +// : 3.0, // ), -// mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, -// childAspectRatio: MediaQuery.of(context).size.width / -// (MediaQuery.of(context).size.height / 3), -// ), -// shrinkWrap: true, -// padding: EdgeInsets.zero, -// itemCount: convertedArray[i].length, -// itemBuilder: (context, index) { -// // SectionList sectionItem = -// // convertedArray.expand((list) => list).toList()[index]; - -// // List.generate( -// // sectionList.length, -// // (i) { -// // print(sectionList); -// // // SectionList sectionItem = sectionList[i]; -// // SectionList sectionItem = -// // convertedArray.expand((list) => list).toList()[index]; -// // dropdownvalue = -// // sectionItem.widget == InteractionWidget.DROPDOWN -// // ? sectionItem.value ?? "Select" -// // : ' '; -// // List 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 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.input == 'add' || -// sectionItem.input == 'deletebtn' -// ? const SizedBox.shrink() -// : Text( -// '${sectionItem.name}:*', -// style: TextStyle( -// color: Colors.orange.shade800, -// fontSize: isTablet ? 18 : 14, +// shrinkWrap: true, +// padding: EdgeInsets.zero, +// itemCount: convertedArray[i].length, +// itemBuilder: (context, index) { +// SectionList sectionItem = convertedArray[i][index]; +// dropdownvalue = +// sectionItem.widget == InteractionWidget.DROPDOWN +// ? sectionItem.value ?? "Select" +// : ' '; +// List 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 SizedBox( +// height: MediaQuery.of(context).size.height, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// sectionItem.widget == InteractionWidget.BUTTON && +// sectionItem.input == 'add' || +// sectionItem.input == 'deletebtn' +// ? const SizedBox.shrink() +// : Padding( +// padding: const EdgeInsets.only( +// left: 8.0, right: 8.0), +// child: FittedBox( +// fit: BoxFit.scaleDown, +// child: Text( +// sectionItem.validation!.isRequired +// ? "${sectionItem.name}*" +// : sectionItem.name, +// style: TextStyle( +// color: Colors.orange.shade800, +// fontSize: 18), +// ), +// ), // ), -// ), -// // const SizedBox( -// // height: 15, -// // ), -// sectionItem.widget == InteractionWidget.BUTTON -// ? sectionItem.input == 'chooseFile' -// ? Row( -// children: [ -// CustomButton( -// backgroundColor: const Color.fromARGB( -// 255, 233, 229, 229), -// onPressed: () async { -// sectionItem.selectedValue = []; -// sectionItem.extension = []; -// sectionItem.fileName = []; -// await getEncodedFile(sectionItem); - -// setState(() {}); -// }, -// width: 120, -// height: 40, -// fontsize: 12, -// textColor: Colors.black, -// title: sectionItem.name), -// const SizedBox( -// width: 5, -// ), -// Text( -// sectionItem.selectedValue!.isNotEmpty -// ? sectionItem -// .selectedValue!.isNotEmpty -// ? 'File uploaded' -// : "Files Uploaded" -// : 'No file uploaded', -// style: TextStyle( -// color: sectionItem -// .selectedValue!.isNotEmpty -// ? Colors.green -// : Colors.red), -// ), -// ], -// ) -// : isTablet -// ? IconButton( -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); - -// setState(() {}); -// }, -// icon: const Icon( -// Icons.cancel, -// size: 30, -// color: Color.fromARGB(255, 8, 39, 92), -// ), -// ) -// : Padding( -// padding: const EdgeInsets.only( -// left: 3.0, top: 5), -// child: CustomButton( +// // const SizedBox( +// // height: 15, +// // ), +// sectionItem.widget == InteractionWidget.BUTTON +// ? sectionItem.input == 'chooseFile' +// ? Row( +// children: [ +// CustomButton( // backgroundColor: // const Color.fromARGB( -// 255, 233, 75, 75), -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); +// 255, 233, 229, 229), +// onPressed: () async { +// sectionItem.selectedValue = []; +// sectionItem.extension = []; +// sectionItem.fileName = []; +// await getEncodedFile(sectionItem); // setState(() {}); // }, -// // width: 80, -// // height: 30, - +// width: 120, // height: 40, - -// // height: -// // MediaQuery.of(context).size.height * -// // 0.2, // fontsize: 12, -// textColor: Colors.white, -// title: "Delete"), -// ) -// : returnWidget( -// sectionItem: sectionItem, -// item: item, -// provider: provider, -// list: list, -// gridIndex: i, -// listIndex: listIndex, -// widgetData: sectionItem.widget!, -// multiple: true), -// ], -// ), -// ]); -// }) +// textColor: Colors.black, +// title: sectionItem.name), +// const SizedBox( +// width: 5, +// ), +// Text( +// sectionItem.selectedValue!.isNotEmpty +// ? sectionItem +// .selectedValue!.isNotEmpty +// ? 'File uploaded' +// : "Files Uploaded" +// : 'No file uploaded', +// style: TextStyle( +// color: sectionItem +// .selectedValue!.isNotEmpty +// ? Colors.green +// : Colors.red), +// ), +// ], +// ) +// : isTablet +// ? IconButton( +// onPressed: () { +// provider.deleteMultipleRows( +// sectionItem.gid!, +// sectionList[i], +// sectionName); + +// setState(() {}); +// }, +// icon: const Icon( +// Icons.cancel, +// size: 30, +// color: +// Color.fromARGB(255, 8, 39, 92), +// ), +// ) +// : Padding( +// padding: const EdgeInsets.only( +// left: 3.0, top: 5), +// child: CustomButton( +// backgroundColor: +// const Color.fromARGB( +// 255, 233, 75, 75), +// onPressed: () { +// provider.deleteMultipleRows( +// sectionItem.gid!, +// sectionList[i], +// sectionName); + +// setState(() {}); +// }, +// // width: 80, +// // height: 30, + +// height: 40, + +// // height: +// // MediaQuery.of(context).size.height * +// // 0.2, +// fontsize: 12, +// textColor: Colors.white, +// title: "Delete"), +// ) +// : returnWidget( +// sectionItem: sectionItem, +// item: item, +// provider: provider, +// list: list, +// gridIndex: i, +// listIndex: listIndex, +// widgetData: sectionItem.widget!, +// multiple: true), +// ], +// ), +// ); +// }), +// ) // ], // ), // ); +// //); // } // String fieldsValidation(InteractionProvider provider) { @@ -3281,7 +3017,7 @@ class _InteractionScreenState extends State { // // set up the AlertDialog // AlertDialog alert = AlertDialog( // title: const Text(""), -// content: Text("Form $record Saved Successfully!"), +// content: Text(record), // actions: [ // cancelButton, // ], @@ -3295,1932 +3031,104 @@ class _InteractionScreenState extends State { // }, // ); // } -// } +// showAlertDialog1(BuildContext context, String record) { +// // set up the buttons +// // ViewInteractionProvider provider = +// // Provider.of(context, listen: false); +// Widget cancelButton = TextButton( +// child: const Text("Ok"), +// onPressed: () async { +// Navigator.of(context).pop(); +// }, +// ); +// // set up the AlertDialog +// AlertDialog alert = AlertDialog( +// title: const Text(""), +// content: Text(record), +// actions: [ +// cancelButton, +// ], +// ); - - - - - - - - - - - - - - - - - - - - - - - - - -// import 'dart:convert'; -// import 'dart:io'; -// import 'dart:js_util'; - -// import 'package:discover_module/constants.dart'; -// import 'package:discover_module/ui_screen/add_event/add_hcp.dart'; -// import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; -// import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; -// import 'package:discover_module/ui_screen/interactionform/util.dart'; -// import 'package:discover_module/ui_screen/interactionform/widget/custombutton.dart'; -// import 'package:discover_module/ui_screen/interactionform/widget/customrangeslider.dart'; -// import 'package:discover_module/ui_screen/interactionform/widget/interatciontextfield.dart'; -// import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; -// import 'package:flutter/material.dart'; -// import 'package:flutter/services.dart'; -// import 'package:flutter/widgets.dart'; -// import 'package:intl/intl.dart'; -// import 'package:path_provider/path_provider.dart'; -// import 'package:provider/provider.dart'; -// import 'package:dropdown_button2/dropdown_button2.dart'; - -// import 'package:file_picker/file_picker.dart'; -// // import 'package:pwa_ios/widgets/responsive_ext.dart'; -// import 'package:permission_handler/permission_handler.dart'; -// import 'package:path/path.dart' as p; - -// class InteractionScreen extends StatefulWidget { -// int index; -// String form; -// InteractionScreen({super.key, required this.index, required this.form}); - -// @override -// State createState() => _InteractionScreenState(); -// } - -// class _InteractionScreenState extends State { -// List interactionReponseList = []; -// List sectionList = []; -// List textEditingControllerList = []; -// int textfieldIndex = 0; -// String dropdownvalue = 'Select value'; -// String? fileName; -// final TextEditingController textEditingController = TextEditingController(); -// @override -// void initState() { -// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { -// // if (mytimer!.isActive) { -// // cancelTimer(); -// // } -// init(); -// }); - -// super.initState(); +// // show the dialog +// showDialog( +// context: context, +// builder: (BuildContext context) { +// return alert; +// }, +// ); // } -// init() async { -// await Provider.of(context, listen: false) -// .init(widget.index); -// setState(() {}); -// } +// Widget _offsetPopup(List interactionReponseList) => PopupMenuButton< +// int>( +// itemBuilder: (context) { +// return List.generate(interactionReponseList.length, (index) { +// var provider = +// Provider.of(context, listen: false); -// @override -// Widget build(BuildContext context) { -// return Consumer( -// builder: (BuildContext context, provider, Widget? child) { -// return GestureDetector( -// onTap: () { -// FocusScope.of(context).requestFocus(FocusNode()); -// }, -// child: OrientationBuilder(builder: (context, orientation) { -// return Scaffold( -// //resizeToAvoidBottomInset: false, -// appBar: AppBar( -// title: const FittedBox( -// fit: BoxFit.scaleDown, -// child: Text( -// 'Record New Interaction', -// style: TextStyle( -// // fontSize: isTablet ? 22 : 14, color: Colors.white -// // fontSize: 20, -// color: Colors.white), -// ), -// ), -// // backgroundColor: const Color(0xFF2b9af3), -// automaticallyImplyLeading: false, -// actions: [saveActions(provider)], -// leading: InkWell( -// onTap: () { -// Navigator.pop(context); -// }, -// child: const Icon( -// Icons.arrow_back_ios, -// color: Colors.white, -// ), -// ), -// ), -// body: Column( -// children: [ -// Expanded( -// child: ListView.builder( -// itemCount: provider.interactionReponseList.length, -// padding: EdgeInsets.zero, -// cacheExtent: double.parse( -// provider.interactionReponseList.length.toString()), -// itemBuilder: (context, index) { -// var item = provider.interactionReponseList[index]; -// sectionList = item.sectionList; -// return ExpansionTile( -// maintainState: true, -// // backgroundColor: Colors.white, -// // collapsedBackgroundColor: Color(0xFF2b9af3), -// 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: isTablet ? 18 : 14 -// ), -// )), -// item.multiple -// ? Align( -// alignment: Alignment.centerRight, -// child: IconButton( -// onPressed: () { -// if (item.sectionName == "HCP") { -// Navigator.push( -// context, -// MaterialPageRoute( -// builder: (context) => -// Addhcp())); +// var item = provider.interactionReponseList[index]; -// provider.getSectionItem( -// item.sectionName, -// item.sectionList.length); -// // print("index is $listIndex"); -// setState(() { -// // for (var item -// }); -// } else { -// provider.getSectionItem( -// item.sectionName, -// item.sectionList.length); -// // print("index is $listIndex"); -// setState(() { -// // for (var item -// }); -// } -// }, -// icon: const Icon( -// Icons.add_circle_outline, -// size: 30, -// color: Colors.white, -// ), -// ), -// ) -// : const SizedBox.shrink() -// ]), -// children: [ -// Padding( -// padding: const EdgeInsets.all(8.0), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// // const SizedBox( -// // height: 20, -// // ), +// return PopupMenuItem( +// value: index, +// child: item.multiple +// ? GestureDetector( +// onTap: () { +// print("Clicked Section ${item.sectionName}"); +// // provider.getSectionItem( +// // item.sectionName, +// // ); +// setState(() { +// provider.getSectionItem( +// item.sectionName, +// ); +// }); -// Padding( -// padding: isTablet -// ? const EdgeInsets.only(left: 14.0) -// : const EdgeInsets.only( -// left: 12.0, right: 12.0), -// child: GridView.count( -// physics: -// const NeverScrollableScrollPhysics(), -// crossAxisCount: context.responsive( -// 1, -// sm: 1, // small -// md: 1, // medium -// lg: sectionList.length == 1 -// ? 1 -// : 3, // large -// xl: 3, // extra large screen -// ), -// // crossAxisCount: -// // orientation == Orientation.portrait -// // ? 1 -// // : 3, -// // crossAxisCount: (MediaQuery.of(context) -// // .orientation == -// // Orientation.landscape) -// // ? 3 -// // : 1, - -// mainAxisSpacing: -// sectionList.length == 1 || !isTablet -// ? 1 -// : 3.5, -// // mainAxisSpacing: -// // orientation == Orientation.portrait -// // ? 1 -// // : 3, -// shrinkWrap: true, -// padding: EdgeInsets.zero, -// // childAspectRatio: MediaQuery.of(context) -// // .size -// // .aspectRatio * -// // 0.10, -// // childAspectRatio: -// // sectionList.length == 1 -// // ? orientation == -// // Orientation.landscape -// // ? 10 -// // : 3.8 -// // : 2.4, -// // childAspectRatio: -// // sectionList.length == 1 -// // ? orientation == -// // Orientation.landscape -// // ? 10 -// // : 3.8 -// // : isTablet -// // ? 2.8 -// // : 3.8, - -// childAspectRatio: -// sectionList.length == 1 -// ? orientation == -// Orientation.landscape -// ? 10 -// : 4.8 -// : isTablet -// ? 2.8 -// : 3.0, -// // /:2.4, -// // childAspectRatio: 3.8, - -// children: List.generate( -// sectionList.length, -// (i) { -// SectionList sectionItem = -// sectionList[i]; -// dropdownvalue = sectionItem -// .widget == -// InteractionWidget.DROPDOWN -// ? sectionItem.value ?? "Select" -// : ' '; -// List 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.input == -// 'add' -// ? const SizedBox.shrink() -// : Padding( -// padding: -// const EdgeInsets -// .only( -// left: 8.0, -// right: 8.0), -// child: FittedBox( -// fit: BoxFit.scaleDown, -// child: Text( -// sectionItem -// .validation! -// .isRequired -// ? '${sectionItem.name}:*' -// : '${sectionItem.name}:', -// style: TextStyle( -// color: Colors -// .orange -// .shade800, -// fontSize: 18.0, -// // 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!, -// multiple: false), -// // SizedBox( -// // height: isTablet ? 15 : 5, -// // ), - -// // sectionItem.depid == 'pooja' -// // ? Text( -// // sectionItem.validation! -// // .isRequired -// // ? '${sectionItem.depid}:*' -// // : '${sectionItem.depid}:', -// // style: TextStyle( -// // color: Colors -// // .orange.shade800, -// // fontSize: isTablet -// // ? 18 -// // : 12, -// // ), -// // ) -// // : const SizedBox.shrink(), -// ], -// ); -// }, -// ), -// ), -// ), -// // 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), -// ], -// )); -// }), -// ); -// }); -// } - -// Widget returnWidget({ -// required SectionList sectionItem, -// required FormFieldData item, -// required InteractionProvider provider, -// required List list, -// required int gridIndex, -// required int listIndex, -// required InteractionWidget widgetData, -// required bool multiple, -// }) { -// switch (widgetData) { -// case InteractionWidget.CHECKBOX: -// return (sectionItem.inputList!.length >= 5) -// ? customMultiselectDropdown( -// sectionItem, provider, sectionItem.inputList!, multiple) -// : buildCheckbox(sectionItem, item.sectionName, provider, multiple); - -// case InteractionWidget.AUTOCOMPLETE: -// return customAutoCompletedropdown( -// sectionItem, provider, list, multiple); - -// case InteractionWidget.MULTISELECT: -// return customMultiselectDropdown(sectionItem, provider, list, multiple); - -// case InteractionWidget.RADIO: -// return (sectionItem.inputList!.length >= 5) -// ? customdropdown( -// sectionItem, provider, sectionItem.inputList!, multiple) -// : buildRadio(sectionItem, provider); - -// case InteractionWidget.LABEL: -// return Text(sectionItem.input!); - -// case InteractionWidget.RANGESLIDER: -// return CustomRangeSlider( -// max: double.parse(sectionItem.max!), -// min: double.parse(sectionItem.min!), -// sliderPos: sectionItem.selectedValue!.isNotEmpty -// ? double.parse(sectionItem.selectedValue!.last.toString()) -// : double.parse(sectionItem.min!), -// onChanged: (val) { -// setState(() { -// sectionItem.selectedValue = []; -// sectionItem.selectedId = val.toString(); -// sectionItem.selectedValue!.add(val.toInt()); -// }); -// }, -// ); - -// case InteractionWidget.BUTTON: -// return sectionItem.input == 'add' -// ? const Offstage( -// offstage: true, -// child: Text("Visible"), -// ) -// : Row( -// children: [ -// CustomButton( -// backgroundColor: const Color.fromARGB(255, 233, 229, 229), -// onPressed: () async { -// sectionItem.selectedValue = []; -// sectionItem.extension = []; -// sectionItem.fileName = []; -// await getEncodedFile(sectionItem); - -// setState(() {}); -// }, -// width: 120, -// height: 40, -// fontsize: 12, -// textColor: Colors.black, -// title: sectionItem.name), -// const SizedBox( -// width: 5, -// ), -// Text( -// sectionItem.selectedValue!.isNotEmpty -// ? sectionItem.selectedValue!.length > 1 -// ? 'Files uploaded' -// : "File Uploaded" -// : 'No file uploaded', -// style: TextStyle( -// color: sectionItem.selectedValue!.isNotEmpty -// ? Colors.green -// : Colors.red), -// ), -// ], -// ); - -// case InteractionWidget.TEXT: -// return sectionItem.input == 'Date' -// ? buildDateWidget(sectionItem) -// : sectionItem.input == "textArea" -// ? Expanded( -// child: InteractionTextField( -// maxchars: int.parse(sectionItem.validation!.chars ?? "0"), -// controller: sectionItem.controller!, -// labelText: sectionItem.name, -// // maxlines: 8, -// //minlines: 4, -// onChanged: (val) { -// sectionItem.selectedValue = []; -// setState(() {}); - -// sectionItem.selectedValue!.add(val); -// }, -// ), -// ) -// ////Poojaaaaa -// : sectionItem.input == "text1" -// ? Text( -// sectionItem.depid!, -// style: TextStyle( -// fontSize: 18.0, fontWeight: FontWeight.normal), -// ) -// : Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: -// // isTablet ? 200 : MediaQuery.of(context).size.width, -// //height: isTablet ? 50 : 40, -// width: MediaQuery.of(context).size.width, -// child: InteractionTextField( -// inputType: sectionItem.input == "number" -// ? TextInputType.number -// : TextInputType.name, -// maxchars: int.parse(sectionItem.chars ?? "0"), -// controller: sectionItem.controller!, -// labelText: sectionItem.name, -// onChanged: (val) { -// sectionItem.selectedValue = []; -// provider.setTextValue(val, sectionItem, multiple); -// }, +// const DecoratedBox( +// decoration: BoxDecoration( +// // border: Border.all(color: Colors.black), +// // borderRadius: BorderRadius.circular(10.0), +// border: Border( +// bottom: BorderSide(width: 1.5, color: Colors.black), +// //top: BorderSide(width: 1.5, color: Colors.black), // ), // ), // ); -// case InteractionWidget.DROPDOWN: -// return customdropdown(sectionItem, provider, list, multiple); -// } -// } - -// Future requestPermission(Permission permission) async { -// final status = await permission.request(); - -// setState(() { -// print(status); -// // _permissionStatus = status; -// // print(_permissionStatus); -// }); -// } - -// Widget buildDateWidget(SectionList sectionItem) { -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: isTablet ? 200 : MediaQuery.of(context).size.width, -// // height: isTablet ? 50 : 40, -// width: MediaQuery.of(context).size.width, -// child: TextField( -// controller: -// sectionItem.controller, //editing controller of this TextField -// decoration: InputDecoration( -// // border: OutlineInputBorder(), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(10.0), -// ), -// labelStyle: const TextStyle(fontSize: 16), -// suffixIcon: const Icon(Icons.calendar_today), //icon of text field -// labelText: "Enter Date" //label text of field -// ), -// readOnly: true, //set it true, so that user will not able to edit text -// onTap: () async { -// DateTime? pickedDate = await showDatePicker( -// context: context, -// initialDate: DateTime.now(), -// firstDate: DateTime( -// 2000), //DateTime.now() - not to allow to choose before today. -// lastDate: DateTime(2101)); - -// if (pickedDate != null) { -// print( -// pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000 -// String formattedDate = -// DateFormat('yyyy-MM-dd').format(pickedDate); -// print( -// formattedDate); //formatted date output using intl package => 2021-03-16 -// //you can implement different kind of Date Format here according to your requirement - -// setState(() { -// sectionItem.controller!.text = formattedDate; -// sectionItem.selectedValue = []; -// sectionItem.selectedValue! -// .add(formattedDate); //set output date to TextField value. -// }); -// } else { -// print("Date is not selected"); -// } -// }, -// ), -// ), -// ); -// } - -// Widget saveActions(InteractionProvider provider) { -// return Align( -// alignment: Alignment.centerRight, -// child: Row( -// mainAxisAlignment: MainAxisAlignment.spaceEvenly, -// children: [ -// Padding( -// padding: const EdgeInsets.all(4.0), -// child: CustomButton( -// backgroundColor: Colors.red.shade800, -// onPressed: () { -// //showDeleteProfileAlertDialog(context); -// for (var textcontrollers -// in provider.textEditingControllerList) { -// textcontrollers.text = ''; -// } - -// // setState(() { -// // provider.resetAllWidgetsData(); -// // }); -// }, -// textColor: Colors.white, -// title: "Reset", -// // height: 40, -// // width: isTablet ? 100 : 80, -// height: MediaQuery.of(context).size.height * 0.2, - -// fontsize: isTablet ? 15 : 10.2, -// ), -// ), -// SizedBox( -// width: isTablet ? 20 : 4, -// ), -// Padding( -// padding: const EdgeInsets.all(4.0), -// child: CustomButton( -// backgroundColor: Colors.green.shade500, -// onPressed: () async { -// if (textFieldsValidation(provider).isEmpty) { -// String record = -// await provider.saveJsonObject(context, widget.form); -// showAlertDialog(context, record); -// } else { -// _displaySnackBar(textFieldsValidation(provider)); -// } -// }, -// textColor: Colors.white, -// title: "Save", -// // height: 40, -// // width: isTablet ? 100 : 80, -// height: MediaQuery.of(context).size.height * 0.2, - -// // width: MediaQuery.of(context).size.width * 0.1, -// fontsize: isTablet ? 16 : 12, -// ), -// ), -// SizedBox( -// width: isTablet ? 20 : 2, -// ), -// ], -// ), -// ); -// } - -// Widget buildRadio(SectionList sectionItem, InteractionProvider provider) { -// List list = provider.getData2(sectionItem); -// // .map((itemWord) => InputClass.fromJson(itemWord)) -// // .toList(); -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: isTablet ? 250 : MediaQuery.of(context).size.width, -// width: MediaQuery.of(context).size.width, - -// child: Row( -// children: [ -// for (InputClass value in list) -// Row( -// children: [ -// Radio( -// value: value.name, -// activeColor: Colors.black, -// groupValue: provider.radioValue, -// onChanged: (String? value) { -// setState(() { -// print(value); -// provider.radioValue = value!; -// int index = -// list.indexWhere((element) => element.name == value); -// sectionItem.selectedValue!.add(list[index].id); -// }); // }, -// ), -// Text(value.name), -// ], -// ), -// ], -// ), -// ), -// ); -// } - -// Widget buildCheckbox(SectionList sectionItem, String sectionName, -// InteractionProvider provider, bool multiple) { -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: 250, -// width: MediaQuery.of(context).size.width, - -// child: Row( -// children: [ -// for (var value in provider.checkboxlist) -// Row( -// children: [ -// FittedBox( -// fit: BoxFit.scaleDown, -// child: Checkbox( -// value: value.ischecked ?? false, -// activeColor: Colors.black, -// checkColor: Colors.white, -// onChanged: (bool? newvalue) { -// value.ischecked = newvalue!; -// provider.setcheckBoxValue(sectionItem, sectionName, -// newvalue, value.id, multiple); -// //setState(() {}); -// }, -// ), -// ), -// Text(value.name), -// ], -// ), -// ], -// ), -// ), -// ); -// } - -// Widget customdropdown(SectionList sectionItem, InteractionProvider provider, -// List list, bool multiple) { -// // sectionItem.value = ''; - -// if (list.isEmpty) { -// list = []; -// InputClass inputClass = -// InputClass(id: "no value", name: "Select ${sectionItem.name}"); -// list.add(inputClass); -// sectionItem.selectedObject = list[0]; -// } -// // InputClass selectedObj = list[0]; -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// width: MediaQuery.of(context).size.width, -// // height: isTablet ? 60 : 40, -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), -// ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select ${sectionItem.name}', -// style: const TextStyle(fontSize: 14), -// ), -// items: list -// .map((item) => DropdownMenuItem( -// value: item, -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, -// ), -// ), -// )) -// .toList(), -// value: sectionItem.selectedObject ?? list[0], -// // // provider.getDropDownValue(sectionItem.value!, sectionItem, list) -// // sectionItem.value ?? list[0].name, -// validator: (value) { -// if (value == null) { -// return 'Please select ${sectionItem.name}'; -// } -// return null; -// }, -// onChanged: (value) { -// //Do something when selected item is changed. -// sectionItem.selectedObject = value!; -// sectionItem.value = value.id; -// provider.setDropDownValue(value.id, sectionItem, multiple); -// print("selected ${sectionItem.value}"); -// // setState(() {}); -// }, -// onSaved: (value) { -// sectionItem.selectedObject = value!; -// sectionItem.value = value.id; -// provider.setDropDownValue(value.id, sectionItem, multiple); -// // setState(() {}); -// }, -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.only(right: 8), -// ), -// iconStyleData: const IconStyleData( -// icon: Icon( -// Icons.arrow_drop_down, -// color: Colors.black45, -// ), -// iconSize: 24, -// ), -// dropdownStyleData: DropdownStyleData( -// decoration: BoxDecoration( -// borderRadius: BorderRadius.circular(15), -// ), -// ), -// menuItemStyleData: const MenuItemStyleData( -// padding: EdgeInsets.symmetric(horizontal: 16), -// ), -// ), -// ), -// ); -// } - -// Widget customAutoCompletedropdown(SectionList sectionItem, -// InteractionProvider provider, List list, bool multiple) { -// // sectionItem.value = list[0].name; - -// // if (list.isEmpty) { -// // print("list is empty"); -// list = sectionItem.inputList!; -// print("***Autocomplete list ${list[0].name}"); -// //} -// //InputClass selectedObj = list[0]; -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: isTablet ? 200 : MediaQuery.of(context).size.width, -// // height: isTablet ? 60 : 40, -// width: MediaQuery.of(context).size.width, - -// child: DropdownButtonHideUnderline( -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), -// ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select Item', -// style: TextStyle( -// fontSize: 14, -// color: Theme.of(context).hintColor, -// ), -// ), -// items: list -// .map((item) => DropdownMenuItem( -// value: item, -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, -// ), -// ), -// )) -// .toList(), -// value: sectionItem.selectedObject, -// onSaved: (value) { -// sectionItem.selectedObject = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// onChanged: (value) { -// // setState(() { -// sectionItem.selectedObject = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// // setState(() {}); -// //}); -// }, - -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.symmetric(horizontal: 16), -// height: 40, -// width: 200, -// ), -// dropdownStyleData: const DropdownStyleData( -// maxHeight: 200, -// ), -// menuItemStyleData: const MenuItemStyleData( -// height: 40, -// ), -// dropdownSearchData: DropdownSearchData( -// searchController: textEditingController, -// searchInnerWidgetHeight: 50, -// searchInnerWidget: Container( -// height: 50, -// padding: const EdgeInsets.only( -// top: 8, -// bottom: 4, -// right: 8, -// left: 8, -// ), -// child: TextFormField( -// expands: true, -// maxLines: null, -// controller: textEditingController, -// decoration: InputDecoration( -// isDense: true, -// contentPadding: const EdgeInsets.symmetric( -// horizontal: 10, -// vertical: 8, -// ), -// hintText: 'Search for an item...', -// hintStyle: const TextStyle(fontSize: 12), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(8), -// ), -// ), -// ), -// ), -// searchMatchFn: (item, searchValue) { -// return item.value!.name.toString().contains(searchValue); -// }, -// ), -// //This to clear the search value when you close the menu -// onMenuStateChange: (isOpen) { -// if (!isOpen) { -// textEditingController.clear(); -// } -// }, -// ), -// ), -// ), -// ); -// } - -// Widget customMultiselectDropdown(SectionList sectionItem, -// InteractionProvider provider, List list, bool multiple) { -// if (list.isEmpty) { -// list = sectionItem.inputList!; -// } -// InputClass selectedObj = list[0]; - -// return Padding( -// padding: const EdgeInsets.only(left: 8.0, right: 8.0), -// child: SizedBox( -// // width: isTablet ? 200 : MediaQuery.of(context).size.width, -// // height: isTablet ? 60 : 40, -// width: MediaQuery.of(context).size.width, -// // height: MediaQuery.of(context).size.height, - -// child: DropdownButtonHideUnderline( -// child: DropdownButtonFormField2( -// isExpanded: true, -// decoration: InputDecoration( -// // Add Horizontal padding using menuItemStyleData.padding so it matches -// // the menu padding when button's width is not specified. -// contentPadding: const EdgeInsets.symmetric(vertical: 5), -// border: OutlineInputBorder( -// borderRadius: BorderRadius.circular(15), -// ), -// // Add more decoration.. -// ), -// hint: Text( -// 'Select Items', -// style: TextStyle( -// fontSize: 14, -// color: Theme.of(context).hintColor, -// ), -// ), -// items: list.map((item) { -// return DropdownMenuItem( -// value: item, -// //disable default onTap to avoid closing menu when selecting an item -// enabled: false, -// child: StatefulBuilder( -// builder: (context, menuSetState) { -// final isSelected = -// sectionItem.selectedValue!.contains(item.name); -// return InkWell( -// onTap: () { -// isSelected -// ? sectionItem.selectedValue!.remove(item.name) -// : sectionItem.selectedValue!.add(item.name); -// //This rebuilds the StatefulWidget to update the button's text -// setState(() {}); -// //This rebuilds the dropdownMenu Widget to update the check mark -// menuSetState(() {}); -// }, -// child: Container( -// height: double.infinity, -// padding: const EdgeInsets.symmetric(horizontal: 16.0), -// child: Row( -// children: [ -// if (isSelected) -// const Icon(Icons.check_box_outlined) -// else -// const Icon(Icons.check_box_outline_blank), -// const SizedBox(width: 16), -// Expanded( -// child: Text( -// item.name, -// style: const TextStyle( -// fontSize: 14, -// ), -// ), -// ), -// ], -// ), -// ), -// ); -// }, -// ), -// ); -// }).toList(), -// //Use last selected item as the current value so if we've limited menu height, it scroll to last item. -// value: selectedObj, -// // ? null -// // : provider.selectedItems.last, -// onChanged: (value) { -// selectedObj = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// onSaved: (value) { -// selectedObj = value!; -// provider.setAutoCompleteValue(value.id, sectionItem, multiple); -// sectionItem.value = value.name; -// }, -// selectedItemBuilder: (context) { -// return list.map( -// (item) { -// return Container( -// alignment: AlignmentDirectional.center, -// child: Text( -// sectionItem.selectedValue!.join(', '), -// style: const TextStyle( -// fontSize: 14, -// overflow: TextOverflow.ellipsis, -// ), -// maxLines: 1, -// ), -// ); -// }, -// ).toList(); -// }, -// buttonStyleData: const ButtonStyleData( -// padding: EdgeInsets.only(left: 16, right: 8), -// height: 40, -// width: 140, -// ), -// menuItemStyleData: const MenuItemStyleData( -// height: 40, -// padding: EdgeInsets.zero, -// ), -// ), -// ), -// ), -// ); -// } - -// Widget gridViewWidget( -// InteractionProvider provider, -// String sectionName, -// List sectionList, -// Orientation orientation, -// FormFieldData item, -// int listIndex) { -// print("ListInex: $listIndex"); -// print("sectionName: $sectionName"); -// print("sectionName: $sectionName"); - -// print("gridsectionlost_is: $sectionList"); -// print("gridsectionlostleangth_is: ${sectionList.length}"); - -// List pooja = sectionList; - -// print("Pooja_isss: $pooja"); - -// return Padding( -// padding: isTablet -// ? const EdgeInsets.only(left: 8.0) -// : const EdgeInsets.only(left: 12.0, right: 12.0), -// child: GridView.count( -// physics: const NeverScrollableScrollPhysics(), -// // crossAxisCount: context.responsive( -// // 1, // default -// // sm: 1, // small -// // md: 1, // medium -// // lg: sectionList.length == 1 ? 1 : 4, // large -// // xl: 5, // extra large screen -// // ), -// crossAxisCount: context.responsive( -// 1, -// sm: 1, // small -// md: 1, // medium -// lg: sectionList.length == 1 -// ? 1 -// : (sectionList.length >= 1 ? 3 : 3), // large -// xl: 3, // 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, -// // childAspectRatio: sectionList.length == 1 -// // ? orientation == Orientation.landscape -// // ? 10 -// // : 4.8 -// // : isTablet -// // ? 2.8 -// // : 3.0, -// childAspectRatio: MediaQuery.of(context).size.width / -// (MediaQuery.of(context).size.height / 3), -// children: List.generate( -// sectionList.length, -// (i) { -// print(sectionList); -// SectionList sectionItem = sectionList[i]; -// dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN -// ? sectionItem.value ?? "Select" -// : ' '; -// List 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.input == 'add' || -// sectionItem.input == 'deletebtn' -// ? const SizedBox.shrink() -// : Text( -// '${sectionItem.name}:*', -// style: TextStyle( -// color: Colors.orange.shade800, -// fontSize: isTablet ? 18 : 14, -// ), -// ), -// // const SizedBox( -// // height: 15, -// // ), -// sectionItem.widget == InteractionWidget.BUTTON -// ? sectionItem.input == 'chooseFile' -// ? Row( -// children: [ -// CustomButton( -// backgroundColor: const Color.fromARGB( -// 255, 233, 229, 229), -// onPressed: () async { -// sectionItem.selectedValue = []; -// sectionItem.extension = []; -// sectionItem.fileName = []; -// await getEncodedFile(sectionItem); - -// setState(() {}); -// }, -// width: 120, -// height: 40, -// fontsize: 12, -// textColor: Colors.black, -// title: sectionItem.name), -// const SizedBox( -// width: 5, -// ), -// Text( -// sectionItem.selectedValue!.isNotEmpty -// ? sectionItem.selectedValue!.isNotEmpty -// ? 'File uploaded' -// : "Files Uploaded" -// : 'No file uploaded', -// style: TextStyle( -// color: -// sectionItem.selectedValue!.isNotEmpty -// ? Colors.green -// : Colors.red), -// ), -// ], -// ) -// : isTablet -// ? IconButton( -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); - -// setState(() {}); -// }, -// icon: const Icon( -// Icons.cancel, -// size: 30, -// color: Color.fromARGB(255, 8, 39, 92), -// ), -// ) -// : Padding( -// padding: -// const EdgeInsets.only(left: 3.0, top: 5), -// child: CustomButton( -// backgroundColor: const Color.fromARGB( -// 255, 233, 75, 75), -// onPressed: () { -// provider.deleteMultipleRows( -// sectionItem.gid!, -// sectionList[i], -// sectionName); - -// setState(() {}); -// }, -// // width: 80, -// // height: 30, - -// height: 40, - -// // height: -// // MediaQuery.of(context).size.height * -// // 0.2, -// fontsize: 12, -// textColor: Colors.white, -// title: "Delete"), -// ) -// : returnWidget( -// sectionItem: sectionItem, -// item: item, -// provider: provider, -// list: list, -// gridIndex: i, -// listIndex: listIndex, -// widgetData: sectionItem.widget!, -// multiple: true), -// ], -// ), -// ]); -// }, -// ), -// ), -// ); -// } -// //////////////////////////////////////Poojaaaa///////////////////// - -// // Widget gridViewWidget( -// // InteractionProvider provider, -// // String sectionName, -// // List sectionList, -// // Orientation orientation, -// // FormFieldData item, -// // int count, -// // int listIndex) { -// // print("ListInex: $listIndex"); -// // print("sectionName: $sectionName"); -// // print("sectionName: $sectionName"); -// // print("section_count: $count"); - -// // print("gridsectionlost_is: $sectionList"); -// // print("gridsectionlostleangth_is: ${sectionList.length}"); - -// // List pooja = sectionList; - -// // print("Pooja_isss: $pooja"); -// // print("Pooja_Leangth_isss: ${pooja.length}"); - -// // List> convertedArray = []; - -// // // for (int i = 0; i < pooja.length; i += 4) { -// // // print("poojaleangth: $pooja"); - -// // // convertedArray.add(pooja.sublist(i, i + 4)); -// // // } - -// // // for (int i = 0; i < pooja.length; i + pooja.length) { -// // // print("poojaleangth: $pooja"); -// // // if (pooja[i] == delete) { -// // // convertedArray.add(pooja.sublist(i, i + pooja.length)); -// // // }} -// // // for (int i = 0; i < pooja.length; i += pooja.length) { -// // // print("poojaleangth: $pooja"); - -// // // convertedArray.add(pooja.sublist(i, i + pooja.length)); -// // // } - -// // // int arraylen -// // // print("Pooja_issscheckkk: ${pooja.first.inputList}"); - -// // print("Provider_leangth: ${item.sectionList.length}"); - -// // for (int i = 0; i < pooja.length; i += 5) { -// // print("poojaleangth: $pooja"); - -// // convertedArray.add(pooja.sublist(i, i + 5)); -// // } - -// // print("convertedArray"); - -// // print(convertedArray); - -// // print("ConvertedArray.leangth: $convertedArray"); -// // print("ConvertedArray.leangth: ${convertedArray.length}"); - -// // // sectionList = convertedArray; -// // // sectionList= convertedArray.expand((list) => list).toList(); -// // // print(convertedArray); -// // return Padding( -// // padding: isTablet -// // ? const EdgeInsets.only(left: 8.0) -// // : const EdgeInsets.only(left: 12.0, right: 12.0), -// // child: Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // for (var i = 0; i < convertedArray.length; i++) -// // GridView.builder( -// // physics: const NeverScrollableScrollPhysics(), -// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( -// // crossAxisCount: 3, // Keep the same crossAxisCount -// // mainAxisSpacing: -// // sectionList.length == 1 || !isTablet ? 1.0 : 2.0, -// // crossAxisSpacing: 1.0, -// // childAspectRatio: MediaQuery.of(context).size.width / -// // (MediaQuery.of(context).size.height / 3), -// // ), -// // shrinkWrap: true, -// // padding: EdgeInsets.zero, -// // itemCount: convertedArray[0].length, // Only one item per section -// // itemBuilder: (context, index) { -// // SectionList sectionItem = -// // convertedArray.expand((list) => list).toList()[index]; - -// // print("Sectionloop_item_isss: $sectionItem"); -// // dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN -// // ? sectionItem.value ?? "Select" -// // : ' '; -// // List 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.input == 'add' || -// // sectionItem.input == 'deletebtn') -// // ? const SizedBox.shrink() -// // : Text( -// // '${sectionItem.name}:*', -// // style: TextStyle( -// // color: Colors.orange.shade800, -// // fontSize: isTablet ? 18 : 14, -// // ), -// // ), -// // sectionItem.widget == InteractionWidget.BUTTON -// // ? sectionItem.input == 'chooseFile' -// // ? Row( -// // children: [ -// // CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 229, 229), -// // onPressed: () async { -// // sectionItem.selectedValue = []; -// // sectionItem.extension = []; -// // sectionItem.fileName = []; -// // await getEncodedFile(sectionItem); -// // setState(() {}); -// // }, -// // width: 120, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.black, -// // title: sectionItem.name, -// // ), -// // const SizedBox(width: 5), -// // Text( -// // sectionItem.selectedValue!.isNotEmpty -// // ? 'File uploaded' -// // : 'No file uploaded', -// // style: TextStyle( -// // color: sectionItem -// // .selectedValue!.isNotEmpty -// // ? Colors.green -// // : Colors.red), -// // ), -// // ], -// // ) -// // : isTablet -// // ? IconButton( -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); -// // setState(() {}); -// // }, -// // icon: const Icon( -// // Icons.cancel, -// // size: 30, -// // color: Color.fromARGB(255, 8, 39, 92), -// // ), -// // ) -// // : Padding( -// // padding: const EdgeInsets.only( -// // left: 3.0, top: 5), -// // child: CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 75, 75), -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); -// // setState(() {}); -// // }, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.white, -// // title: "Delete", -// // ), -// // ) -// // : returnWidget( -// // sectionItem: sectionItem, -// // item: item, -// // provider: provider, -// // list: list, -// // gridIndex: i, -// // listIndex: listIndex, -// // widgetData: sectionItem.widget!, -// // multiple: true, -// // ), -// // ], -// // ); -// // }, -// // ), -// // ], -// // ), -// // ); - -// ///////////////////////////////////////////////////////////////////////// -// // Widget gridViewWidget( -// // InteractionProvider provider, -// // String sectionName, -// // List sectionList, -// // Orientation orientation, -// // FormFieldData item, -// // int listIndex) { -// // print("ListInex: $listIndex"); -// // print("sectionName: $sectionName"); -// // print("sectionName: $sectionName"); - -// // print("gridsectionlost_is: $sectionList"); -// // print("gridsectionlostleangth_is: ${sectionList.length}"); - -// // List pooja = sectionList; - -// // print("Pooja_isss: $pooja"); - -// // List> convertedArray = []; - -// // for (int i = 0; i < pooja.length; i += 4) { -// // convertedArray.add(pooja.sublist(i, i + 4)); -// // } -// // print("convertedArray"); - -// // print(convertedArray); - -// // print("ConvertedArray.leangth: $convertedArray"); -// // print("ConvertedArray.leangth: ${convertedArray.length}"); - -// // // sectionList = convertedArray; -// // // sectionList= convertedArray.expand((list) => list).toList(); -// // // print(convertedArray); -// // return Padding( -// // padding: isTablet -// // ? const EdgeInsets.only(left: 8.0) -// // : const EdgeInsets.only(left: 12.0, right: 12.0), -// // child: Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // for (var i = 0; i < convertedArray.length; i++) -// // GridView.builder( -// // physics: const NeverScrollableScrollPhysics(), -// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( -// // crossAxisCount: 3, // Keep the same crossAxisCount -// // mainAxisSpacing: -// // sectionList.length == 1 || !isTablet ? 1.0 : 2.0, -// // crossAxisSpacing: 1.0, -// // childAspectRatio: MediaQuery.of(context).size.width / -// // (MediaQuery.of(context).size.height / 3), -// // ), -// // shrinkWrap: true, -// // padding: EdgeInsets.zero, -// // itemCount: convertedArray[0].length, // Only one item per section -// // itemBuilder: (context, index) { -// // SectionList sectionItem = -// // convertedArray.expand((list) => list).toList()[index]; - -// // print("Sectionloop_item_isss: $sectionItem"); -// // dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN -// // ? sectionItem.value ?? "Select" -// // : ' '; -// // List 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.input == 'add' || -// // sectionItem.input == 'deletebtn') -// // ? const SizedBox.shrink() -// // : Text( -// // '${sectionItem.name}:*', -// // style: TextStyle( -// // color: Colors.orange.shade800, -// // fontSize: isTablet ? 18 : 14, -// // ), -// // ), -// // sectionItem.widget == InteractionWidget.BUTTON -// // ? sectionItem.input == 'chooseFile' -// // ? Row( -// // children: [ -// // CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 229, 229), -// // onPressed: () async { -// // sectionItem.selectedValue = []; -// // sectionItem.extension = []; -// // sectionItem.fileName = []; -// // await getEncodedFile(sectionItem); -// // setState(() {}); -// // }, -// // width: 120, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.black, -// // title: sectionItem.name, -// // ), -// // const SizedBox(width: 5), -// // Text( -// // sectionItem.selectedValue!.isNotEmpty -// // ? 'File uploaded' -// // : 'No file uploaded', -// // style: TextStyle( -// // color: sectionItem -// // .selectedValue!.isNotEmpty -// // ? Colors.green -// // : Colors.red), -// // ), -// // ], -// // ) -// // : isTablet -// // ? IconButton( -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); -// // setState(() {}); -// // }, -// // icon: const Icon( -// // Icons.cancel, -// // size: 30, -// // color: Color.fromARGB(255, 8, 39, 92), -// // ), -// // ) -// // : Padding( -// // padding: const EdgeInsets.only( -// // left: 3.0, top: 5), -// // child: CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 75, 75), -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); -// // setState(() {}); -// // }, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.white, -// // title: "Delete", -// // ), -// // ) -// // : returnWidget( -// // sectionItem: sectionItem, -// // item: item, -// // provider: provider, -// // list: list, -// // gridIndex: i, -// // listIndex: listIndex, -// // widgetData: sectionItem.widget!, -// // multiple: true, -// // ), -// // ], -// // ); -// // }, -// // ), -// // ], -// // ), -// // ); - -// // return Padding( -// // padding: isTablet -// // ? const EdgeInsets.only(left: 8.0) -// // : const EdgeInsets.only(left: 12.0, right: 12.0), -// // child: GridView.count( -// // physics: const NeverScrollableScrollPhysics(), -// // crossAxisCount: context.responsive( -// // 1, -// // sm: 1, // small -// // md: 1, // medium -// // lg: sectionList.length == 1 -// // ? 1 -// // : (sectionList.length >= 1 ? 3 : 3), // large -// // xl: 3, // extra large screen -// // ), -// // mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, -// // shrinkWrap: true, -// // padding: EdgeInsets.zero, -// // childAspectRatio: MediaQuery.of(context).size.width / -// // (MediaQuery.of(context).size.height / 3), -// // children: List.generate( -// // sectionList.length, -// // (i) { -// // print("sectionList_issss: $sectionList"); -// // SectionList sectionItem = sectionList[i]; -// // dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN -// // ? sectionItem.value ?? "Select" -// // : ' '; -// // List 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.input == 'add' || -// // sectionItem.input == 'deletebtn' -// // ? const SizedBox.shrink() -// // : Text( -// // '${sectionItem.name}:*', -// // style: TextStyle( -// // color: Colors.orange.shade800, -// // fontSize: isTablet ? 18 : 14, -// // ), -// // ), -// // // const SizedBox( -// // // height: 15, -// // // ), -// // sectionItem.widget == InteractionWidget.BUTTON -// // ? sectionItem.input == 'chooseFile' -// // ? Row( -// // children: [ -// // CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 229, 229), -// // onPressed: () async { -// // sectionItem.selectedValue = []; -// // sectionItem.extension = []; -// // sectionItem.fileName = []; -// // await getEncodedFile(sectionItem); - -// // setState(() {}); -// // }, -// // width: 120, -// // height: 40, -// // fontsize: 12, -// // textColor: Colors.black, -// // title: sectionItem.name), -// // const SizedBox( -// // width: 5, -// // ), -// // Text( -// // sectionItem.selectedValue!.isNotEmpty -// // ? sectionItem.selectedValue!.isNotEmpty -// // ? 'File uploaded' -// // : "Files Uploaded" -// // : 'No file uploaded', -// // style: TextStyle( -// // color: -// // sectionItem.selectedValue!.isNotEmpty -// // ? Colors.green -// // : Colors.red), -// // ), -// // ], -// // ) -// // : isTablet -// // ? IconButton( -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); - -// // setState(() {}); -// // }, -// // icon: const Icon( -// // Icons.cancel, -// // size: 30, -// // color: Color.fromARGB(255, 8, 39, 92), -// // ), -// // ) -// // : Padding( -// // padding: -// // const EdgeInsets.only(left: 3.0, top: 5), -// // child: CustomButton( -// // backgroundColor: const Color.fromARGB( -// // 255, 233, 75, 75), -// // onPressed: () { -// // provider.deleteMultipleRows( -// // sectionItem.gid!, -// // sectionList[i], -// // sectionName); - -// // setState(() {}); -// // }, -// // // width: 80, -// // // height: 30, - -// // height: 40, - -// // // height: -// // // MediaQuery.of(context).size.height * -// // // 0.2, -// // fontsize: 12, -// // textColor: Colors.white, -// // title: "Delete"), -// // ) -// // : returnWidget( -// // sectionItem: sectionItem, -// // item: item, -// // provider: provider, -// // list: list, -// // gridIndex: i, -// // listIndex: listIndex, -// // widgetData: sectionItem.widget!, -// // multiple: true), -// // ], -// // ), -// // ]); -// // }, -// // ), -// // ), -// // ); -// //} - -// String fieldsValidation(InteractionProvider provider) { -// List secList = provider.sectionList -// .where((element) => element.validation!.isRequired = true) -// .toList(); -// if (secList.any((element) => element.selectedValue!.isEmpty)) { -// return 'Fields cannot be empty'; -// } -// return ''; -// } - -// String textFieldsValidation(InteractionProvider provider) { -// // if (provider.sectionList -// // .any((element) => element.widget == InteractionWidget.TEXT)) { -// // if (provider.sectionList -// // .any((element) => element.controller!.text.isEmpty)) { -// // return 'Fields cannot be empty'; -// // } -// // if (provider.textEditingControllerList.isNotEmpty) { -// // if (provider.validateTextFields()) { -// // return 'Fields cannot be empty'; -// // } -// // } - -// // if (provider.multipletextEditingControllerList.isNotEmpty) { -// // if (provider.validateMultipleRows()) { -// // return 'Fields cannot be empty'; -// // } -// // } -// // } - -// return ''; -// } - -// _displaySnackBar(String msg) { -// final snackBar = SnackBar( -// content: Text( -// msg, -// style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), -// )); -// ScaffoldMessenger.of(context).showSnackBar(snackBar); -// //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); -// } - -// Future getEncodedFile(SectionList sectionItem) async { -// String base64Image = ''; -// var status = Platform.isAndroid -// ? await Permission.manageExternalStorage.status -// : await Permission.storage.status; -// if (status.isGranted) { -// FilePickerResult? result = -// await FilePicker.platform.pickFiles(allowMultiple: true); - -// if (result != null) { -// print(result.files.first.path); -// print(result.files.last.path); -// for (var files in result.files) { -// File file = File(files.path!); -// print("check file path : ${file.path}"); -// fileName = file.path.split('/').last; -// // Get the application folder directory -// Directory? directory = Platform.isAndroid -// ? await getExternalStorageDirectory() //FOR ANDROID -// : await getApplicationDocumentsDirectory(); -// String newPath = ""; //FOR ios -// String convertedDirectoryPath = (directory?.path).toString(); - -// print("see the converted directory path $convertedDirectoryPath"); - -// newPath = "$convertedDirectoryPath/konectar/files"; -// print("new path :$newPath"); -// directory = Directory(newPath); -// if (!await directory.exists()) { -// await directory.create(recursive: true); -// } -// File newFile = await file.copy('${directory.path}/$fileName'); -// print("new path is ${newFile.path}"); -// final extension = p.extension(newFile.path); -// List imageBytes = await newFile.readAsBytes(); -// Uint8List imageUint8List = Uint8List.fromList(imageBytes); -// base64Image = base64Encode(imageUint8List); -// sectionItem.selectedValue!.add(base64Image); -// sectionItem.extension!.add(extension); -// sectionItem.fileName!.add(fileName); -// } -// } -// } else { -// print("not permitted"); -// await requestPermission(Platform.isAndroid -// ? Permission.manageExternalStorage -// : Permission.storage); -// } -// } - -// showAlertDialog(BuildContext context, String record) { -// // set up the buttons -// // ViewInteractionProvider provider = -// // Provider.of(context, listen: false); -// Widget cancelButton = TextButton( -// child: const Text("Ok"), -// onPressed: () async { -// Navigator.of(context).pop(); -// Navigator.of(context).pop(); +// child: Text(' ${item.sectionName}')) +// : Container(), +// ); +// }); // }, -// ); +// // itemBuilder: (context) => [ -// // set up the AlertDialog -// AlertDialog alert = AlertDialog( -// title: const Text(""), -// content: Text("Form $record Saved Successfully!"), -// actions: [ -// cancelButton, -// ], -// ); - -// // show the dialog -// showDialog( -// context: context, -// builder: (BuildContext context) { -// return alert; -// }, -// ); -// } +// // const PopupMenuItem( +// // value: 1, +// // child: Text( +// // "Flutter Open", +// // style: +// // TextStyle(color: Colors.black, fontWeight: FontWeight.w700), +// // ), +// // ), +// // const PopupMenuItem( +// // value: 2, +// // child: Text( +// // "Flutter Tutorial", +// // style: +// // TextStyle(color: Colors.black, fontWeight: FontWeight.w700), +// // ), +// // ), +// // ], +// icon: Container( +// height: double.infinity, +// width: double.infinity, +// decoration: const ShapeDecoration( +// color: Color.fromARGB(255, 8, 39, 92), +// shape: StadiumBorder( +// side: BorderSide(color: Colors.white, width: 2), +// ), +// ), +// child: Icon(Icons.add, color: Colors.white), +// )); // } diff --git a/lib/ui_screen/interactionform/view_interaction_screen.dart b/lib/ui_screen/interactionform/view_interaction_screen.dart index b5a53b5..1f0f02d 100644 --- a/lib/ui_screen/interactionform/view_interaction_screen.dart +++ b/lib/ui_screen/interactionform/view_interaction_screen.dart @@ -73,6 +73,7 @@ class _ViewInteractionScreenState extends State { ), ), body: Column( + mainAxisSize: MainAxisSize.min, children: [ Expanded( child: ListView.builder( @@ -82,200 +83,170 @@ class _ViewInteractionScreenState extends State { 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, + return Container( + color: Constants.k2color, + child: ExpansionTile( + initiallyExpanded: true, + title: Stack( + alignment: AlignmentDirectional.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( - // 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( - 1, - sm: 1, // small - md: 2, // medium - lg: sectionList.length == 1 - ? 1 - : 3, // large - xl: 3, // extra large screen + Container( + // height: double.infinity, + width: double.infinity, + padding: const EdgeInsets.all(0.0), + decoration: BoxDecoration( + // color: Color(0xFF2b9af3), + color: Constants.k2color, ), - mainAxisSpacing: - sectionList.length == 1 || - !isTablet - ? 1 - : 3.5, - childAspectRatio: - sectionList.length == 1 - ? orientation == - Orientation.landscape - ? 10 - : 4.8 - : isTablet - ? 2.8 - : 3.0, - // 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 || + child: Text( + item.sectionName, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 18.0), + )), + ]), + children: [ + Container( + color: Colors.white, + child: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: + CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(18.0), + child: GridView.count( + physics: + const NeverScrollableScrollPhysics(), + crossAxisCount: + context.responsive( + 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.5, + shrinkWrap: true, + padding: EdgeInsets.zero, + children: List.generate( + sectionList.length, + (i) { + print(sectionList); + SectionList sectionItem = + sectionList[i]; + dropdownvalue = sectionItem.widget == - InteractionWidget - .AUTOCOMPLETE || - sectionItem.widget == - InteractionWidget - .MULTISELECT - ? provider - .getData2(sectionItem) - : []; - provider.checkboxlist = - sectionItem.widget == - InteractionWidget - .CHECKBOX + InteractionWidget + .DROPDOWN + ? sectionItem.value ?? + "Select" + : ' '; + List< + InputClass> list = sectionItem + .widget == + InteractionWidget + .DROPDOWN || + sectionItem.widget == + InteractionWidget + .AUTOCOMPLETE || + sectionItem.widget == + InteractionWidget + .MULTISELECT ? provider .getData2(sectionItem) : []; - - return Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - sectionItem.widget == + provider.checkboxlist = + 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, - ), - ], - ); - }, + .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, + ), + ), + returnWidget( + sectionItem: + sectionItem, + item: item, + provider: provider, + list: list, + gridIndex: i, + listIndex: index, + widgetData: + sectionItem + .widget!), + ], + ); + }, + ), + ), ), - ), + + 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(), + ], ), - 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(), - ], + ), ), - ), - ]); + ]), + ); }, ), ), @@ -395,88 +366,6 @@ class _ViewInteractionScreenState extends State { ); } - // Widget gridViewWidget( - // InteractionProvider provider, - // String sectionName, - // List 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( - // 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 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, @@ -501,128 +390,96 @@ class _ViewInteractionScreenState extends State { print("ConvertedArrayEdit.leangth: $convertedArray"); print("ConvertedArray.leangth2323: ${convertedArray.length}"); - return Padding( - padding: isTablet - ? const EdgeInsets.only(left: 0.0, right: 0.0) - : const EdgeInsets.only(left: 12.0, right: 12.0), - child: Column( - children: [ - for (var i = 0; i < convertedArray.length; i++) - DecoratedBox( - decoration: BoxDecoration( - // borderRadius: BorderRadius.circular(10.0), - color: i % 2 == 0 - ? Color.fromARGB(133, 213, 241, 254) - : Colors.white, - ), - child: GridView.builder( - physics: const NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: context.responsive( - 1, // default - sm: 1, // small - md: 2, // medium - lg: sectionList.length == 1 - ? 1 - : (sectionList.length >= 1 ? 3 : 3), - // lg: sectionList.length == 1 ? 1 : 3, // large - xl: 3, // extra large screen - ), - childAspectRatio: sectionList.length == 1 - ? orientation == Orientation.landscape - ? 10 - : 4.8 - : isTablet - ? 2.8 - : 3.0, - - mainAxisSpacing: - sectionList.length == 1 || !isTablet ? 1 : 3.5, - // 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 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 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 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() - - // ? 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!), - ], - ), - ); - }, - ), + return Column( + children: [ + for (var i = 0; i < convertedArray.length; i++) + DecoratedBox( + decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(10.0), + color: i % 2 == 0 + ? Color.fromARGB(133, 213, 241, 254) + : Colors.white, ), - //), - ], - ), + child: GridView.builder( + physics: const NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: context.responsive( + 1, // default + sm: 1, // small + md: 2, // medium + lg: sectionList.length == 1 + ? 1 + : (sectionList.length >= 1 ? 3 : 3), + // lg: sectionList.length == 1 ? 1 : 3, // large + xl: 3, // extra large screen + ), + childAspectRatio: sectionList.length == 1 + ? orientation == Orientation.landscape + ? 10 + : 4.8 + : isTablet + ? 2.8 + : 3.7, + + mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 3.5, + // mainAxisSpacing: sectionList.length == 1 || !isTablet ? 1 : 2, + ), + shrinkWrap: true, + padding: EdgeInsets.zero, + itemCount: convertedArray[i].length, + itemBuilder: (context, index) { + SectionList sectionItem = convertedArray[i][index]; + dropdownvalue = sectionItem.widget == InteractionWidget.DROPDOWN + ? sectionItem.value ?? "Select" + : ' '; + List 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 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() + + // ? 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!), + ], + ), + ); + }, + ), + ), + //), + ], ); } @@ -645,3 +502,677 @@ class _ViewInteractionScreenState extends State { //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); } } + + + + + + + + + + + + + + + + + + + + + + + + + + + +// import 'package:discover_module/constants.dart'; +// import 'package:discover_module/ui_screen/interactionform/interactionprovider.dart'; +// import 'package:discover_module/ui_screen/interactionform/model/interaction_data.dart'; +// import 'package:discover_module/ui_screen/interactionform/model/save_interaction.dart'; +// import 'package:discover_module/ui_screen/interactionform/util.dart'; +// import 'package:discover_module/ui_screen/interactionform/widget/custombutton.dart'; +// import 'package:discover_module/ui_screen/interactionform/widget/responsive_ext.dart'; +// import 'package:flutter/material.dart'; +// import 'package:provider/provider.dart'; + +// // ignore: must_be_immutable +// class ViewInteractionScreen extends StatefulWidget { +// SaveInteraction saveInteraction; +// ViewInteractionScreen({super.key, required this.saveInteraction}); + +// @override +// State createState() => _ViewInteractionScreenState(); +// } + +// class _ViewInteractionScreenState extends State { +// List interactionReponseList = []; +// List sectionList = []; +// List textEditingControllerList = []; +// int textfieldIndex = 0; +// String dropdownvalue = 'Select value'; +// String? fileName; +// final TextEditingController textEditingController = TextEditingController(); +// @override +// void initState() { +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { +// init(); +// }); + +// super.initState(); +// } + +// init() async { +// await Provider.of(context, listen: false) +// .initSavedForm(widget.saveInteraction); +// setState(() {}); +// } + +// @override +// Widget build(BuildContext context) { +// return Consumer( +// builder: (BuildContext context, provider, Widget? child) { +// print("build context"); +// print("${provider.interactionReponseList}"); +// return GestureDetector( +// onTap: () { +// FocusScope.of(context).requestFocus(FocusNode()); +// }, +// child: OrientationBuilder(builder: (context, orientation) { +// return SafeArea( +// child: 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, +// ), +// ), +// ), +// 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( +// // 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( +// 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, +// // 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), +// ], +// )), +// ); +// }), +// ); +// }); +// } + +// Widget returnWidget({ +// required SectionList sectionItem, +// required FormFieldData item, +// required InteractionProvider provider, +// required List list, +// required int gridIndex, +// required int listIndex, +// required InteractionWidget widgetData, +// }) { +// switch (widgetData) { +// case InteractionWidget.CHECKBOX: +// return (sectionItem.inputList!.length >= 5) +// ? Text(sectionItem.selectedValue.toString()) +// : Text(provider.getDataValue( +// sectionItem.id, sectionItem.selectedValue!.last)); + +// case InteractionWidget.AUTOCOMPLETE: +// return Text(provider.getDataValue( +// sectionItem.id, sectionItem.selectedValue!.last)); + +// case InteractionWidget.MULTISELECT: +// return Text(sectionItem.selectedValue.toString()); + +// case InteractionWidget.RADIO: +// return (sectionItem.inputList!.length >= 5) +// ? Text(sectionItem.selectedValue!.isNotEmpty +// ? provider.getDataValue( +// sectionItem.id, sectionItem.selectedValue!.last) +// : " ") +// : Text(provider.getDataValue( +// sectionItem.id, sectionItem.selectedValue!.last)); + +// case InteractionWidget.LABEL: +// return Text(sectionItem.input!); + +// case InteractionWidget.RANGESLIDER: +// return Text(sectionItem.selectedValue!.isNotEmpty +// ? sectionItem.selectedValue!.last.toString() +// : " "); + +// case InteractionWidget.TEXT: +// return Text(sectionItem.selectedValue!.isNotEmpty +// ? sectionItem.selectedValue!.last.toString() +// : " "); + +// case InteractionWidget.BUTTON: +// return sectionItem.input == "chooseFile" +// ? sectionItem.selectedValue!.isNotEmpty +// ? const Text("File Uploaded") +// : const Text(" ") +// : const Text(" "); +// default: +// return Text(sectionItem.selectedValue!.isNotEmpty +// ? provider.getDataValue( +// sectionItem.id, sectionItem.selectedValue!.last) +// : " "); +// } +// } + +// Widget saveActions(InteractionProvider provider) { +// return Align( +// alignment: Alignment.centerRight, +// child: Row( +// mainAxisAlignment: MainAxisAlignment.spaceEvenly, +// children: [ +// CustomButton( +// backgroundColor: Colors.red.shade800, +// onPressed: () { +// //showDeleteProfileAlertDialog(context); +// for (var textcontrollers in provider.textEditingControllerList) { +// textcontrollers.text = ''; +// } +// }, +// textColor: Colors.white, +// title: "Reset", +// height: 40, +// width: isTablet ? 100 : 60, +// fontsize: isTablet ? 15 : 10.2, +// ), +// SizedBox( +// width: isTablet ? 20 : 4, +// ), +// CustomButton( +// backgroundColor: Colors.green.shade900, +// onPressed: () async { +// if (textFieldsValidation(provider).isEmpty) { +// // await provider.saveJsonObject(context, widget.form); +// _displaySnackBar('Form Saved Sucessfully!'); +// } else { +// _displaySnackBar(textFieldsValidation(provider)); +// } +// }, +// textColor: Colors.white, +// title: "Save", +// height: 40, +// width: isTablet ? 100 : 60, +// fontsize: isTablet ? 16 : 12, +// ), +// SizedBox( +// width: isTablet ? 20 : 2, +// ), +// ], +// ), +// ); +// } + +// // Widget gridViewWidget( +// // InteractionProvider provider, +// // String sectionName, +// // List 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( +// // 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 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, +// List sectionList, +// Orientation orientation, +// FormFieldData item, +// int listIndex) { +// List pooja = sectionList; + +// print("Pooja: $pooja"); + +// List> 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: 0.0, right: 0.0) +// : const EdgeInsets.only(left: 12.0, right: 12.0), +// child: Column( +// children: [ +// for (var i = 0; i < convertedArray.length; i++) +// DecoratedBox( +// decoration: BoxDecoration( +// // borderRadius: BorderRadius.circular(10.0), +// color: i % 2 == 0 +// ? Color.fromARGB(133, 213, 241, 254) +// : Colors.white, +// ), +// child: GridView.builder( +// physics: const NeverScrollableScrollPhysics(), +// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( +// crossAxisCount: context.responsive( +// 1, // default +// sm: 1, // small +// md: 2, // medium +// lg: sectionList.length == 1 +// ? 1 +// : (sectionList.length >= 1 ? 3 : 3), +// // lg: sectionList.length == 1 ? 1 : 3, // large +// xl: 3, // extra large screen +// ), +// childAspectRatio: sectionList.length == 1 +// ? orientation == Orientation.landscape +// ? 10 +// : 4.8 +// : isTablet +// ? 2.8 +// : 3.0, + +// mainAxisSpacing: +// sectionList.length == 1 || !isTablet ? 1 : 3.5, +// // 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 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 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 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() + +// // ? 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!), +// ], +// ), +// ); +// }, +// ), +// ), +// //), +// ], +// ), +// ); +// } + +// String textFieldsValidation(InteractionProvider provider) { +// if (provider.sectionList +// .any((element) => element.controller!.text.isEmpty)) { +// return 'Fields cannot be empty'; +// } + +// return ''; +// } + +// _displaySnackBar(String msg) { +// final snackBar = SnackBar( +// content: Text( +// msg, +// style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), +// )); +// ScaffoldMessenger.of(context).showSnackBar(snackBar); +// //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); +// } +// } diff --git a/lib/ui_screen/interactionform/widget/interatciontextfield.dart b/lib/ui_screen/interactionform/widget/interatciontextfield.dart index f4ff2c7..1ee76b5 100644 --- a/lib/ui_screen/interactionform/widget/interatciontextfield.dart +++ b/lib/ui_screen/interactionform/widget/interatciontextfield.dart @@ -54,12 +54,14 @@ class InteractionTextField extends StatelessWidget { ], decoration: InputDecoration( isDense: true, - // contentPadding: EdgeInsets.all(11.0), - + // contentPadding: const EdgeInsets.symmetric( + // horizontal: 10, + // vertical: 18, + // ), + contentPadding: EdgeInsets.all(13.0), border: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), ), - suffixIcon: suffixIcon, hintText: hintText, ), diff --git a/lib/ui_screen/new_contacts.dart b/lib/ui_screen/new_contacts.dart new file mode 100644 index 0000000..49e2c0e --- /dev/null +++ b/lib/ui_screen/new_contacts.dart @@ -0,0 +1,236 @@ +import 'package:discover_module/provider_class/hcp%20_provider.dart'; +import 'package:discover_module/ui_screen/interactionform/NewtworkConnectivity.dart'; +import 'package:discover_module/ui_screen/new_profile.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_profile_picture/flutter_profile_picture.dart'; +import 'package:hive_flutter/hive_flutter.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter/services.dart'; +import 'package:discover_module/ui_screen/profile.dart'; + +class Contacts1 extends StatefulWidget { + const Contacts1({Key? key}) : super(key: key); + + @override + State createState() => _Contacts1State(); +} + +class _Contacts1State extends State { + final _contactBox = Hive.box("mycontact"); + bool _switchValue = false; + bool isOnline2 = true; + + @override + void initState() { + super.initState(); + setupConnectivityListener(); + getCall(); + } + + Future setupConnectivityListener() async { + while (true) { + bool isOnline = await NetworkConnectivity().isInternetAvailable(); + print('Internet contact available: $isOnline'); + await Future.delayed(Duration(seconds: 2)); + if (mounted) { + setState(() { + isOnline2 = isOnline; + }); + } + } + } + + // @override + // void dispose() { + // // TODO: implement dispose + // } + void getCall() async { + await Provider.of(context, listen: false).getHCPProvider(); + } + + @override + Widget build(BuildContext context) { + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle(statusBarColor: Color.fromARGB(255, 0, 71, 132))); + + return SafeArea( + child: Scaffold( + body: Consumer( + builder: (context, value, child) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + 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, + ), + ), + ), + ), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + _switchValue + ? const Text( + 'All', + style: TextStyle( + fontSize: 12, + decoration: TextDecoration.lineThrough, + decorationThickness: 0.85, + ), + ) + : const Text( + 'All', + style: TextStyle( + fontSize: 12, + ), + ), + CupertinoSwitch( + activeColor: Color.fromARGB(255, 0, 71, 132), + value: _switchValue, + onChanged: (value) { + setState(() { + _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, + ), + ), + ) + ], + ), + ], + ), + isOnline2 + ? Expanded( + child: ListView.builder( + itemCount: value.list.length, + itemBuilder: (BuildContext context, int index) { + var data = value.list[index]; + return Column( + children: [ + ListTile( + onTap: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (context) => Profile( + // text: data, + // ), + // ), + // ); + + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + NewProfile(text: data))); + }, + leading: data["img_path"] == null + ? ProfilePicture( + name: data["name"], + radius: 20, + fontsize: 12, + ) + : ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(20), + child: Image.network( + data["img_path"], + fit: BoxFit.cover), + ), + ), + trailing: Text("Added by\nPooja k"), + title: Text( + "${data["name"]}", + style: const TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + subtitle: Text( + "${data["speciality"]}\n${data["addr"]},", + style: const TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.normal, + ), + ), + ), + Divider(), + ], + ); + }, + ), + ) + : Expanded( + child: ListView.builder( + itemCount: _contactBox.values.length, + itemBuilder: (BuildContext context, int index) { + var data = _contactBox.get(index); + print(":data_is: $data"); + return ListTile( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Profile( + text: data!, + ), + ), + ); + }, + leading: ProfilePicture( + name: data["name"], + radius: 20, + fontsize: 12, + ), + title: Text( + data["name"], + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + ), + subtitle: Text( + "Added by Pooja.K", + style: TextStyle( + fontSize: 14.0, + fontWeight: FontWeight.normal, + ), + ), + ); + }, + ), + ), + ], + ); + }, + ), + ), + ); + } +} diff --git a/lib/ui_screen/new_profile.dart b/lib/ui_screen/new_profile.dart new file mode 100644 index 0000000..8082108 --- /dev/null +++ b/lib/ui_screen/new_profile.dart @@ -0,0 +1,3853 @@ +import 'package:discover_module/custom_widget/text.dart'; +import 'package:discover_module/hive_fun.dart'; +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:discover_module/provider_class/events_provider.dart'; +import 'package:discover_module/provider_class/publications_provider.dart'; +import 'package:discover_module/provider_class/trials_provider.dart'; +import 'package:discover_module/ui_screen/affiliation_data.dart'; +import 'package:discover_module/ui_screen/events_data.dart'; +import 'package:discover_module/ui_screen/interactionform/NewtworkConnectivity.dart'; +import 'package:discover_module/ui_screen/interactionform/configprovider.dart'; +import 'package:discover_module/ui_screen/interactionform/edit_interaction_screen.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:discover_module/ui_screen/interactionform/view_interaction_screen.dart'; +import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart'; +import 'package:discover_module/ui_screen/newformlist.dart'; +import 'package:discover_module/ui_screen/publication_data.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_profile_picture/flutter_profile_picture.dart'; +import 'package:provider/provider.dart'; + +class NewProfile extends StatefulWidget { + const NewProfile({Key? key, required this.text}) : super(key: key); + final Map text; + + @override + State createState() => _NewProfileState(); +} + +class _NewProfileState extends State { + bool isonline = false; + List affiliation_data = []; + List publication_data = []; + List event_data = []; + List trial_data = []; + + List viewformData = []; + + bool _isExpanded = false; + // final ScrollController controller = ScrollController(); + + // final ScrollController controller2 = ScrollController(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + print("pooja123"); + + getaffiliations(); + + getuserdetails(); + + init(); + print("Widget_isssIndex_iss ${widget.text}"); + print( + "Widget_isssIndex_iss ${widget.text!["id"]},${widget.text!["name"]},${widget.text!["img_path"]}"); + } + + init() async { + await Provider.of(context, listen: false) + .initConfigData(); + final data = + await Provider.of(context, listen: false); + + // if(data.g) + data.getRecords("form-3 demo"); + setState(() {}); + } + + getaffiliations() async { + var affiliations = + Provider.of(context, listen: false); + + await affiliations.getAffiliationsdata(); + final affilist = affiliations.adddta; + + var publication = Provider.of(context, listen: false); + + await publication.publicatininfo(); + final publist = publication.publicationlist; + + var events = Provider.of(context, listen: false); + await events.geteventdata(); + final eventlist = events.EventsList; + + var form = Provider.of(context, listen: false); + // form.savedList; + + var trials = Provider.of(context, listen: false); + await trials.trialsdata(); + + final trialslist = trials.trialsinfo; + + setState(() { + affiliation_data = affilist; + publication_data = publist; + event_data = eventlist; + viewformData = form.savedList; + trial_data = trialslist; + }); + + print("Affiliations_data_is: $affilist"); + print("trialslist_data_is: $trialslist"); + } + + getuserdetails() async { + // HiveFunctions.getindexUser(widget.text); + + NetworkConnectivity networkConnectivity = NetworkConnectivity(); + bool isonline1 = await networkConnectivity.isInternetAvailable(); + + setState(() { + print("Profile_isOnline: $isonline1"); + isonline = isonline1; + }); + } + + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + //backgroundColor: Color.fromARGB(255, 200, 222, 241), + backgroundColor: Color.fromARGB(255, 237, 230, 230), + appBar: AppBar( + //backgroundColor: Colors.transparent, + title: const Text('Profile'), + ), + body: ListView( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + // Padding( + // padding: EdgeInsets.all(8.0), + // child: ProfilePicture( + // name: widget.text!["name"], + // radius: 38, + // fontsize: 21, + // ), + // ), + Padding( + padding: EdgeInsets.all(8.0), + child: widget.text!["img_path"] == null + ? ProfilePicture( + name: widget.text!["name"], + radius: 38, + fontsize: 21, + ) + : ClipOval( + child: SizedBox.fromSize( + size: Size.fromRadius(48), // Image radius + child: Image.network(widget.text!["img_path"], + fit: BoxFit.cover), + ), + )), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Text( + // "Gerosa, Gino", + // style: TextStyle( + // fontSize: 22.0, + // color: Colors.black, + // ), + // ), + Text1( + title: "Dr " + widget.text!["name"], + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 22.0), + // Text( + // "Cardiac Surgery", + // style: TextStyle( + // fontWeight: FontWeight.bold, fontSize: 14.0), + // ), + Text1( + title: widget.text!["speciality"], + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ], + ), + SizedBox( + height: 15.0, + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + 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: widget.text!["addr"] ?? + "Azienda Ospedaliera di Padova", + txtcolor: Colors.black, + txtfont: 15.0, + fontweight: FontWeight.normal, + )), + ]), + ), + const SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: Row(children: [ + const Icon( + Icons.location_pin, + color: Color.fromARGB(255, 0, 71, 132), + ), + const SizedBox( + width: 3.0, + ), + Expanded( + // child: Text( + // "Via Giustiniani, 2, Padova, Veneto 35128, Italy", + // style: TextStyle( + // fontWeight: FontWeight.bold, fontSize: 14.0), + // ), + child: Text1( + title: widget.text!["adrr"] ?? + "Via Giustiniani, 2, Padova, Veneto 35128, Italy", + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ), + ]), + ), + const SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: 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: widget.text!["phone_no"].toString(), + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ]), + ), + const SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: Row(children: [ + const Icon( + Icons.call, + color: Color.fromARGB(255, 0, 71, 132), + ), + const SizedBox( + width: 3.0, + ), + Text1( + title: widget.text!["phone_no"].toString(), + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ]), + ), + const SizedBox( + height: 8.0, + ), + Padding( + padding: const EdgeInsets.only(left: 15.0), + child: Row(children: [ + const Icon( + Icons.email, + color: Color.fromARGB(255, 0, 71, 132), + ), + const SizedBox( + width: 3.0, + ), + Text1( + title: widget.text!["email"], + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ]), + ), + const SizedBox( + height: 8.0, + ), + // isonline + // ? + Container( + width: MediaQuery.of(context).size.width, + child: Card( + elevation: 4, + clipBehavior: Clip.antiAliasWithSaveLayer, + surfaceTintColor: Colors.white, + // shape: RoundedRectangleBorder( + // borderRadius: + // BorderRadius.circular(0.0), + // ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // const Text( + // "Profile Summarry", + // style: TextStyle( + // fontSize: 20.0, fontWeight: FontWeight.bold), + // ), + Padding( + padding: const EdgeInsets.all(12.0), + child: Text1( + title: "Profile Summarry", + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 18.0), + ), + + Padding( + padding: const EdgeInsets.all(12.0), + child: Text1( + title: widget.text!["summarry"], + txtcolor: Colors.black, + fontweight: FontWeight.normal, + txtfont: 15.0), + ), + Padding( + padding: EdgeInsets.all(0.0), + + child: Padding( + padding: const EdgeInsets.all(0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // const SizedBox(height: 10), + // Flexible( + // flex: 1, + // child: Padding( + // padding: const EdgeInsets.only( + // left: 1.0, right: 1.0), + // child: Card( + // elevation: 5, + // shape: RoundedRectangleBorder( + // borderRadius: + // BorderRadius.circular(0.0), + // ), + // color: const Color.fromARGB( + // 255, 0, 71, 137), + // child: ExpansionTile( + // maintainState: true, + // // onExpansionChanged: + // // (bool expanded) { + // // setState(() { + // // _isExpanded = expanded; + // // }); + // // }, + // backgroundColor: + // const Color.fromARGB( + // 255, 0, 71, 137), + // collapsedIconColor: Colors.white, + // // trailing: Icon( + // // _isExpanded + // // ? Icons.keyboard_arrow_up + // // : Icons + // // .keyboard_arrow_down, + // // color: Colors.white), + // // collapsedBackgroundColor: Color(0xFF2b9af3), + // initiallyExpanded: true, + // title: Row( + // //mainAxisSize: MainAxisSize.min, + // children: [ + // Text1( + // title: "Affiliations", + // txtcolor: Colors.white, + // fontweight: + // FontWeight.normal, + // txtfont: 17.0), + // const SizedBox( + // width: 8.0, + // ), + // // Text1( + // // title: widget + // // .text![ + // // "affiliations_count"] + // // .toString(), + // // txtfont: 18.0, + // // txtcolor: + // // const Color + // // .fromARGB( + // // 255, + // // 60, + // // 82, + // // 102), + // // ) + // ], + // ), + // children: [ + // SingleChildScrollView( + // scrollDirection: + // Axis.horizontal, + // child: Container( + // width: + // MediaQuery.of(context) + // .size + // .width, + // color: Colors.white, + // child: DataTable( + // columns: const [ + // DataColumn( + // label: Expanded( + // child: Text( + // 'sl no'))), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Organization Name'), + // )), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Department'))), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Role'))), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Time Frame'))), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Org Type'))), + // DataColumn( + // label: Expanded( + // child: Text( + // 'Eng Type'))), + // // Add more columns as needed + // ], + // rows: List.generate( + // affiliation_data.length, + // (index) => DataRow( + // cells: [ + // DataCell(Text( + // affiliation_data[ + // index] + // ['id'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // [ + // 'org_name'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // ['dept'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // ['role'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // [ + // 'time_frame'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // [ + // 'org_type'] + // .toString())), + // DataCell(Text( + // affiliation_data[ + // index] + // [ + // 'emg_type'] + // .toString())), + // // Add more DataCells as needed + // ], + // ), + // ), + // ), + // ), + // ), + // Container( + // color: Colors.white, + // child: Align( + // alignment: Alignment.center, + // child: Padding( + // padding: + // const EdgeInsets.all( + // 8.0), + // child: OutlinedButton( + // onPressed: () { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (_) => + // AffiliationsData())); + // }, + // child: + // Text('Show More'), + // style: OutlinedButton + // .styleFrom( + // shape: + // RoundedRectangleBorder( + // borderRadius: + // BorderRadius + // .circular( + // 12), + // ), + // ), + // ), + // ), + // ), + // ) + // ]), + // ), + // ), + // ), + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Padding( + padding: const EdgeInsets.only( + left: 1.0, right: 1.0), + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons.keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Row( + mainAxisAlignment: + MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Affiliations", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + const SizedBox( + width: 8.0, + ), + Text1( + title: "4", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + ], + ), + children: [ + Scrollbar( + child: SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + // width: + // MediaQuery.of(context) + // .size + // .width, + constraints: BoxConstraints( + minWidth: + MediaQuery.of( + context) + .size + .width), + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + '', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Organization Name'), + )), + DataColumn( + label: Expanded( + child: Text( + 'Department'))), + DataColumn( + label: Expanded( + child: Text( + 'Role'))), + DataColumn( + label: Expanded( + child: Text( + 'Time Frame'))), + DataColumn( + label: Expanded( + child: Text( + 'Org Type'))), + DataColumn( + label: Expanded( + child: Text( + 'Eng Type'))), + + // Add more columns as needed + ], + rows: List.generate( + affiliation_data + .length, + (index) => DataRow( + cells: [ + DataCell(Text( + affiliation_data[ + index] + ['id'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'org_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'dept'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'role'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'time_frame'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'org_type'] + .toString(), + softWrap: + true)), + DataCell(Text( + affiliation_data[ + index] + [ + 'emg_type'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: Alignment.center, + child: Padding( + padding: + const EdgeInsets.all( + 8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + AffiliationsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), + ), // adds spacing between the text and image + + SizedBox( + height: 10.0, + ), + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Padding( + padding: const EdgeInsets.only( + left: 1.0, right: 1.0), + child: Container( + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons + .keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + initiallyExpanded: true, + title: Row( + mainAxisAlignment: + MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Publications", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + const SizedBox( + width: 8.0, + ), + Text1( + title: "3", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + // Text1( + // title: widget + // .text![ + // "publications_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: Color + // .fromARGB( + // 255, + // 0, + // 71, + // 137), + // ) + ], + ), + children: [ + Scrollbar( + //isAlwaysShown: true, + child: + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + // width: MediaQuery.of( + // context) + // .size + // .width, + constraints: BoxConstraints( + minWidth: + MediaQuery.of( + context) + .size + .width), + + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + 'sl no'))), + DataColumn( + label: Expanded( + child: Text( + 'Artical Title', + softWrap: + true), + )), + DataColumn( + label: Expanded( + child: Text( + 'Journal Name', + softWrap: true, + ))), + DataColumn( + label: Expanded( + child: Text( + 'Date'))), + DataColumn( + label: Expanded( + child: Text( + 'Authors'))), + + // Add more columns as needed + ], + rows: List.generate( + publication_data + .length, + (index) => DataRow( + cells: [ + DataCell(Text( + publication_data[index] + [ + 'id'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'artical_title'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'journal_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'date'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'author'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: + Alignment.center, + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + PublicationsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), + ), + ), // adds spacing between the text and image + + const SizedBox(height: 10), + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Padding( + padding: const EdgeInsets.only( + left: 1.0, right: 1.0), + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons.keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Row( + mainAxisAlignment: + MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Events", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + const SizedBox( + width: 8.0, + ), + Text1( + title: "4", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + ], + ), + children: [ + Scrollbar( + child: SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + // width: + // MediaQuery.of(context) + // .size + // .width, + constraints: + BoxConstraints( + minWidth: MediaQuery.of( + context) + .size + .width, + ), + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + 'sl no', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Event Name', + softWrap: true), + )), + DataColumn( + label: Expanded( + child: Text( + 'Session Type', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Topic', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Role', + softWrap: + true))), + + // Add more columns as needed + ], + rows: List.generate( + event_data.length, + (index) => DataRow( + cells: [ + DataCell(Text( + event_data[index] + ['id'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'event_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'session_type'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'topic'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'role'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: Alignment.center, + child: Padding( + padding: + const EdgeInsets.all( + 8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + EventsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), + ), // adds spacing between the text and image + + SizedBox( + height: 10.0, + ), + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Padding( + padding: const EdgeInsets.only( + left: 1.0, right: 1.0), + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons.keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Row( + mainAxisAlignment: + MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Trials", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + const SizedBox( + width: 8.0, + ), + ], + ), + children: [ + Scrollbar( + child: SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + // width: + // MediaQuery.of(context) + // .size + // .width, + constraints: BoxConstraints( + minWidth: + MediaQuery.of( + context) + .size + .width), + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + '', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Trial Name', + softWrap: true), + )), + + DataColumn( + label: Expanded( + child: Text( + 'Status', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Sponsers', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Condition', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Intervention', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Phase', + softWrap: + true))), + + // Add more columns as needed + ], + rows: List.generate( + trial_data.length, + (index) => DataRow( + cells: [ + DataCell(Text( + trial_data[index] + ['id'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'trial_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'status'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'sponsors'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'condition'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'intervention'] + .toString(), + softWrap: + true)), + DataCell(Text( + trial_data[index] + [ + 'phase'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: Alignment.center, + child: Padding( + padding: + const EdgeInsets.all( + 8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + EventsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), + ), // adds spacing between the text and image + + SizedBox( + height: 10.0, + ), + Flexible( + flex: 1, + child: Padding( + padding: const EdgeInsets.only( + left: 1.0, right: 1.0), + child: Card( + elevation: 5, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons.keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Row( + //mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + onTap: () async { + final provider = Provider + .of( + context, + listen: false); + if (getCount( + provider + .intConfigDataList[ + 0] + .name, + provider) != + 0) { + provider.savedList + .where((element) => + element.form == + provider + .intConfigDataList[ + 0] + .name) + .toList(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext + context) => + SavedFormListScreen( + formname: provider + .intConfigDataList[ + 0] + .name, + ))); + } + }, + child: Text1( + title: + "Interaction Form", + txtcolor: Colors.white, + fontweight: + FontWeight.normal, + txtfont: 17.0), + ), + const SizedBox( + width: 8.0, + ), + // Text1( + // title: widget + // .text![ + // "affiliations_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: + // const Color + // .fromARGB( + // 255, + // 60, + // 82, + // 102), + // ) + ], + ), + children: [ + Container( + height: MediaQuery.of(context) + .size + .height / + 5, + color: Colors.white, + child: Consumer< + ViewInteractionProvider>( + builder: + (BuildContext context, + provider, + Widget? child) { + print( + "P_leangth : ${provider.savedList.length}"); + + if (provider + .savedList.length != + 0) { + return ListView.builder( + shrinkWrap: true, + physics: + NeverScrollableScrollPhysics(), + itemCount: provider + .savedList + .take(2) + .length, + 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({ + 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], + ))); + }, + ), + const Divider(), + ], + ); + }); + } else { + return Container( + color: Colors.white, + width: MediaQuery.of( + context) + .size + .width, + child: Column( + children: [ + Text("No records"), + ], + ), + ); + } + }), + ), + + // SingleChildScrollView( + // scrollDirection: + // Axis.horizontal, + // child: Container( + // width: MediaQuery.of( + // context) + // .size + // .width, + // color: Colors.white, + // child: Text("hiiiiii")), + // ), + Container( + color: Colors.white, + child: Align( + alignment: Alignment.center, + child: Padding( + padding: + const EdgeInsets.all( + 8.0), + child: OutlinedButton( + onPressed: () { + final provider = Provider + .of( + context, + listen: + false); + if (getCount( + provider + .intConfigDataList[ + 0] + .name, + provider) != + 0) { + provider.savedList + .where((element) => + element + .form == + provider + .intConfigDataList[ + 0] + .name) + .toList(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext + context) => + SavedFormListScreen( + formname: provider + .intConfigDataList[0] + .name, + ))); + } + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), + ), + ], + ), + ), + // ) + ) + ], + ), + ), + ) + // : + // 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: [ + // Expanded( + // child: Column( + // children: [ + // Text( + // "Affliations", + // style: TextStyle( + // color: + // Color.fromARGB(255, 0, 71, 137), + // fontSize: 13.0, + // fontWeight: FontWeight.bold, + // ), + // ), + // SizedBox( + // height: 5.0, + // ), + // Text( + // widget.text["affiliations_count"] + // .toString(), + // style: TextStyle( + // fontSize: 13.0, + // color: + // Color.fromARGB(255, 0, 71, 137), + // ), + // ) + // ], + // ), + // ), + // Expanded( + // child: Column( + // children: [ + // Text( + // "Events", + // style: TextStyle( + // color: + // Color.fromARGB(255, 0, 71, 137), + // fontSize: 13.0, + // fontWeight: FontWeight.bold, + // ), + // ), + // SizedBox( + // height: 5.0, + // ), + // Text( + // widget.text["events_count"] + // .toString(), + // style: TextStyle( + // fontSize: 13.0, + // color: + // Color.fromARGB(255, 0, 71, 137), + // ), + // ) + // ], + // ), + // ), + // Expanded( + // child: Column( + // children: [ + // Text( + // "Publications", + // style: TextStyle( + // color: + // Color.fromARGB(255, 0, 71, 137), + // fontSize: 13.0, + // fontWeight: FontWeight.bold, + // ), + // ), + // SizedBox( + // height: 5.0, + // ), + // Text( + // widget.text["publications_count"] + // .toString(), + // style: TextStyle( + // fontSize: 13.0, + // color: + // Color.fromARGB(255, 0, 71, 137), + // ), + // ) + // ], + // ), + // ), + // Expanded( + // child: Column( + // children: [ + // Text( + // "Trails", + // style: TextStyle( + // color: + // Color.fromARGB(255, 0, 71, 137), + // fontSize: 13.0, + // fontWeight: FontWeight.bold, + // ), + // ), + // SizedBox( + // height: 5.0, + // ), + // Text( + // widget.text["publications_count"] + // .toString(), + // style: TextStyle( + // fontSize: 13.0, + // color: + // Color.fromARGB(255, 0, 71, 137), + // ), + // ) + // ], + // ), + // ), + // ], + // ), + // ), + // ) + ], + ), + ], + ), + ], + ), + floatingActionButton: Visibility( + visible: true, + child: FloatingActionButton( + onPressed: () async { + // final ConfigDataProvider configDataProvider = + // ConfigDataProvider(); + + // await configDataProvider.initConfigUIData(); + Navigator.push( + context, MaterialPageRoute(builder: (context) => FormList())); + }, + foregroundColor: Colors.white, + backgroundColor: const Color.fromARGB(255, 0, 71, 132), + child: new Icon(Icons.add), + ), + ), + ), + ); + } + + Future getCount(String form, InteractionProvider provider) async { + await provider.getRecords(); + + return provider.savedList.where((element) => element.form == form).length; + } + + buidCard() { + Text("Hiii"); + } + + showDeleteRecordAlertDialog( + BuildContext context, String record, SaveInteraction saveInteraction) { + // set up the buttons + ViewInteractionProvider provider = + Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: const Text("YES"), + onPressed: () async { + await provider.deleteRecord(saveInteraction).then((value) { + _displaySnackBar("Deleted sucessfully!"); + Navigator.of(context).pop(); + }); + }, + ); + Widget continueButton = TextButton( + child: const Text("NO"), + onPressed: () { + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text("Are you sure you want to delete the record $record ?"), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } +} + + + +// import 'package:discover_module/custom_widget/text.dart'; +// import 'package:discover_module/hive_fun.dart'; +// import 'package:discover_module/provider_class/affiliationsprovider.dart'; +// import 'package:discover_module/provider_class/events_provider.dart'; +// import 'package:discover_module/provider_class/publications_provider.dart'; +// import 'package:discover_module/provider_class/trials_provider.dart'; +// import 'package:discover_module/ui_screen/affiliation_data.dart'; +// import 'package:discover_module/ui_screen/events_data.dart'; +// import 'package:discover_module/ui_screen/interactionform/NewtworkConnectivity.dart'; +// import 'package:discover_module/ui_screen/interactionform/configprovider.dart'; +// import 'package:discover_module/ui_screen/interactionform/edit_interaction_screen.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:discover_module/ui_screen/interactionform/view_interaction_screen.dart'; +// import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart'; +// import 'package:discover_module/ui_screen/newformlist.dart'; +// import 'package:discover_module/ui_screen/publication_data.dart'; +// import 'package:expandable/expandable.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/rendering.dart'; +// import 'package:flutter/widgets.dart'; +// import 'package:flutter_profile_picture/flutter_profile_picture.dart'; +// import 'package:provider/provider.dart'; + +// class NewProfile extends StatefulWidget { +// const NewProfile({Key? key, required this.text}) : super(key: key); +// final Map text; + +// @override +// State createState() => _NewProfileState(); +// } + +// class _NewProfileState extends State { +// bool isonline = false; +// List affiliation_data = []; +// List publication_data = []; +// List event_data = []; +// List trial_data = []; + +// List viewformData = []; + +// bool _isExpanded = false; +// // final ScrollController controller = ScrollController(); + +// // final ScrollController controller2 = ScrollController(); + +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// print("pooja123"); + +// getaffiliations(); + +// getuserdetails(); +// print("Widget_isssIndex_iss ${widget.text}"); +// print( +// "Widget_isssIndex_iss ${widget.text!["id"]},${widget.text!["name"]},${widget.text!["img_path"]}"); +// } + +// getaffiliations() async { +// var affiliations = +// Provider.of(context, listen: false); + +// await affiliations.getAffiliationsdata(); +// final affilist = affiliations.adddta; + +// var publication = Provider.of(context, listen: false); + +// await publication.publicatininfo(); +// final publist = publication.publicationlist; + +// var events = Provider.of(context, listen: false); +// await events.geteventdata(); +// final eventlist = events.EventsList; + +// var form = Provider.of(context, listen: false); +// // form.savedList; + +// var trials = Provider.of(context, listen: false); +// await trials.trialsdata(); + +// final trialslist = trials.trialsinfo; + +// setState(() { +// affiliation_data = affilist; +// publication_data = publist; +// event_data = eventlist; +// viewformData = form.savedList; +// trial_data = trialslist; +// }); + +// print("Affiliations_data_is: $affilist"); +// print("trialslist_data_is: $trialslist"); +// } + +// getuserdetails() async { +// // HiveFunctions.getindexUser(widget.text); + +// NetworkConnectivity networkConnectivity = NetworkConnectivity(); +// bool isonline1 = await networkConnectivity.isInternetAvailable(); + +// setState(() { +// print("Profile_isOnline: $isonline1"); +// isonline = isonline1; +// }); +// } + +// @override +// Widget build(BuildContext context) { +// return SafeArea( +// child: Scaffold( +// //backgroundColor: Color.fromARGB(255, 200, 222, 241), +// backgroundColor: Color.fromARGB(255, 237, 230, 230), +// appBar: AppBar( +// //backgroundColor: Colors.transparent, +// title: const Text('Profile'), +// ), +// body: ListView( +// children: [ +// Column( +// crossAxisAlignment: CrossAxisAlignment.center, +// mainAxisAlignment: MainAxisAlignment.center, +// mainAxisSize: MainAxisSize.min, +// children: [ +// // Padding( +// // padding: EdgeInsets.all(8.0), +// // child: ProfilePicture( +// // name: widget.text!["name"], +// // radius: 38, +// // fontsize: 21, +// // ), +// // ), +// Padding( +// padding: EdgeInsets.all(8.0), +// child: widget.text!["img_path"] == null +// ? ProfilePicture( +// name: widget.text!["name"], +// radius: 38, +// fontsize: 21, +// ) +// : ClipOval( +// child: SizedBox.fromSize( +// size: Size.fromRadius(48), // Image radius +// child: Image.network(widget.text!["img_path"], +// fit: BoxFit.cover), +// ), +// )), +// Column( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// // Text( +// // "Gerosa, Gino", +// // style: TextStyle( +// // fontSize: 22.0, +// // color: Colors.black, +// // ), +// // ), +// Text1( +// title: "Dr " + widget.text!["name"], +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 22.0), +// // Text( +// // "Cardiac Surgery", +// // style: TextStyle( +// // fontWeight: FontWeight.bold, fontSize: 14.0), +// // ), +// Text1( +// title: widget.text!["speciality"], +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ], +// ), +// SizedBox( +// height: 15.0, +// ), +// Column( +// mainAxisAlignment: MainAxisAlignment.center, +// crossAxisAlignment: CrossAxisAlignment.center, +// children: [ +// Padding( +// padding: const EdgeInsets.only(left: 15.0), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.center, +// 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: widget.text!["addr"] ?? +// "Azienda Ospedaliera di Padova", +// txtcolor: Colors.black, +// txtfont: 15.0, +// fontweight: FontWeight.normal, +// )), +// ]), +// ), +// const SizedBox( +// height: 8.0, +// ), +// Padding( +// padding: const EdgeInsets.only(left: 15.0), +// child: Row(children: [ +// const Icon( +// Icons.location_pin, +// color: Color.fromARGB(255, 0, 71, 132), +// ), +// const SizedBox( +// width: 3.0, +// ), +// Expanded( +// // child: Text( +// // "Via Giustiniani, 2, Padova, Veneto 35128, Italy", +// // style: TextStyle( +// // fontWeight: FontWeight.bold, fontSize: 14.0), +// // ), +// child: Text1( +// title: widget.text!["adrr"] ?? +// "Via Giustiniani, 2, Padova, Veneto 35128, Italy", +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ), +// ]), +// ), +// const SizedBox( +// height: 8.0, +// ), +// Padding( +// padding: const EdgeInsets.only(left: 15.0), +// child: 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: widget.text!["phone_no"].toString(), +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ]), +// ), +// const SizedBox( +// height: 8.0, +// ), +// Padding( +// padding: const EdgeInsets.only(left: 15.0), +// child: Row(children: [ +// const Icon( +// Icons.call, +// color: Color.fromARGB(255, 0, 71, 132), +// ), +// const SizedBox( +// width: 3.0, +// ), +// Text1( +// title: widget.text!["phone_no"].toString(), +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ]), +// ), +// const SizedBox( +// height: 8.0, +// ), +// Padding( +// padding: const EdgeInsets.only(left: 15.0), +// child: Row(children: [ +// const Icon( +// Icons.email, +// color: Color.fromARGB(255, 0, 71, 132), +// ), +// const SizedBox( +// width: 3.0, +// ), +// Text1( +// title: widget.text!["email"], +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ]), +// ), +// const SizedBox( +// height: 8.0, +// ), +// // isonline +// // ? +// Container( +// width: MediaQuery.of(context).size.width, +// child: Card( +// elevation: 4, +// clipBehavior: Clip.antiAliasWithSaveLayer, +// surfaceTintColor: Colors.white, +// // shape: RoundedRectangleBorder( +// // borderRadius: +// // BorderRadius.circular(0.0), +// // ), +// shape: RoundedRectangleBorder( +// borderRadius: BorderRadius.circular(30.0)), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// // const Text( +// // "Profile Summarry", +// // style: TextStyle( +// // fontSize: 20.0, fontWeight: FontWeight.bold), +// // ), +// Padding( +// padding: const EdgeInsets.all(12.0), +// child: Text1( +// title: "Profile Summarry", +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 18.0), +// ), + +// Padding( +// padding: const EdgeInsets.all(12.0), +// child: Text1( +// title: widget.text!["summarry"], +// txtcolor: Colors.black, +// fontweight: FontWeight.normal, +// txtfont: 15.0), +// ), +// Padding( +// padding: EdgeInsets.all(0.0), + +// child: Padding( +// padding: const EdgeInsets.all(0), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// mainAxisSize: MainAxisSize.min, +// children: [ +// // const SizedBox(height: 10), +// // Flexible( +// // flex: 1, +// // child: Padding( +// // padding: const EdgeInsets.only( +// // left: 1.0, right: 1.0), +// // child: Card( +// // elevation: 5, +// // shape: RoundedRectangleBorder( +// // borderRadius: +// // BorderRadius.circular(0.0), +// // ), +// // color: const Color.fromARGB( +// // 255, 0, 71, 137), +// // child: ExpansionTile( +// // maintainState: true, +// // // onExpansionChanged: +// // // (bool expanded) { +// // // setState(() { +// // // _isExpanded = expanded; +// // // }); +// // // }, +// // backgroundColor: +// // const Color.fromARGB( +// // 255, 0, 71, 137), +// // collapsedIconColor: Colors.white, +// // // trailing: Icon( +// // // _isExpanded +// // // ? Icons.keyboard_arrow_up +// // // : Icons +// // // .keyboard_arrow_down, +// // // color: Colors.white), +// // // collapsedBackgroundColor: Color(0xFF2b9af3), +// // initiallyExpanded: true, +// // title: Row( +// // //mainAxisSize: MainAxisSize.min, +// // children: [ +// // Text1( +// // title: "Affiliations", +// // txtcolor: Colors.white, +// // fontweight: +// // FontWeight.normal, +// // txtfont: 17.0), +// // const SizedBox( +// // width: 8.0, +// // ), +// // // Text1( +// // // title: widget +// // // .text![ +// // // "affiliations_count"] +// // // .toString(), +// // // txtfont: 18.0, +// // // txtcolor: +// // // const Color +// // // .fromARGB( +// // // 255, +// // // 60, +// // // 82, +// // // 102), +// // // ) +// // ], +// // ), +// // children: [ +// // SingleChildScrollView( +// // scrollDirection: +// // Axis.horizontal, +// // child: Container( +// // width: +// // MediaQuery.of(context) +// // .size +// // .width, +// // color: Colors.white, +// // child: DataTable( +// // columns: const [ +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'sl no'))), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Organization Name'), +// // )), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Department'))), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Role'))), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Time Frame'))), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Org Type'))), +// // DataColumn( +// // label: Expanded( +// // child: Text( +// // 'Eng Type'))), +// // // Add more columns as needed +// // ], +// // rows: List.generate( +// // affiliation_data.length, +// // (index) => DataRow( +// // cells: [ +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // ['id'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // [ +// // 'org_name'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // ['dept'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // ['role'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // [ +// // 'time_frame'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // [ +// // 'org_type'] +// // .toString())), +// // DataCell(Text( +// // affiliation_data[ +// // index] +// // [ +// // 'emg_type'] +// // .toString())), +// // // Add more DataCells as needed +// // ], +// // ), +// // ), +// // ), +// // ), +// // ), +// // Container( +// // color: Colors.white, +// // child: Align( +// // alignment: Alignment.center, +// // child: Padding( +// // padding: +// // const EdgeInsets.all( +// // 8.0), +// // child: OutlinedButton( +// // onPressed: () { +// // Navigator.push( +// // context, +// // MaterialPageRoute( +// // builder: (_) => +// // AffiliationsData())); +// // }, +// // child: +// // Text('Show More'), +// // style: OutlinedButton +// // .styleFrom( +// // shape: +// // RoundedRectangleBorder( +// // borderRadius: +// // BorderRadius +// // .circular( +// // 12), +// // ), +// // ), +// // ), +// // ), +// // ), +// // ) +// // ]), +// // ), +// // ), +// // ), + +// Flexible( +// flex: 1, +// // height: +// // 200, // Set a fixed height or use constraints as needed + +// child: Padding( +// padding: const EdgeInsets.only( +// left: 1.0, right: 1.0), +// child: Card( +// elevation: 5, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(0.0), +// ), +// color: const Color.fromARGB( +// 255, 0, 71, 137), +// child: ExpansionTile( +// maintainState: true, +// onExpansionChanged: +// (bool expanded) { +// setState(() { +// _isExpanded = expanded; +// }); +// }, +// backgroundColor: +// const Color.fromARGB( +// 255, 0, 71, 137), +// trailing: Icon( +// _isExpanded +// ? Icons.keyboard_arrow_up +// : Icons +// .keyboard_arrow_down, +// color: Colors.white), +// // backgroundColor: Colors.white, +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// initiallyExpanded: true, +// title: Row( +// mainAxisAlignment: +// MainAxisAlignment.start, +// // mainAxisSize: MainAxisSize.min, +// children: [ +// Text1( +// title: "Affiliations", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// const SizedBox( +// width: 8.0, +// ), +// Text1( +// title: "4", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// ], +// ), +// children: [ +// Scrollbar( +// child: SingleChildScrollView( +// scrollDirection: +// Axis.horizontal, +// child: Container( +// // width: +// // MediaQuery.of(context) +// // .size +// // .width, +// constraints: BoxConstraints( +// minWidth: +// MediaQuery.of( +// context) +// .size +// .width), +// color: Colors.white, +// child: DataTable( +// columns: const [ +// DataColumn( +// label: Expanded( +// child: Text( +// '', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Organization Name'), +// )), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Department'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Role'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Time Frame'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Org Type'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Eng Type'))), + +// // Add more columns as needed +// ], +// rows: List.generate( +// affiliation_data +// .length, +// (index) => DataRow( +// cells: [ +// DataCell(Text( +// affiliation_data[ +// index] +// ['id'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'org_name'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'dept'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'role'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'time_frame'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'org_type'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// affiliation_data[ +// index] +// [ +// 'emg_type'] +// .toString(), +// softWrap: +// true)), + +// // Add more DataCells as needed +// ], +// ), +// ), +// ), +// ), +// ), +// ), +// Container( +// color: Colors.white, +// child: Align( +// alignment: Alignment.center, +// child: Padding( +// padding: +// const EdgeInsets.all( +// 8.0), +// child: OutlinedButton( +// onPressed: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (_) => +// AffiliationsData())); +// }, +// child: +// Text('Show More'), +// style: OutlinedButton +// .styleFrom( +// shape: +// RoundedRectangleBorder( +// borderRadius: +// BorderRadius +// .circular( +// 12), +// ), +// ), +// ), +// ), +// ), +// ) +// ]), +// ), +// ), +// ), // adds spacing between the text and image + +// SizedBox( +// height: 10.0, +// ), + +// Flexible( +// flex: 1, +// // height: +// // 200, // Set a fixed height or use constraints as needed + +// child: Padding( +// padding: const EdgeInsets.only( +// left: 1.0, right: 1.0), +// child: Container( +// child: Card( +// elevation: 5, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(0.0), +// ), +// color: const Color.fromARGB( +// 255, 0, 71, 137), +// child: ExpansionTile( +// maintainState: true, +// // backgroundColor: Colors.white, +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// onExpansionChanged: +// (bool expanded) { +// setState(() { +// _isExpanded = expanded; +// }); +// }, +// backgroundColor: +// const Color.fromARGB( +// 255, 0, 71, 137), +// trailing: Icon( +// _isExpanded +// ? Icons +// .keyboard_arrow_up +// : Icons +// .keyboard_arrow_down, +// color: Colors.white), +// initiallyExpanded: true, +// title: Row( +// mainAxisAlignment: +// MainAxisAlignment.start, +// // mainAxisSize: MainAxisSize.min, +// children: [ +// Text1( +// title: "Publications", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// const SizedBox( +// width: 8.0, +// ), +// Text1( +// title: "3", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// // Text1( +// // title: widget +// // .text![ +// // "publications_count"] +// // .toString(), +// // txtfont: 18.0, +// // txtcolor: Color +// // .fromARGB( +// // 255, +// // 0, +// // 71, +// // 137), +// // ) +// ], +// ), +// children: [ +// Scrollbar( +// //isAlwaysShown: true, +// child: +// SingleChildScrollView( +// scrollDirection: +// Axis.horizontal, +// child: Container( +// // width: MediaQuery.of( +// // context) +// // .size +// // .width, +// constraints: BoxConstraints( +// minWidth: +// MediaQuery.of( +// context) +// .size +// .width), + +// color: Colors.white, +// child: DataTable( +// columns: const [ +// DataColumn( +// label: Expanded( +// child: Text( +// 'sl no'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Artical Title', +// softWrap: +// true), +// )), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Journal Name', +// softWrap: true, +// ))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Date'))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Authors'))), + +// // Add more columns as needed +// ], +// rows: List.generate( +// publication_data +// .length, +// (index) => DataRow( +// cells: [ +// DataCell(Text( +// publication_data[index] +// [ +// 'id'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// publication_data[index] +// [ +// 'artical_title'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// publication_data[index] +// [ +// 'journal_name'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// publication_data[index] +// [ +// 'date'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// publication_data[index] +// [ +// 'author'] +// .toString(), +// softWrap: +// true)), + +// // Add more DataCells as needed +// ], +// ), +// ), +// ), +// ), +// ), +// ), +// Container( +// color: Colors.white, +// child: Align( +// alignment: +// Alignment.center, +// child: Padding( +// padding: +// const EdgeInsets +// .all(8.0), +// child: OutlinedButton( +// onPressed: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (_) => +// PublicationsData())); +// }, +// child: +// Text('Show More'), +// style: OutlinedButton +// .styleFrom( +// shape: +// RoundedRectangleBorder( +// borderRadius: +// BorderRadius +// .circular( +// 12), +// ), +// ), +// ), +// ), +// ), +// ) +// ]), +// ), +// ), +// ), +// ), // adds spacing between the text and image + +// const SizedBox(height: 10), + +// Flexible( +// flex: 1, +// // height: +// // 200, // Set a fixed height or use constraints as needed + +// child: Padding( +// padding: const EdgeInsets.only( +// left: 1.0, right: 1.0), +// child: Card( +// elevation: 5, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(0.0), +// ), +// color: const Color.fromARGB( +// 255, 0, 71, 137), +// child: ExpansionTile( +// maintainState: true, +// onExpansionChanged: +// (bool expanded) { +// setState(() { +// _isExpanded = expanded; +// }); +// }, +// backgroundColor: +// const Color.fromARGB( +// 255, 0, 71, 137), +// trailing: Icon( +// _isExpanded +// ? Icons.keyboard_arrow_up +// : Icons +// .keyboard_arrow_down, +// color: Colors.white), +// // backgroundColor: Colors.white, +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// initiallyExpanded: true, +// title: Row( +// mainAxisAlignment: +// MainAxisAlignment.start, +// // mainAxisSize: MainAxisSize.min, +// children: [ +// Text1( +// title: "Events", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// const SizedBox( +// width: 8.0, +// ), +// Text1( +// title: "4", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// ], +// ), +// children: [ +// Scrollbar( +// child: SingleChildScrollView( +// scrollDirection: +// Axis.horizontal, +// child: Container( +// // width: +// // MediaQuery.of(context) +// // .size +// // .width, +// constraints: +// BoxConstraints( +// minWidth: MediaQuery.of( +// context) +// .size +// .width, +// ), +// color: Colors.white, +// child: DataTable( +// columns: const [ +// DataColumn( +// label: Expanded( +// child: Text( +// 'sl no', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Event Name', +// softWrap: true), +// )), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Session Type', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Topic', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Role', +// softWrap: +// true))), + +// // Add more columns as needed +// ], +// rows: List.generate( +// event_data.length, +// (index) => DataRow( +// cells: [ +// DataCell(Text( +// event_data[index] +// ['id'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// event_data[index] +// [ +// 'event_name'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// event_data[index] +// [ +// 'session_type'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// event_data[index] +// [ +// 'topic'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// event_data[index] +// [ +// 'role'] +// .toString(), +// softWrap: +// true)), + +// // Add more DataCells as needed +// ], +// ), +// ), +// ), +// ), +// ), +// ), +// Container( +// color: Colors.white, +// child: Align( +// alignment: Alignment.center, +// child: Padding( +// padding: +// const EdgeInsets.all( +// 8.0), +// child: OutlinedButton( +// onPressed: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (_) => +// EventsData())); +// }, +// child: +// Text('Show More'), +// style: OutlinedButton +// .styleFrom( +// shape: +// RoundedRectangleBorder( +// borderRadius: +// BorderRadius +// .circular( +// 12), +// ), +// ), +// ), +// ), +// ), +// ) +// ]), +// ), +// ), +// ), // adds spacing between the text and image + +// SizedBox( +// height: 10.0, +// ), + +// Flexible( +// flex: 1, +// // height: +// // 200, // Set a fixed height or use constraints as needed + +// child: Padding( +// padding: const EdgeInsets.only( +// left: 1.0, right: 1.0), +// child: Card( +// elevation: 5, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(0.0), +// ), +// color: const Color.fromARGB( +// 255, 0, 71, 137), +// child: ExpansionTile( +// maintainState: true, +// onExpansionChanged: +// (bool expanded) { +// setState(() { +// _isExpanded = expanded; +// }); +// }, +// backgroundColor: +// const Color.fromARGB( +// 255, 0, 71, 137), +// trailing: Icon( +// _isExpanded +// ? Icons.keyboard_arrow_up +// : Icons +// .keyboard_arrow_down, +// color: Colors.white), +// // backgroundColor: Colors.white, +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// initiallyExpanded: true, +// title: Row( +// mainAxisAlignment: +// MainAxisAlignment.start, +// // mainAxisSize: MainAxisSize.min, +// children: [ +// Text1( +// title: "Trials", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// const SizedBox( +// width: 8.0, +// ), +// ], +// ), +// children: [ +// Scrollbar( +// child: SingleChildScrollView( +// scrollDirection: +// Axis.horizontal, +// child: Container( +// // width: +// // MediaQuery.of(context) +// // .size +// // .width, +// constraints: BoxConstraints( +// minWidth: +// MediaQuery.of( +// context) +// .size +// .width), +// color: Colors.white, +// child: DataTable( +// columns: const [ +// DataColumn( +// label: Expanded( +// child: Text( +// '', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Trial Name', +// softWrap: true), +// )), + +// DataColumn( +// label: Expanded( +// child: Text( +// 'Status', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Sponsers', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Condition', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Intervention', +// softWrap: +// true))), +// DataColumn( +// label: Expanded( +// child: Text( +// 'Phase', +// softWrap: +// true))), + +// // Add more columns as needed +// ], +// rows: List.generate( +// trial_data.length, +// (index) => DataRow( +// cells: [ +// DataCell(Text( +// trial_data[index] +// ['id'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'trial_name'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'status'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'sponsors'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'condition'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'intervention'] +// .toString(), +// softWrap: +// true)), +// DataCell(Text( +// trial_data[index] +// [ +// 'phase'] +// .toString(), +// softWrap: +// true)), + +// // Add more DataCells as needed +// ], +// ), +// ), +// ), +// ), +// ), +// ), +// Container( +// color: Colors.white, +// child: Align( +// alignment: Alignment.center, +// child: Padding( +// padding: +// const EdgeInsets.all( +// 8.0), +// child: OutlinedButton( +// onPressed: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (_) => +// EventsData())); +// }, +// child: +// Text('Show More'), +// style: OutlinedButton +// .styleFrom( +// shape: +// RoundedRectangleBorder( +// borderRadius: +// BorderRadius +// .circular( +// 12), +// ), +// ), +// ), +// ), +// ), +// ) +// ]), +// ), +// ), +// ), // adds spacing between the text and image + +// SizedBox( +// height: 10.0, +// ), +// Flexible( +// flex: 1, +// child: Padding( +// padding: const EdgeInsets.only( +// left: 1.0, right: 1.0), +// child: Card( +// elevation: 5, +// shape: RoundedRectangleBorder( +// borderRadius: +// BorderRadius.circular(0.0), +// ), +// color: const Color.fromARGB( +// 255, 0, 71, 137), +// child: ExpansionTile( +// maintainState: true, +// onExpansionChanged: +// (bool expanded) { +// setState(() { +// _isExpanded = expanded; +// }); +// }, +// backgroundColor: +// const Color.fromARGB( +// 255, 0, 71, 137), +// trailing: Icon( +// _isExpanded +// ? Icons.keyboard_arrow_up +// : Icons +// .keyboard_arrow_down, +// color: Colors.white), +// // collapsedBackgroundColor: Color(0xFF2b9af3), +// initiallyExpanded: true, +// title: Row( +// //mainAxisSize: MainAxisSize.min, +// children: [ +// GestureDetector( +// onTap: () async { +// final provider = Provider +// .of( +// context, +// listen: false); +// if (getCount( +// provider +// .intConfigDataList[ +// 0] +// .name, +// provider) != +// 0) { +// provider.savedList +// .where((element) => +// element.form == +// provider +// .intConfigDataList[ +// 0] +// .name) +// .toList(); +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (BuildContext +// context) => +// SavedFormListScreen( +// formname: provider +// .intConfigDataList[ +// 0] +// .name, +// ))); +// } +// }, +// child: Text1( +// title: +// "Interaction Form", +// txtcolor: Colors.white, +// fontweight: +// FontWeight.normal, +// txtfont: 17.0), +// ), +// const SizedBox( +// width: 8.0, +// ), +// // Text1( +// // title: widget +// // .text![ +// // "affiliations_count"] +// // .toString(), +// // txtfont: 18.0, +// // txtcolor: +// // const Color +// // .fromARGB( +// // 255, +// // 60, +// // 82, +// // 102), +// // ) +// ], +// ), +// children: [ +// Container( +// height: MediaQuery.of(context) +// .size +// .height / +// 5, +// color: Colors.white, +// child: Consumer< +// ViewInteractionProvider>( +// builder: +// (BuildContext context, +// provider, +// Widget? child) { +// print( +// "P_leangth : ${provider.savedList.length}"); +// return ListView.builder( +// shrinkWrap: true, +// physics: +// NeverScrollableScrollPhysics(), +// itemCount: provider +// .savedList +// .take(2) +// .length, +// 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({ +// 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], +// ))); +// }, +// ), +// const Divider(), +// ], +// ); +// }); +// }), +// ), + +// // SingleChildScrollView( +// // scrollDirection: +// // Axis.horizontal, +// // child: Container( +// // width: MediaQuery.of( +// // context) +// // .size +// // .width, +// // color: Colors.white, +// // child: Text("hiiiiii")), +// // ), +// Container( +// color: Colors.white, +// child: Align( +// alignment: Alignment.center, +// child: Padding( +// padding: +// const EdgeInsets.all( +// 8.0), +// child: OutlinedButton( +// onPressed: () { +// final provider = Provider +// .of( +// context, +// listen: +// false); +// if (getCount( +// provider +// .intConfigDataList[ +// 0] +// .name, +// provider) != +// 0) { +// provider.savedList +// .where((element) => +// element +// .form == +// provider +// .intConfigDataList[ +// 0] +// .name) +// .toList(); +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (BuildContext +// context) => +// SavedFormListScreen( +// formname: provider +// .intConfigDataList[0] +// .name, +// ))); +// } +// }, +// child: +// Text('Show More'), +// style: OutlinedButton +// .styleFrom( +// shape: +// RoundedRectangleBorder( +// borderRadius: +// BorderRadius +// .circular( +// 12), +// ), +// ), +// ), +// ), +// ), +// ) +// ]), +// ), +// ), +// ), +// ], +// ), +// ), +// // ) +// ) +// ], +// ), +// ), +// ) +// // : +// // 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: [ +// // Expanded( +// // child: Column( +// // children: [ +// // Text( +// // "Affliations", +// // style: TextStyle( +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // fontSize: 13.0, +// // fontWeight: FontWeight.bold, +// // ), +// // ), +// // SizedBox( +// // height: 5.0, +// // ), +// // Text( +// // widget.text["affiliations_count"] +// // .toString(), +// // style: TextStyle( +// // fontSize: 13.0, +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // ), +// // ) +// // ], +// // ), +// // ), +// // Expanded( +// // child: Column( +// // children: [ +// // Text( +// // "Events", +// // style: TextStyle( +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // fontSize: 13.0, +// // fontWeight: FontWeight.bold, +// // ), +// // ), +// // SizedBox( +// // height: 5.0, +// // ), +// // Text( +// // widget.text["events_count"] +// // .toString(), +// // style: TextStyle( +// // fontSize: 13.0, +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // ), +// // ) +// // ], +// // ), +// // ), +// // Expanded( +// // child: Column( +// // children: [ +// // Text( +// // "Publications", +// // style: TextStyle( +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // fontSize: 13.0, +// // fontWeight: FontWeight.bold, +// // ), +// // ), +// // SizedBox( +// // height: 5.0, +// // ), +// // Text( +// // widget.text["publications_count"] +// // .toString(), +// // style: TextStyle( +// // fontSize: 13.0, +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // ), +// // ) +// // ], +// // ), +// // ), +// // Expanded( +// // child: Column( +// // children: [ +// // Text( +// // "Trails", +// // style: TextStyle( +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // fontSize: 13.0, +// // fontWeight: FontWeight.bold, +// // ), +// // ), +// // SizedBox( +// // height: 5.0, +// // ), +// // Text( +// // widget.text["publications_count"] +// // .toString(), +// // style: TextStyle( +// // fontSize: 13.0, +// // color: +// // Color.fromARGB(255, 0, 71, 137), +// // ), +// // ) +// // ], +// // ), +// // ), +// // ], +// // ), +// // ), +// // ) +// ], +// ), +// ], +// ), +// ], +// ), +// floatingActionButton: Visibility( +// visible: true, +// child: FloatingActionButton( +// onPressed: () async { +// // final ConfigDataProvider configDataProvider = +// // ConfigDataProvider(); + +// // await configDataProvider.initConfigUIData(); +// Navigator.push( +// context, MaterialPageRoute(builder: (context) => FormList())); +// }, +// foregroundColor: Colors.white, +// backgroundColor: const Color.fromARGB(255, 0, 71, 132), +// child: new Icon(Icons.add), +// ), +// ), +// ), +// ); +// } + +// Future getCount(String form, InteractionProvider provider) async { +// await provider.getRecords(); + +// return provider.savedList.where((element) => element.form == form).length; +// } + +// buidCard() { +// Text("Hiii"); +// } + +// showDeleteRecordAlertDialog( +// BuildContext context, String record, SaveInteraction saveInteraction) { +// // set up the buttons +// ViewInteractionProvider provider = +// Provider.of(context, listen: false); +// Widget cancelButton = TextButton( +// child: const Text("YES"), +// onPressed: () async { +// await provider.deleteRecord(saveInteraction).then((value) { +// _displaySnackBar("Deleted sucessfully!"); +// Navigator.of(context).pop(); +// }); +// }, +// ); +// Widget continueButton = TextButton( +// child: const Text("NO"), +// onPressed: () { +// Navigator.of(context).pop(); +// }, +// ); + +// // set up the AlertDialog +// AlertDialog alert = AlertDialog( +// title: const Text(""), +// content: Text("Are you sure you want to delete the record $record ?"), +// actions: [ +// cancelButton, +// continueButton, +// ], +// ); + +// // show the dialog +// showDialog( +// context: context, +// builder: (BuildContext context) { +// return alert; +// }, +// ); +// } + +// _displaySnackBar(String msg) { +// final snackBar = SnackBar( +// content: Text( +// msg, +// style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), +// )); +// ScaffoldMessenger.of(context).showSnackBar(snackBar); +// //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); +// } +// } diff --git a/lib/ui_screen/newformlist.dart b/lib/ui_screen/newformlist.dart index 5ecd8f1..08d2906 100644 --- a/lib/ui_screen/newformlist.dart +++ b/lib/ui_screen/newformlist.dart @@ -1,8 +1,296 @@ +// 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 createState() => _FormListState(); +// } + +// class _FormListState extends State { +// List savedList = []; +// @override +// void initState() { +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { +// // if (!mytimer!.isActive) { +// // activateTimer(); +// // } +// print("interactionListt"); +// init(); +// }); + +// super.initState(); +// } + +// init() async { +// print("init"); + +// await Provider.of(context, listen: false) +// .initConfigData(); + +// await Provider.of(context, listen: false).getRecords(); +// setState(() {}); +// } + +// Future 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( +// 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}); @@ -12,6 +300,23 @@ class FormList extends StatefulWidget { } class _FormListState extends State { + var formdata; + @override + void initState() { + // TODO: implement initState + super.initState(); + + idata(); + } + + idata() { + var iprovider = Provider.of(context, listen: false); + + setState(() { + formdata = iprovider.intConfigDataList; + }); + } + @override Widget build(BuildContext context) { return SafeArea( @@ -41,6 +346,26 @@ class _FormListState extends State { 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", @@ -48,6 +373,7 @@ class _FormListState extends State { ), onTap: () async { print("I am Interaction"); + final ConfigDataProvider configDataProvider = ConfigDataProvider(); diff --git a/lib/ui_screen/profile.dart b/lib/ui_screen/profile.dart index 81a4b31..f249b27 100644 --- a/lib/ui_screen/profile.dart +++ b/lib/ui_screen/profile.dart @@ -1484,13 +1484,24 @@ //////////////////////////////////////////////////////////////////////////////////////////// import 'package:discover_module/custom_widget/text.dart'; import 'package:discover_module/hive_fun.dart'; +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:discover_module/provider_class/events_provider.dart'; +import 'package:discover_module/provider_class/publications_provider.dart'; +import 'package:discover_module/ui_screen/affiliation_data.dart'; +import 'package:discover_module/ui_screen/events_data.dart'; import 'package:discover_module/ui_screen/interactionform/NewtworkConnectivity.dart'; import 'package:discover_module/ui_screen/interactionform/configprovider.dart'; +import 'package:discover_module/ui_screen/interactionform/edit_interaction_screen.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:discover_module/ui_screen/interactionform/view_interaction_screen.dart'; +import 'package:discover_module/ui_screen/interactionform/viewinteractionprovider.dart'; import 'package:discover_module/ui_screen/newformlist.dart'; +import 'package:discover_module/ui_screen/publication_data.dart'; +import 'package:expandable/expandable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -1508,6 +1519,13 @@ class Profile extends StatefulWidget { class _ProfileState extends State { bool isonline = false; + List affiliation_data = []; + List publication_data = []; + List event_data = []; + + List viewformData = []; + + bool _isExpanded = false; @override void initState() { @@ -1515,11 +1533,42 @@ class _ProfileState extends State { super.initState(); print("pooja123"); + getaffiliations(); + getuserdetails(); print("Widget_isssIndex_iss ${widget.text}"); print("Widget_isssIndex_iss ${widget.text!["id"]},${widget.text!["name"]}"); } + getaffiliations() async { + var affiliations = + Provider.of(context, listen: false); + + await affiliations.getAffiliationsdata(); + final affilist = affiliations.adddta; + + var publication = Provider.of(context, listen: false); + + await publication.publicatininfo(); + final publist = publication.publicationlist; + + var events = Provider.of(context, listen: false); + await events.geteventdata(); + final eventlist = events.EventsList; + + var form = Provider.of(context, listen: false); + // form.savedList; + + setState(() { + affiliation_data = affilist; + publication_data = publist; + event_data = eventlist; + viewformData = form.savedList; + }); + + print("Affiliations_data_is: $affilist"); + } + getuserdetails() async { // HiveFunctions.getindexUser(widget.text); @@ -1748,7 +1797,7 @@ class _ProfileState extends State { txtcolor: Colors.black, fontweight: FontWeight.bold, txtfont: 20.0), - SizedBox( + const SizedBox( height: 15.0, ), // Text( @@ -1765,16 +1814,7 @@ class _ProfileState extends State { txtfont: 16.0), Padding( padding: EdgeInsets.all(0.0), - //child: Card( - // surfaceTintColor: Colors.white, - // clipBehavior: Clip.antiAlias, - // color: Colors.white, - // elevation: 5, // adds a shadow effect - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular( - // 15.0), // adds rounded corners - // ), child: Padding( padding: const EdgeInsets.all(0), child: Column( @@ -1782,133 +1822,643 @@ class _ProfileState extends State { CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Card( - surfaceTintColor: Colors.white, - clipBehavior: Clip.antiAlias, - color: Colors.white, - elevation: 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 15.0), // adds rounded corners - ), - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Row( - //mainAxisSize: MainAxisSize.min, - children: [ - Text1( - title: "Affiliations", - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - fontweight: FontWeight.bold, - txtfont: 20.0), - const SizedBox( - height: 15.0, - ), - Text1( - title: widget.text![ - "affiliations_count"] - .toString(), - txtfont: 18.0, - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - ) - ], - ), - ), - ), - const SizedBox( - height: - 10), // adds spacing between the text and image - Card( - surfaceTintColor: Colors.white, - clipBehavior: Clip.antiAlias, - color: Colors.white, - elevation: 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 15.0), // adds rounded corners - ), - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - // mainAxisSize: MainAxisSize.min, - children: [ - Text1( - title: "Events", - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - fontweight: FontWeight.bold, - txtfont: 20.0), - const SizedBox( - height: 15.0, - ), - Text1( - title: widget - .text!["events_count"] - .toString(), - txtfont: 18.0, - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - ) - ], - ), - ), - ), - const SizedBox( - height: - 10), // adds spacing between the image and button - Card( - surfaceTintColor: Colors.white, - clipBehavior: Clip.antiAlias, - color: Colors.white, - elevation: 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 15.0), // adds rounded corners - ), - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - // mainAxisSize: MainAxisSize.min, - children: [ - Text1( - title: "Publications", - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - fontweight: FontWeight.bold, - txtfont: 20.0), - const SizedBox( - height: 15.0, - ), - Text1( - title: widget.text![ - "publications_count"] - .toString(), - txtfont: 18.0, - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - ) - ], + // const SizedBox(height: 10), + Flexible( + flex: 1, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons + .keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Padding( + padding: + const EdgeInsets.all(8.0), + child: Row( + //mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Affiliations", + txtcolor: + Colors.white, + fontweight: + FontWeight.normal, + txtfont: 20.0), + const SizedBox( + width: 8.0, + ), + // Text1( + // title: widget + // .text![ + // "affiliations_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: + // const Color + // .fromARGB( + // 255, + // 60, + // 82, + // 102), + // ) + ], + ), + ), + children: [ + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + width: + MediaQuery.of(context) + .size + .width, + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + 'sl no'))), + DataColumn( + label: Expanded( + child: Text( + 'Organization Name'), + )), + DataColumn( + label: Expanded( + child: Text( + 'Department'))), + DataColumn( + label: Expanded( + child: Text( + 'Role'))), + DataColumn( + label: Expanded( + child: Text( + 'Time Frame'))), + DataColumn( + label: Expanded( + child: Text( + 'Org Type'))), + DataColumn( + label: Expanded( + child: Text( + 'Eng Type'))), + // Add more columns as needed + ], + rows: List.generate( + affiliation_data + .length, + (index) => DataRow( + cells: [ + DataCell(Text( + affiliation_data[ + index] + ['id'] + .toString())), + DataCell(Text(affiliation_data[ + index] + [ + 'org_name'] + .toString())), + DataCell(Text( + affiliation_data[ + index] + [ + 'dept'] + .toString())), + DataCell(Text( + affiliation_data[ + index] + [ + 'role'] + .toString())), + DataCell(Text(affiliation_data[ + index] + [ + 'time_frame'] + .toString())), + DataCell(Text(affiliation_data[ + index] + [ + 'org_type'] + .toString())), + DataCell(Text(affiliation_data[ + index] + [ + 'emg_type'] + .toString())), + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: + Alignment.center, + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + AffiliationsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), ), ), + SizedBox( height: 10.0, ), - Card( - surfaceTintColor: Colors.white, - clipBehavior: Clip.antiAlias, - color: Colors.white, - elevation: 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 15.0), // adds rounded corners + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Container( + child: Card( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons + .keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + initiallyExpanded: true, + title: Padding( + padding: + const EdgeInsets.all( + 8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment + .start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: + "Publications", + txtcolor: + Colors.white, + fontweight: + FontWeight + .normal, + txtfont: 20.0), + const SizedBox( + width: 8.0, + ), + // Text1( + // title: widget + // .text![ + // "publications_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: Color + // .fromARGB( + // 255, + // 0, + // 71, + // 137), + // ) + ], + ), + ), + children: [ + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + width: MediaQuery.of( + context) + .size + .width, + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + 'sl no'))), + DataColumn( + label: Expanded( + child: Text( + 'Artical Title', + softWrap: + true), + )), + DataColumn( + label: Expanded( + child: Text( + 'Journal Name', + softWrap: true, + ))), + DataColumn( + label: Expanded( + child: Text( + 'Date'))), + DataColumn( + label: Expanded( + child: Text( + 'Authors'))), + + // Add more columns as needed + ], + rows: List.generate( + publication_data + .length, + (index) => DataRow( + cells: [ + DataCell(Text( + publication_data[index] + [ + 'id'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'artical_title'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'journal_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'date'] + .toString(), + softWrap: + true)), + DataCell(Text( + publication_data[index] + [ + 'author'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: + Alignment.center, + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: + (_) => + PublicationsData())); + }, + child: Text( + 'Show More'), + style: + OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), ), + ), // adds spacing between the text and image + + const SizedBox(height: 10), + + Flexible( + flex: 1, + // height: + // 200, // Set a fixed height or use constraints as needed + + child: Card( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons + .keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // backgroundColor: Colors.white, + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Padding( + padding: + const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: + MainAxisAlignment.start, + // mainAxisSize: MainAxisSize.min, + children: [ + Text1( + title: "Events", + txtcolor: + Colors.white, + fontweight: + FontWeight.normal, + txtfont: 20.0), + const SizedBox( + width: 8.0, + ), + // Text1( + // title: widget + // .text![ + // "events_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: Color + // .fromARGB( + // 255, + // 0, + // 71, + // 137), + // ) + ], + ), + ), + children: [ + SingleChildScrollView( + scrollDirection: + Axis.horizontal, + child: Container( + width: + MediaQuery.of(context) + .size + .width, + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded( + child: Text( + 'sl no', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Event Name', + softWrap: true), + )), + DataColumn( + label: Expanded( + child: Text( + 'Session Type', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Topic', + softWrap: + true))), + DataColumn( + label: Expanded( + child: Text( + 'Role', + softWrap: + true))), + + // Add more columns as needed + ], + rows: List.generate( + event_data.length, + (index) => DataRow( + cells: [ + DataCell(Text( + event_data[index] + ['id'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'event_name'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'session_type'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'topic'] + .toString(), + softWrap: + true)), + DataCell(Text( + event_data[index] + [ + 'role'] + .toString(), + softWrap: + true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + Container( + color: Colors.white, + child: Align( + alignment: + Alignment.center, + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: OutlinedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => + EventsData())); + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), + ), + ), // adds spacing between the text and image + + // adds spacing between the image and button + // Card( + // surfaceTintColor: Colors.white, + // clipBehavior: Clip.antiAlias, + // color: Colors.white, + // elevation: 5, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular( + // 15.0), // adds rounded corners + // ), + // child: Padding( + // padding: const EdgeInsets.all(18.0), + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // // mainAxisSize: MainAxisSize.min, + // children: [ + // Text1( + // title: "Publications", + // txtcolor: Color.fromARGB( + // 255, 0, 71, 137), + // fontweight: FontWeight.bold, + // txtfont: 20.0), + // const SizedBox( + // height: 15.0, + // ), + // Text1( + // title: widget.text![ + // "publications_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: Color.fromARGB( + // 255, 0, 71, 137), + // ) + // ], + // ), + // ), + // ), + + SizedBox( + height: 10.0, + ), + Flexible( + flex: 1, child: Padding( padding: const EdgeInsets.all(18.0), child: Row( @@ -1918,21 +2468,22 @@ class _ProfileState extends State { children: [ Text1( title: "Trails", - txtcolor: Color.fromARGB( - 255, 0, 71, 137), + txtcolor: + const Color.fromARGB( + 255, 0, 71, 137), fontweight: FontWeight.bold, txtfont: 20.0), const SizedBox( - height: 15.0, + width: 8.0, ), - Text1( - title: widget.text![ - "publications_count"] - .toString(), - txtfont: 18.0, - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - ) + // Text1( + // title: widget + // .text!["publications_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: Color.fromARGB( + // 255, 0, 71, 137), + // ) ], ), ), @@ -1941,83 +2492,358 @@ class _ProfileState extends State { SizedBox( height: 10.0, ), - Card( - surfaceTintColor: Colors.white, - clipBehavior: Clip.antiAlias, - color: Colors.white, - elevation: 5, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 15.0), // adds rounded corners - ), - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Row( - mainAxisAlignment: - MainAxisAlignment.start, - //mainAxisSize: MainAxisSize.min, - children: [ - GestureDetector( - onTap: () async { - /// - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (BuildContext - // context) => - // InteractionScreen( - // index: 0, - // form: - // "form3 demo"))); + Flexible( + flex: 1, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(0.0), + ), + color: const Color.fromARGB( + 255, 0, 71, 137), + child: ExpansionTile( + maintainState: true, + onExpansionChanged: + (bool expanded) { + setState(() { + _isExpanded = expanded; + }); + }, + backgroundColor: + const Color.fromARGB( + 255, 0, 71, 137), + trailing: Icon( + _isExpanded + ? Icons + .keyboard_arrow_up + : Icons + .keyboard_arrow_down, + color: Colors.white), + // collapsedBackgroundColor: Color(0xFF2b9af3), + initiallyExpanded: true, + title: Padding( + padding: + const EdgeInsets.all(8.0), + child: Row( + //mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + onTap: () async { + final provider = Provider + .of( + context, + listen: + false); + if (getCount( + provider + .intConfigDataList[ + 0] + .name, + provider) != + 0) { + provider.savedList + .where((element) => + element + .form == + provider + .intConfigDataList[ + 0] + .name) + .toList(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext + context) => + SavedFormListScreen( + formname: provider + .intConfigDataList[0] + .name, + ))); + } + }, + child: Text1( + title: + "Interaction Form", + txtcolor: + Colors.white, + fontweight: + FontWeight + .normal, + txtfont: 20.0), + ), + const SizedBox( + width: 8.0, + ), + // Text1( + // title: widget + // .text![ + // "affiliations_count"] + // .toString(), + // txtfont: 18.0, + // txtcolor: + // const Color + // .fromARGB( + // 255, + // 60, + // 82, + // 102), + // ) + ], + ), + ), + children: [ + Container( + height: + MediaQuery.of(context) + .size + .height / + 5, + color: Colors.white, + child: Consumer< + ViewInteractionProvider>( + builder: (BuildContext + context, + provider, + Widget? child) { + print( + "P_leangth : ${provider.savedList.length}"); + return ListView.builder( + shrinkWrap: true, + physics: + NeverScrollableScrollPhysics(), + itemCount: provider + .savedList + .take(2) + .length, + 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({ + 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], + ))); + }, + ), + const Divider(), + ], + ); + }); + }), + ), - ///////////////////////////////////// - /// - - final provider = Provider - .of( - context, - listen: false); - if (getCount( - provider - .intConfigDataList[ - 0] - .name, - provider) != - 0) { - provider.savedList - .where((element) => - element.form == - provider - .intConfigDataList[ - 0] - .name) - .toList(); - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext - context) => - SavedFormListScreen( - formname: provider + // SingleChildScrollView( + // scrollDirection: + // Axis.horizontal, + // child: Container( + // width: MediaQuery.of( + // context) + // .size + // .width, + // color: Colors.white, + // child: Text("hiiiiii")), + // ), + Container( + color: Colors.white, + child: Align( + alignment: + Alignment.center, + child: Padding( + padding: + const EdgeInsets + .all(8.0), + child: OutlinedButton( + onPressed: () { + final provider = + Provider.of< + InteractionProvider>( + context, + listen: + false); + if (getCount( + provider .intConfigDataList[ 0] .name, - ))); - } - ///////////////////////////////////////// - }, - child: Text1( - title: "Interaction Form", - txtcolor: Color.fromARGB( - 255, 0, 71, 137), - fontweight: - FontWeight.bold, - txtfont: 20.0), - ), - ], - ), + provider) != + 0) { + provider.savedList + .where((element) => + element + .form == + provider + .intConfigDataList[ + 0] + .name) + .toList(); + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext + context) => + SavedFormListScreen( + formname: + provider.intConfigDataList[0].name, + ))); + } + }, + child: + Text('Show More'), + style: OutlinedButton + .styleFrom( + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 12), + ), + ), + ), + ), + ), + ) + ]), ), ), + ////////////////////////////////// + // Padding( + // padding: const EdgeInsets.all(8.0), + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.start, + // //mainAxisSize: MainAxisSize.min, + // children: [ + // GestureDetector( + // onTap: () async { + // /// + // // Navigator.push( + // // context, + // // MaterialPageRoute( + // // builder: (BuildContext + // // context) => + // // InteractionScreen( + // // index: 0, + // // form: + // // "form3 demo"))); + + // ///////////////////////////////////// + // /// + + // final provider = Provider.of< + // InteractionProvider>( + // context, + // listen: false); + // if (getCount( + // provider + // .intConfigDataList[ + // 0] + // .name, + // provider) != + // 0) { + // provider.savedList + // .where((element) => + // element.form == + // provider + // .intConfigDataList[ + // 0] + // .name) + // .toList(); + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (BuildContext + // context) => + // SavedFormListScreen( + // formname: provider + // .intConfigDataList[ + // 0] + // .name, + // ))); + // } + // ///////////////////////////////////////// + // }, + // child: Text1( + // title: "Interaction Form", + // txtcolor: Color.fromARGB( + // 255, 0, 71, 137), + // fontweight: FontWeight.bold, + // txtfont: 20.0), + // ), + // ], + // ), + // ), ], ), ), @@ -2177,6 +3003,71 @@ class _ProfileState extends State { return provider.savedList.where((element) => element.form == form).length; } + + buidCard() { + Text("Hiii"); + // Card( + // child: ExpandablePanel( + // header: Text("sjdjshdehrejkwhdjksdksljdiows"), + // collapsed: Text( + // "wssjdjshdehrejkwhdjksdksljdiowssjdjshdehrejkwhdjksdksljdiows", + // ), + // expanded: Text( + // "djksdksljdiowssjdjshdehrejkwhdjksdksljdiows", + // ), + // ), + // ); + } + + showDeleteRecordAlertDialog( + BuildContext context, String record, SaveInteraction saveInteraction) { + // set up the buttons + ViewInteractionProvider provider = + Provider.of(context, listen: false); + Widget cancelButton = TextButton( + child: const Text("YES"), + onPressed: () async { + await provider.deleteRecord(saveInteraction).then((value) { + _displaySnackBar("Deleted sucessfully!"); + Navigator.of(context).pop(); + }); + }, + ); + Widget continueButton = TextButton( + child: const Text("NO"), + onPressed: () { + Navigator.of(context).pop(); + }, + ); + + // set up the AlertDialog + AlertDialog alert = AlertDialog( + title: const Text(""), + content: Text("Are you sure you want to delete the record $record ?"), + actions: [ + cancelButton, + continueButton, + ], + ); + + // show the dialog + showDialog( + context: context, + builder: (BuildContext context) { + return alert; + }, + ); + } + + _displaySnackBar(String msg) { + final snackBar = SnackBar( + content: Text( + msg, + style: const TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), + )); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + //scaffoldKeyLogin.currentState!.showSnackBar(snackBar); + } } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/lib/ui_screen/publication_data.dart b/lib/ui_screen/publication_data.dart new file mode 100644 index 0000000..f771647 --- /dev/null +++ b/lib/ui_screen/publication_data.dart @@ -0,0 +1,91 @@ +import 'package:discover_module/provider_class/affiliationsprovider.dart'; +import 'package:discover_module/provider_class/publications_provider.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class PublicationsData extends StatefulWidget { + const PublicationsData({super.key}); + + @override + State createState() => _PublicationsDataState(); +} + +class _PublicationsDataState extends State { + List hcppublication = []; + @override + void initState() { + // TODO: implement initState + super.initState(); + + affdata(); + } + + affdata() async { + final affprovider = Provider.of(context, listen: false); + await affprovider.allpublicatininfo(); + + final affdata = affprovider.allpublicationlist; + setState(() { + hcppublication = affdata; + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Publications'), + ), + body: Scrollbar( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Container( + constraints: + BoxConstraints(minWidth: MediaQuery.of(context).size.width), + color: Colors.white, + child: DataTable( + columns: const [ + DataColumn( + label: Expanded(child: Text('sl no', softWrap: true))), + DataColumn( + label: Expanded( + child: Text('Artical Title', softWrap: true), + )), + DataColumn( + label: Expanded( + child: Text('Journal Name', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Date', softWrap: true))), + DataColumn( + label: Expanded(child: Text('Authors', softWrap: true))), + + // Add more columns as needed + ], + rows: List.generate( + hcppublication.length, + (index) => DataRow( + cells: [ + DataCell(Text(hcppublication[index]['id'].toString(), + softWrap: true)), + DataCell(Text( + hcppublication[index]['artical_title'].toString(), + softWrap: true)), + DataCell(Text( + hcppublication[index]['journal_name'].toString(), + softWrap: true)), + DataCell(Text(hcppublication[index]['date'].toString(), + softWrap: true)), + DataCell(Text(hcppublication[index]['author'].toString(), + softWrap: true)), + + // Add more DataCells as needed + ], + ), + ), + ), + ), + ), + )); + } +} diff --git a/pubspec.lock b/pubspec.lock index 91b1a82..2ef7f1e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -241,6 +241,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.6" + data_table_2: + dependency: "direct main" + description: + name: data_table_2 + sha256: f02ec9b24f44420816a87370ff4f4e533e15b274f6267e4c9a88a585ad1a0473 + url: "https://pub.dev" + source: hosted + version: "2.5.15" dbus: dependency: transitive description: @@ -289,6 +297,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.5" + expandable: + dependency: "direct main" + description: + name: expandable + sha256: "9604d612d4d1146dafa96c6d8eec9c2ff0994658d6d09fed720ab788c7f5afc2" + url: "https://pub.dev" + source: hosted + version: "5.0.1" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4018223..71a5443 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -59,6 +59,9 @@ dependencies: hive_generator: ^2.0.1 responsive_grid: ^2.4.4 popover: ^0.3.0+1 + data_table_2: ^2.5.15 + expandable: ^5.0.1 + dev_dependencies: