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