maxim-saplin / data_table_2

In-place substitute for Flutter's DataTable and PaginatedDataTable with fixed/sticky header and extra features
https://pub.dev/packages/data_table_2
BSD 3-Clause "New" or "Revised" License
202 stars 135 forks source link

Color of Checkbox doesn't match to theme color. #244

Closed GuHiroo closed 8 months ago

GuHiroo commented 8 months ago

Hi, I'm using your library to create a table, and want to change the checkbox's color. It works fine using primaryColor in flutter 3.3.0. Now i need to upgrade flutter to 3.16.0 while keeps the theme unchange, so I set useMaterial3: false. Everything goes fine, except checkbox in paginated_data_table_2. It keeps showing the default color in Material3, which is purple. I've tried set checkbox color in theme or let the table as a child of theme, didn't work though.

Is there any way to set the color? Using data_table_2 2.5.9 Appreciate to any help.

GuHiroo commented 8 months ago

I figured out how to change it, by changing headingCheckboxTheme and datarowCheckboxTheme. Sorry for bothering

u-sour commented 2 months ago

Note : since flutter v 3.10 (Material 3) has some break change about checkbox theme anyone check this issue https://github.com/flutter/flutter/issues/130295 and here how we can change checkbox theme right now.

checkboxTheme: CheckboxThemeData(
      fillColor: WidgetStateProperty.resolveWith((states) {
        if (states.contains(WidgetState.selected)) {
          return Colors.red;
        }
        return null;
      }),
    ),