Skip to content

Commit

Permalink
Fix histogram outside text color
Browse files Browse the repository at this point in the history
  • Loading branch information
viplmad committed Jan 14, 2024
1 parent fea7817 commit f6cbfa2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion lib/ui/common/statistics_histogram.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ class StatisticsStackedHistogram<N extends num> extends StatelessWidget {
final Color colour = colours.isEmpty
? Theme.of(context).primaryColor
: colours.elementAt(valueIndex);
final charts.Color seriesColour = charts.ColorUtil.fromDartColor(colour);
final charts.Color outsideTextColour = charts.ColorUtil.fromDartColor(
AppTheme.defaultThemeTextColor(context),
);

final List<_SeriesElement<N>> data = <_SeriesElement<N>>[];

Expand All @@ -103,12 +107,14 @@ class StatisticsStackedHistogram<N extends num> extends StatelessWidget {
final charts.Series<_SeriesElement<N>, String> series =
charts.Series<_SeriesElement<N>, String>(
id: valueIndex.toString(),
colorFn: (_, __) => charts.ColorUtil.fromDartColor(colour),
colorFn: (_, __) => seriesColour,
domainFn: (_SeriesElement<N> element, _) => element.domainLabel,
measureFn: (_SeriesElement<N> element, _) => element.value,
data: data,
labelAccessorFn: (_SeriesElement<N> element, _) =>
element.value > 0 ? labelAccessor(element.value) : '',
outsideLabelStyleAccessorFn: (_, __) =>
charts.TextStyleSpec(color: outsideTextColour),
);

seriesList.add(series);
Expand Down Expand Up @@ -196,6 +202,10 @@ class StatisticsPieChart<N extends num> extends StatelessWidget {
data.add(seriesElement);
}

final charts.Color outsideTextColour = charts.ColorUtil.fromDartColor(
AppTheme.defaultThemeTextColor(context),
);

final charts.Series<_SeriesElement<N>, String> series =
charts.Series<_SeriesElement<N>, String>(
id: id,
Expand All @@ -211,6 +221,8 @@ class StatisticsPieChart<N extends num> extends StatelessWidget {
labelAccessorFn: (_SeriesElement<N> element, _) => element.value > 0
? labelAccessor(element.domainLabel, element.value)
: '',
outsideLabelStyleAccessorFn: (_, __) =>
charts.TextStyleSpec(color: outsideTextColour),
);

final List<charts.Series<_SeriesElement<N>, String>> seriesList =
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/theme/dlc_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DLCTheme {
static const Color primaryColour = Colors.deepPurple;
static const Color secondaryColour = Colors.deepPurpleAccent;

static const IconData primaryIcon = Icons.widgets_outlined;
static const IconData primaryIcon = Icons.widgets;

static ThemeData themeData(BuildContext context) {
return ThemeUtils.themeByColours(context, primaryColour, secondaryColour);
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/theme/game_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class GameTheme {
Colors.orangeAccent,
];

static const IconData primaryIcon = Icons.videogame_asset_outlined;
static const IconData primaryIcon = Icons.videogame_asset;
static const IconData sessionIcon = Icons.schedule;
static const IconData finishedIcon = Icons.emoji_events_outlined;
static const IconData longestSessionIcon = Icons.timelapse;
Expand Down

0 comments on commit f6cbfa2

Please sign in to comment.