346 lines
15 KiB
Dart
346 lines
15 KiB
Dart
import 'package:discover_module/contacts_module/custom_widget/custom_expansiontile.dart';
|
|
import 'package:discover_module/contacts_module/custom_widget/custom_sizedbox.dart';
|
|
import 'package:discover_module/contacts_module/custom_widget/text.dart';
|
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_aff_k2.dart';
|
|
import 'package:discover_module/contacts_module/model_class/k2_api_model/kol_event_k2.dart';
|
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_aff_provider.dart';
|
|
import 'package:discover_module/contacts_module/provider_class/k2_provider/kol_event_provider.dart';
|
|
import 'package:discover_module/contacts_module/ui_screen/k2api_integrated_ui/k2testbshhet.dart';
|
|
import 'package:discover_module/contacts_module/ui_screen/show_morek2/events_showmorek2.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class ActivitiesK2Demo extends StatefulWidget {
|
|
const ActivitiesK2Demo({required this.text, super.key, this.offlineMode});
|
|
|
|
final int text;
|
|
final bool? offlineMode;
|
|
|
|
@override
|
|
State<ActivitiesK2Demo> createState() => _ActivitiesState();
|
|
}
|
|
|
|
class _ActivitiesState extends State<ActivitiesK2Demo> {
|
|
bool isDataLoaded = false;
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
getaffiliations();
|
|
}
|
|
|
|
Future<void> getaffiliations() async {
|
|
final affProvider =
|
|
Provider.of<AffiliationsProviderk2>(context, listen: false);
|
|
|
|
final eveProvider = Provider.of<EventProviderK2>(context, listen: false);
|
|
|
|
if (!affProvider.hasData) {
|
|
await affProvider.getAffiliationsdata(widget.text);
|
|
}
|
|
|
|
if (mounted) {
|
|
if (!eveProvider.hasData) {
|
|
await eveProvider.geteventdata(widget.text);
|
|
}
|
|
}
|
|
setState(() {
|
|
isDataLoaded = true; // Mark data as loaded
|
|
});
|
|
}
|
|
|
|
Widget build(BuildContext context) {
|
|
final affProvider =
|
|
Provider.of<AffiliationsProviderk2>(context, listen: false);
|
|
|
|
final eveProvider = Provider.of<EventProviderK2>(context, listen: false);
|
|
return Center(
|
|
child: ListView(children: [
|
|
affProvider.hasData
|
|
? CustomExpansionTile<AffList>(
|
|
title: "Affiliations",
|
|
itemList: affProvider.adddta.cast<AffList>(),
|
|
buttonText: 'Show More',
|
|
field1: 'Organization Name',
|
|
field2: 'TimeFrame',
|
|
noexpand: widget.offlineMode == null ? true : false,
|
|
onItemSelected: (AffList selectedLocation) {
|
|
List<Map<String, dynamic>> keyValue = [
|
|
{
|
|
"Department": selectedLocation.department,
|
|
"Title": selectedLocation.title,
|
|
"Start Year": selectedLocation.startYear,
|
|
"End Year": selectedLocation.endYear,
|
|
"Role": selectedLocation.role,
|
|
"Organization Type": selectedLocation.kolOrganizationType,
|
|
"Engagement Type": selectedLocation.kolEngagementType,
|
|
}
|
|
];
|
|
modelbsheet(keyValue);
|
|
},
|
|
)
|
|
: Container(),
|
|
eveProvider.hasData
|
|
? CustomExpansionTile<EventList>(
|
|
title: "Events",
|
|
itemList: eveProvider.EventsList.cast<EventList>(),
|
|
buttonText: 'Show More',
|
|
field1: 'Event Name',
|
|
field2: 'Role',
|
|
noexpand: widget.offlineMode == null ? true : false,
|
|
onItemSelected: (EventList selectedLocation) {
|
|
List<Map<String, dynamic>> keyValue = [
|
|
{
|
|
"Name": selectedLocation.name,
|
|
"Notes": selectedLocation.notes,
|
|
"Partially Released Event":
|
|
selectedLocation.partiallyReleasedEvent,
|
|
}
|
|
];
|
|
modelbsheet(keyValue);
|
|
},
|
|
onButtonPressed: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (_) => Events2ShowMore(text: widget.text)));
|
|
},
|
|
)
|
|
: Container(),
|
|
]),
|
|
);
|
|
}
|
|
|
|
void bottomshet(affiliation_data) {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
|
|
useRootNavigator: true,
|
|
isScrollControlled: false,
|
|
enableDrag: true,
|
|
useSafeArea: true,
|
|
constraints: const BoxConstraints(
|
|
maxWidth: double.infinity,
|
|
),
|
|
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(0),
|
|
),
|
|
),
|
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
// sheetAnimationStyle: _animationStyle,
|
|
builder: (BuildContext context) {
|
|
return
|
|
// makeDismissible(
|
|
// child:
|
|
DraggableScrollableSheet(
|
|
expand: false,
|
|
builder: (BuildContext context, ScrollController scrollController) {
|
|
return Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
//color: Colors.white,
|
|
color: Color.fromARGB(255, 246, 248, 252),
|
|
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: ListView.builder(
|
|
controller: scrollController,
|
|
itemCount: 1,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const CustomSizedBox(height: 18.0),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(18.0),
|
|
child: Text(
|
|
affiliation_data.org_name,
|
|
softWrap: true,
|
|
maxLines: 4,
|
|
style: const TextStyle(
|
|
fontSize: 16.0, color: Colors.black),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const CustomSizedBox(height: 18.0),
|
|
Divider(),
|
|
const CustomSizedBox(height: 18.0),
|
|
affiliation_data['dept'] != ""
|
|
? Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text1(
|
|
title: "Department",
|
|
txtfont: 13.0,
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text(
|
|
affiliation_data['dept'],
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700]),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: Container(),
|
|
affiliation_data['role'] != ""
|
|
? Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 18.0, top: 18.0),
|
|
child: Text1(
|
|
title: "Role",
|
|
txtfont: 13.0,
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text(
|
|
affiliation_data['role'],
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700]),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: Container(),
|
|
affiliation_data['time_frame'] != ""
|
|
? Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 18.0, top: 18.0),
|
|
child: Text(
|
|
"Time Frame".toString(),
|
|
style: TextStyle(fontSize: 13.0),
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text(
|
|
affiliation_data['time_frame']
|
|
.toString(),
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700]),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: Container(),
|
|
affiliation_data['org_type'] != ""
|
|
? Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 18.0, top: 18.0),
|
|
child: Text1(
|
|
title: "Oraganization Type",
|
|
txtfont: 13.0,
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text(
|
|
affiliation_data['org_type'],
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700]),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: Container(),
|
|
affiliation_data['emg_type'] != ""
|
|
? Column(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 18.0, top: 18.0),
|
|
child: Text(
|
|
"Eng Type",
|
|
style: TextStyle(fontSize: 13.0),
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.only(left: 18.0),
|
|
child: Text(
|
|
affiliation_data['emg_type'],
|
|
style: TextStyle(
|
|
fontSize: 14.0,
|
|
color: Colors.grey[700]),
|
|
),
|
|
)
|
|
],
|
|
)
|
|
: Container(),
|
|
],
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
//);
|
|
},
|
|
);
|
|
}
|
|
|
|
void modelbsheet(List<Map<String, dynamic>> keyValue) {
|
|
showModalBottomSheet(
|
|
useRootNavigator: true,
|
|
isScrollControlled: false,
|
|
enableDrag: true,
|
|
useSafeArea: true,
|
|
constraints: const BoxConstraints(
|
|
maxWidth: double.infinity,
|
|
),
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(0),
|
|
),
|
|
),
|
|
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
context: context,
|
|
builder: (context) {
|
|
return bsheetk2new(keyValue);
|
|
},
|
|
);
|
|
}
|
|
}
|