How to remove card on flutter paginated table

190 Views Asked by At

Is there a possible way to remove card on paginated data table on flutter?

1

There are 1 best solutions below

0
On

You can remove the card on your paginated data table by wrapping it with a theme widget and setting the theme of the card to have zero elevation

class CustomDataTable extends StatelessWidget {


final DataTableSource source;
  final List<DataColumn> columns;
  const CustomDataTable(
      {super.key, required this.columns, required this.source});

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: Theme.of(context).copyWith(
        cardTheme: const CardTheme(
          color: Colors.transparent,
          elevation: 0.0, //removes the card
        ),
        dividerTheme: const DividerThemeData(
          color: Colors.transparent,
          thickness: 0.0, // removes the row dividers
        ),
      ),
      child: PaginatedDataTable(
        columns: columns,
        source: source,
      ),
    );
  }
}