import 'package:discover_module/provider_class/educationprovider.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 EducationShowMore extends StatefulWidget { EducationShowMore({required this.text, Key? key}) : super(key: key); final int text; @override State createState() => _EducationShowMoreState(); } class _EducationShowMoreState extends State { @override List education = []; @override void initState() { // TODO: implement initState super.initState(); affdata(); } affdata() async { var edu = Provider.of(context, listen: false); await edu.eduinfo(widget.text); final edu1 = edu.educationlist; setState(() { education = edu1; }); print("locationList: ${education}"); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Education'), ), 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( education.length, (index) => DataRow( onSelectChanged: (value) { print("message ${education[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(education[index]); }, ); }, cells: [ DataCell(Text( education[index]['Education Type'].toString(), softWrap: true)), DataCell(Text( education[index]['Institution Name'].toString(), softWrap: true)), ], ), ), ), ), ), ), )); } }