KonectarEvents/lib/contacts_module/ui_screen/trials_show_more.dart

112 lines
3.9 KiB
Dart
Raw Permalink Normal View History

2024-10-08 12:01:59 +00:00
// import 'package:konectar_events/provider_class/trials_provider.dart';
// import 'package:konectar_events/ui_screen/bottom_sheet.dart';
import 'package:konectar_events/contacts_module/provider_class/trials_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 TrialsShowmore extends StatefulWidget {
TrialsShowmore({required this.text, Key? key}) : super(key: key);
final int text;
@override
State<TrialsShowmore> createState() => _TrialsShowmoreState();
}
class _TrialsShowmoreState extends State<TrialsShowmore> {
List trial_data = [];
@override
void initState() {
// TODO: implement initState
super.initState();
affdata();
}
affdata() async {
var trials = Provider.of<TrialsProvider>(context, listen: false);
await trials.trialsdata(widget.text);
final trialslist = trials.trialsinfo;
setState(() {
trial_data = trialslist;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Trials'),
),
body: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
constraints:
BoxConstraints(minWidth: MediaQuery.of(context).size.width),
child: DataTable(
showCheckboxColumn: false,
columns: const [
DataColumn(
label: Expanded(
child: Text('Trial Name',
softWrap: true,
style: TextStyle(fontWeight: FontWeight.w600)),
)),
DataColumn(
label: Expanded(
child: Text('Status',
softWrap: true,
style:
TextStyle(fontWeight: FontWeight.w600)))),
],
rows: List.generate(
trial_data.length,
(index) => DataRow(
onSelectChanged: (value) {
// =======> Use onSelectChanged for tab
print("message ${trial_data[index]}");
// bsheet(
// publication_data[
// 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(trial_data[index]);
},
);
},
cells: [
DataCell(Text(
trial_data[index]['trial_name'].toString(),
softWrap: true)),
DataCell(Text(trial_data[index]['status'].toString(),
softWrap: true)),
],
),
),
),
),
),
),
));
}
}