Skip to content

Commit

Permalink
Merge pull request #13 from mkobuolys/fix/split-slide-text-color
Browse files Browse the repository at this point in the history
fix: override text colors for Material text styles
  • Loading branch information
mkobuolys authored Sep 17, 2023
2 parents d74fb6d + eda9d1f commit 83a83d1
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.4.1

fix: override text colors for Material text styles

# 0.4.0

- **BREAKING**: refactor: rework the way how a new slide is created
Expand Down
28 changes: 20 additions & 8 deletions lib/src/flutter_deck_slide.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,29 @@ class FlutterDeckSlide extends StatelessWidget {

@override
Widget build(BuildContext context) {
final materialTheme = Theme.of(context);
final theme = FlutterDeckTheme.of(context).merge(_theme);

final slideTheme = theme.slideTheme;
final textTheme = theme.textTheme;
final backgroundColor = slideTheme.backgroundColor;
final color = slideTheme.color;

return FlutterDeckTheme(
data: theme.copyWith(textTheme: textTheme.apply(color: slideTheme.color)),
child: Builder(
builder: (context) => Scaffold(
backgroundColor: slideTheme.backgroundColor,
drawer: const FlutterDeckDrawer(),
body: _SlideBody(child: _builder(context)),
return Theme(
data: materialTheme.copyWith(
textTheme: materialTheme.textTheme.apply(
bodyColor: color,
displayColor: color,
decorationColor: color,
),
),
child: FlutterDeckTheme(
data: theme.copyWith(textTheme: theme.textTheme.apply(color: color)),
child: Builder(
builder: (context) => Scaffold(
backgroundColor: backgroundColor,
drawer: const FlutterDeckDrawer(),
body: _SlideBody(child: _builder(context)),
),
),
),
);
Expand Down
26 changes: 18 additions & 8 deletions lib/src/templates/split_slide.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,26 @@ class _ContentSection extends StatelessWidget {

@override
Widget build(BuildContext context) {
final materialTheme = Theme.of(context);
final theme = FlutterDeckTheme.of(context);

return FlutterDeckTheme(
data: theme.copyWith(textTheme: theme.textTheme.apply(color: color)),
child: Builder(
builder: (context) => Expanded(
flex: flex,
child: Padding(
padding: FlutterDeckLayout.slidePadding,
child: builder(context),
return Theme(
data: materialTheme.copyWith(
textTheme: materialTheme.textTheme.apply(
bodyColor: color,
displayColor: color,
decorationColor: color,
),
),
child: FlutterDeckTheme(
data: theme.copyWith(textTheme: theme.textTheme.apply(color: color)),
child: Builder(
builder: (context) => Expanded(
flex: flex,
child: Padding(
padding: FlutterDeckLayout.slidePadding,
child: builder(context),
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_deck
description: A lightweight, customizable, and easy-to-use framework to create presentations in Flutter.
version: 0.4.0
version: 0.4.1
homepage: https://github.com/mkobuolys/flutter_deck
repository: https://github.com/mkobuolys/flutter_deck
issue_tracker: https://github.com/mkobuolys/flutter_deck/issues
Expand Down

0 comments on commit 83a83d1

Please sign in to comment.