118 lines
4.1 KiB
Dart
118 lines
4.1 KiB
Dart
|
// import 'package:konectar_events/provider_class/affiliationsprovider.dart';
|
||
|
// import 'package:konectar_events/provider_class/events_provider.dart';
|
||
|
// import 'package:konectar_events/provider_class/publications_provider.dart';
|
||
|
// import 'package:konectar_events/ui_screen/bottom_sheet.dart';
|
||
|
import 'package:konectar_events/contacts_module/provider_class/events_provider.dart';
|
||
|
import 'package:konectar_events/contacts_module/ui_screen/bottom_sheet.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class EventsData extends StatefulWidget {
|
||
|
// const EventsData({super.key});
|
||
|
EventsData({required this.text, Key? key}) : super(key: key);
|
||
|
final int text;
|
||
|
|
||
|
@override
|
||
|
State<EventsData> createState() => _EventsDataState();
|
||
|
}
|
||
|
|
||
|
class _EventsDataState extends State<EventsData> {
|
||
|
List event_data = [];
|
||
|
@override
|
||
|
void initState() {
|
||
|
// TODO: implement initState
|
||
|
super.initState();
|
||
|
|
||
|
affdata();
|
||
|
}
|
||
|
|
||
|
affdata() async {
|
||
|
var events = Provider.of<EventProvider>(context, listen: false);
|
||
|
await events.geteventdata(widget.text);
|
||
|
final eventlist = events.EventsList;
|
||
|
setState(() {
|
||
|
event_data = eventlist;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text('Events'),
|
||
|
),
|
||
|
body: Scrollbar(
|
||
|
child: SingleChildScrollView(
|
||
|
scrollDirection: Axis.horizontal,
|
||
|
child: SingleChildScrollView(
|
||
|
scrollDirection: Axis.vertical,
|
||
|
child: Container(
|
||
|
constraints:
|
||
|
BoxConstraints(minWidth: MediaQuery.of(context).size.width),
|
||
|
child: DataTable(
|
||
|
showCheckboxColumn: false,
|
||
|
columns: const [
|
||
|
DataColumn(
|
||
|
label: Expanded(
|
||
|
child: Text('Event Name',
|
||
|
softWrap: true,
|
||
|
style: TextStyle(fontWeight: FontWeight.w600)),
|
||
|
)),
|
||
|
|
||
|
DataColumn(
|
||
|
label: Expanded(
|
||
|
child: Text('Role',
|
||
|
softWrap: true,
|
||
|
style:
|
||
|
TextStyle(fontWeight: FontWeight.w600)))),
|
||
|
|
||
|
// Add more columns as needed
|
||
|
],
|
||
|
rows: List.generate(
|
||
|
event_data.length,
|
||
|
(index) => DataRow(
|
||
|
onSelectChanged: (value) {
|
||
|
// =======> Use onSelectChanged for tab
|
||
|
print("message ${event_data[index]}");
|
||
|
|
||
|
showModalBottomSheet(
|
||
|
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,
|
||
|
context: context,
|
||
|
builder: (context) {
|
||
|
return bsheet(event_data[index]);
|
||
|
},
|
||
|
);
|
||
|
},
|
||
|
cells: [
|
||
|
DataCell(Text(
|
||
|
event_data[index]['event_name'].toString(),
|
||
|
softWrap: true)),
|
||
|
|
||
|
DataCell(Text(event_data[index]['role'].toString(),
|
||
|
softWrap: true)),
|
||
|
|
||
|
// Add more DataCells as needed
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
}
|
||
|
}
|