DiscoverModule/lib/ui_screen/publication_data.dart

92 lines
3.0 KiB
Dart

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<PublicationsData> createState() => _PublicationsDataState();
}
class _PublicationsDataState extends State<PublicationsData> {
List hcppublication = [];
@override
void initState() {
// TODO: implement initState
super.initState();
affdata();
}
affdata() async {
final affprovider = Provider.of<PublicatioProvider>(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
],
),
),
),
),
),
));
}
}