Skip to content

Commit

Permalink
Add light/dark for grid
Browse files Browse the repository at this point in the history
  • Loading branch information
evolvedlight committed Sep 28, 2024
1 parent d93e436 commit c5fe414
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/src/widgets/plutojiratable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intl/intl.dart';
import 'package:pluto_grid/pluto_grid.dart';
import 'package:worklog_assistant/src/providers/jira_provider.dart';
import 'package:worklog_assistant/src/providers/settings.dart';
import 'package:worklog_assistant/src/widgets/asyncjirasummarytextwidget.dart';
import 'package:fluent_ui/fluent_ui.dart' as fluent;

Expand Down Expand Up @@ -60,9 +61,9 @@ class _PlutoGridExamplePageState extends ConsumerState<PlutoJiraTable> {

@override
Widget build(BuildContext context) {
var theme = PlutoGridConfiguration.dark(
style: PlutoGridStyleConfig.dark(
borderColor: Color.fromARGB(0, 0, 0, 0), gridBackgroundColor: Color.fromARGB(0, 0, 0, 0), gridBorderColor: Color.fromARGB(0, 0, 0, 0)));
var appTheme = ref.watch(currentThemeModeProvider);

var gridTheme = calculateTheme(appTheme);

var jiraState = ref.watch(jiraNotifierProvider);

Expand Down Expand Up @@ -131,7 +132,7 @@ class _PlutoGridExamplePageState extends ConsumerState<PlutoJiraTable> {

jiraN.updateJira(jiraModel.id!, jiraModel);
},
configuration: theme,
configuration: gridTheme,
)),
],
);
Expand Down Expand Up @@ -201,4 +202,19 @@ class _PlutoGridExamplePageState extends ConsumerState<PlutoJiraTable> {
);
}).toList());
}

PlutoGridConfiguration calculateTheme(ThemeMode appTheme) {
if (appTheme.name == "dark") {
return PlutoGridConfiguration.dark(
style: PlutoGridStyleConfig.dark(
borderColor: Color.fromARGB(0, 0, 0, 0), gridBackgroundColor: Color.fromARGB(0, 0, 0, 0), gridBorderColor: Color.fromARGB(0, 0, 0, 0)));
}
return PlutoGridConfiguration(
style: PlutoGridStyleConfig(
borderColor: Color.fromARGB(0, 0, 0, 0),
gridBackgroundColor: Color.fromARGB(0, 0, 0, 0),
gridBorderColor: Color.fromARGB(0, 0, 0, 0),
),
);
}
}

0 comments on commit c5fe414

Please sign in to comment.