DiscoverModule/lib/contacts_module/ui_screen/publication_data.dart

125 lines
4.6 KiB
Dart
Raw Normal View History

2024-10-07 12:41:28 +00:00
// import 'package:discover_module/provider_class/affiliationsprovider.dart';
// import 'package:discover_module/provider_class/publications_provider.dart';
// import 'package:discover_module/ui_screen/bottom_sheet.dart';
// import 'package:discover_module/ui_screen/bottommmsheet.dart';
import 'package:discover_module/contacts_module/provider_class/publications_provider.dart';
import 'package:discover_module/contacts_module/ui_screen/bottom_sheet.dart';
2024-07-05 08:48:29 +00:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PublicationsData extends StatefulWidget {
2024-08-30 12:24:54 +00:00
PublicationsData({required this.text, Key? key}) : super(key: key);
final int text;
2024-07-05 08:48:29 +00:00
@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);
2024-08-30 12:24:54 +00:00
await affprovider.publicatininfo(widget.text);
2024-07-05 08:48:29 +00:00
2024-08-30 12:24:54 +00:00
final affdata = affprovider.publicationlist;
2024-07-05 08:48:29 +00:00
setState(() {
hcppublication = affdata;
});
2024-08-30 12:24:54 +00:00
print("hcppppProfiledata: ${hcppublication}");
2024-07-05 08:48:29 +00:00
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Publications'),
),
body: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
2024-08-30 12:24:54 +00:00
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
constraints:
BoxConstraints(minWidth: MediaQuery.of(context).size.width),
color: Colors.white,
child: DataTable(
showCheckboxColumn: false,
columns: const [
DataColumn(
label: Expanded(
child: Text('Article 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))),
2024-07-05 08:48:29 +00:00
2024-08-30 12:24:54 +00:00
// Add more columns as needed
],
rows: List.generate(
hcppublication.length,
(index) => DataRow(
onSelectChanged: (value) {
// =======> Use onSelectChanged for tab
print("message11 ${hcppublication[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(hcppublication[index]);
},
);
},
cells: [
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)),
2024-07-05 08:48:29 +00:00
2024-08-30 12:24:54 +00:00
// Add more DataCells as needed
],
),
2024-07-05 08:48:29 +00:00
),
),
),
),
),
));
}
}