108 lines
3.6 KiB
Dart
108 lines
3.6 KiB
Dart
|
import 'package:discover_module/provider_class/nih_provider.dart';
|
||
|
import 'package:discover_module/ui_screen/bottom_sheet.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:provider/provider.dart';
|
||
|
|
||
|
class NIHShowMore extends StatefulWidget {
|
||
|
NIHShowMore({required this.text, Key? key}) : super(key: key);
|
||
|
final int text;
|
||
|
|
||
|
@override
|
||
|
State<NIHShowMore> createState() => _NIHShowMoreState();
|
||
|
}
|
||
|
|
||
|
class _NIHShowMoreState extends State<NIHShowMore> {
|
||
|
List nihgrants = [];
|
||
|
@override
|
||
|
void initState() {
|
||
|
// TODO: implement initState
|
||
|
super.initState();
|
||
|
|
||
|
affdata();
|
||
|
}
|
||
|
|
||
|
affdata() async {
|
||
|
var nih = Provider.of<NIHGrantsProvider>(context, listen: false);
|
||
|
await nih.nihinfo(widget.text);
|
||
|
final nih1 = nih.nihlist;
|
||
|
setState(() {
|
||
|
nihgrants = nih1;
|
||
|
});
|
||
|
|
||
|
print("locationList: ${nihgrants}");
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text('NIH Grants'),
|
||
|
),
|
||
|
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('NIH Center',
|
||
|
style: TextStyle(fontWeight: FontWeight.w600),
|
||
|
softWrap: true),
|
||
|
)),
|
||
|
DataColumn(
|
||
|
label: Expanded(
|
||
|
child: Text('Organization Name',
|
||
|
style:
|
||
|
TextStyle(fontWeight: FontWeight.w600)))),
|
||
|
],
|
||
|
rows: List.generate(
|
||
|
nihgrants.length,
|
||
|
(index) => DataRow(
|
||
|
onSelectChanged: (value) {
|
||
|
print("message ${nihgrants[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(nihgrants[index]);
|
||
|
},
|
||
|
);
|
||
|
},
|
||
|
cells: [
|
||
|
DataCell(Text(nihgrants[index]['pi_names'].toString(),
|
||
|
softWrap: true)),
|
||
|
DataCell(Text(
|
||
|
nihgrants[index]['NIH Center/Institute'].toString(),
|
||
|
softWrap: true)),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
));
|
||
|
}
|
||
|
}
|