DiscoverModule/lib/ui_screen/patent_show_more.dart

107 lines
3.6 KiB
Dart

import 'package:discover_module/provider_class/patent_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 PatentShowMore extends StatefulWidget {
PatentShowMore({required this.text, Key? key}) : super(key: key);
final int text;
@override
State<PatentShowMore> createState() => _PatentShowMoreState();
}
class _PatentShowMoreState extends State<PatentShowMore> {
List patent = [];
@override
void initState() {
// TODO: implement initState
super.initState();
affdata();
}
affdata() async {
var patentt = Provider.of<PatentProvider>(context, listen: false);
await patentt.patentinfo(widget.text);
final patentt1 = patentt.patentlist;
setState(() {
patent = patentt1;
});
print("locationList: ${patent}");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Patents'),
),
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('Patent Title',
style: TextStyle(fontWeight: FontWeight.w600),
softWrap: true),
)),
DataColumn(
label: Expanded(
child: Text('Status',
style:
TextStyle(fontWeight: FontWeight.w600)))),
],
rows: List.generate(
patent.length,
(index) => DataRow(
onSelectChanged: (value) {
print("message ${patent[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(patent[index]);
},
);
},
cells: [
DataCell(Text(patent[index]['Patent Title'].toString(),
softWrap: true)),
DataCell(Text(patent[index]['Status'].toString(),
softWrap: true)),
],
),
),
),
),
),
),
));
}
}