KonectarApp/lib/contacts_module/ui_screen/publication_data.dart

125 lines
4.6 KiB
Dart

// import 'package:konectar_events/provider_class/affiliationsprovider.dart';
// import 'package:konectar_events/provider_class/publications_provider.dart';
// import 'package:konectar_events/ui_screen/bottom_sheet.dart';
// import 'package:konectar_events/ui_screen/bottommmsheet.dart';
import 'package:konectar_events/contacts_module/provider_class/publications_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 PublicationsData extends StatefulWidget {
PublicationsData({required this.text, Key? key}) : super(key: key);
final int text;
@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.publicatininfo(widget.text);
final affdata = affprovider.publicationlist;
setState(() {
hcppublication = affdata;
});
print("hcppppProfiledata: ${hcppublication}");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Publications'),
),
body: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
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))),
// 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)),
// Add more DataCells as needed
],
),
),
),
),
),
),
));
}
}