import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:konectar_events/utils/util.dart'; import 'package:konectar_events/widgets/custombutton.dart'; class CustomEventTopicsCard extends StatelessWidget { const CustomEventTopicsCard({super.key}); @override Widget build(BuildContext context) { return FittedBox( child: Container( padding: EdgeInsets.all(8.0), width: isTablet ? MediaQuery.of(context).size.width : MediaQuery.of(context).size.width, // height: isTablet ? 320 : 280, child: Column( children: [ TopicsDataTable(), ], )), ); } } class TopicsDataTable extends StatelessWidget { Widget build(BuildContext context) { return SizedBox( height: isTablet ? 300 : 250, width: isTablet ? MediaQuery.of(context).size.width : 380, child: ListView( padding: const EdgeInsets.all(2), children: [ PaginatedDataTable( columnSpacing: isTablet ? 56.0 : 14, header: Center(child: Text('Husain Hatim')), rowsPerPage: 2, showCheckboxColumn: false, actions: [], headingRowColor: MaterialStatePropertyAll(Colors.blue), columns: [ DataColumn( label: FittedBox( // width: 60, child: Center(child: Text('Section Name(s)')))), DataColumn(label: FittedBox(child: Text('Topics'))), ], source: _DataSource(context), ), ], ), ); } } class _Row { _Row(this.session, this.topic); final String session; final String topic; // final List data; bool selected = false; } class _DataSource extends DataTableSource { _DataSource(this.context) { _rows = <_Row>[ _Row('Program Committee', 'Admin. & Management'), _Row('Program Committee', 'Admin. & Management'), ]; } final BuildContext context; late List<_Row> _rows; int _selectedCount = 0; @override DataRow? getRow(int index) { assert(index >= 0); if (index >= _rows.length) return null; final row = _rows[index]; return DataRow.byIndex( index: index, selected: row.selected, onSelectChanged: (value) { if (row.selected != value) { _selectedCount += value! ? 1 : -1; assert(_selectedCount >= 0); row.selected = value; notifyListeners(); } }, cells: [ DataCell(Text( row.session, style: TextStyle(fontSize: isTablet ? 18 : 14), )), DataCell( Text(row.topic, style: TextStyle(fontSize: isTablet ? 18 : 14))), ], ); } @override int get rowCount => _rows.length; @override bool get isRowCountApproximate => false; @override int get selectedRowCount => _selectedCount; }