100 lines
3.5 KiB
Dart
100 lines
3.5 KiB
Dart
|
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<AffiliationsData> createState() => _AffiliationsDataState();
|
||
|
}
|
||
|
|
||
|
class _AffiliationsDataState extends State<AffiliationsData> {
|
||
|
List hcpaffiliations = [];
|
||
|
@override
|
||
|
void initState() {
|
||
|
// TODO: implement initState
|
||
|
super.initState();
|
||
|
|
||
|
affdata();
|
||
|
}
|
||
|
|
||
|
affdata() async {
|
||
|
final affprovider =
|
||
|
Provider.of<AffiliationsProvider>(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
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
}
|
||
|
}
|