import 'package:discover_module/provider_class/procedureprovider.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 ProShowMore extends StatefulWidget { ProShowMore({required this.text, Key? key}) : super(key: key); final int text; @override State createState() => _ProShowMoreState(); } class _ProShowMoreState extends State { List procedure = []; @override void initState() { // TODO: implement initState super.initState(); affdata(); } affdata() async { var pro = Provider.of(context, listen: false); await pro.proinfo(widget.text); final pro1 = pro.prolist; setState(() { procedure = pro1; }); print("locationList: ${procedure}"); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Procedures'), ), 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('Program Year', style: TextStyle(fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Procedure', style: TextStyle(fontWeight: FontWeight.w600)))), ], rows: List.generate( procedure.length, (index) => DataRow( onSelectChanged: (value) { print("message ${procedure[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(procedure[index]); }, ); }, cells: [ DataCell(Text(procedure[index]['Procedure'].toString(), softWrap: true)), DataCell(Text( procedure[index]['Place of Service'].toString(), softWrap: true)), ], ), ), ), ), ), ), )); } }