import 'package:konectar_events/contacts_module/provider_class/training_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 TrainingShowMore extends StatefulWidget { TrainingShowMore({required this.text, Key? key}) : super(key: key); final int text; @override State createState() => _TrainingShowMoreState(); } class _TrainingShowMoreState extends State { @override List training = []; @override void initState() { // TODO: implement initState super.initState(); affdata(); } affdata() async { var trai = Provider.of(context, listen: false); await trai.traininginfo(widget.text); final training1 = trai.traininglist; setState(() { training = training1; }); print("locationList: ${training}"); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Training'), ), 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('Education Type', style: TextStyle(fontWeight: FontWeight.w600), softWrap: true), )), DataColumn( label: Expanded( child: Text('Institution Name', style: TextStyle(fontWeight: FontWeight.w600)))), ], rows: List.generate( training.length, (index) => DataRow( onSelectChanged: (value) { print("message ${training[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(training[index]); }, ); }, cells: [ DataCell(Text( training[index]['Education Type'].toString(), softWrap: true)), DataCell(Text( training[index]['Institution Name'].toString(), softWrap: true)), ], ), ), ), ), ), ), )); } }