Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix theming for dark themes #365

Merged
merged 4 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/fleather/lib/src/widgets/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ typedef FleatherEmbedBuilder = Widget Function(
/// Only supports "horizontal rule" embeds.
Widget defaultFleatherEmbedBuilder(BuildContext context, EmbedNode node) {
if (node.value.type == 'hr') {
final theme = FleatherTheme.of(context)!;
final theme = Theme.of(context);
final fleatherTheme = FleatherTheme.of(context)!;

return Divider(
height: theme.paragraph.style.fontSize! * theme.paragraph.style.height!,
height: fleatherTheme.paragraph.style.fontSize! *
fleatherTheme.paragraph.style.height!,
thickness: 2,
color: Colors.grey.shade200,
color: theme.colorScheme.surfaceContainerHigh,
maelchiotti marked this conversation as resolved.
Show resolved Hide resolved
);
}
throw UnimplementedError(
Expand Down
13 changes: 8 additions & 5 deletions packages/fleather/lib/src/widgets/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ class FleatherThemeData {
underline: const TextStyle(decoration: TextDecoration.underline),
strikethrough: const TextStyle(decoration: TextDecoration.lineThrough),
inlineCode: InlineCodeThemeData(
backgroundColor: Colors.grey.shade100,
radius: const Radius.circular(3),
backgroundColor: themeData.colorScheme.surfaceContainerHigh,
radius: const Radius.circular(2),
style: inlineCodeStyle,
heading1: inlineCodeStyle.copyWith(
fontSize: 32,
Expand Down Expand Up @@ -245,20 +245,23 @@ class FleatherThemeData {
lineSpacing: const VerticalSpacing(top: 6, bottom: 2),
decoration: BoxDecoration(
border: BorderDirectional(
start: BorderSide(width: 4, color: Colors.grey.shade300),
start: BorderSide(
width: 4,
color: themeData.colorScheme.surfaceContainerHigh,
),
),
),
),
code: TextBlockTheme(
style: TextStyle(
color: Colors.blue.shade900.withOpacity(0.9),
color: themeData.colorScheme.primary.withOpacity(0.8),
fontFamily: fontFamily,
fontSize: 13.0,
height: 1.4,
),
spacing: baseSpacing,
decoration: BoxDecoration(
color: Colors.grey.shade50,
color: themeData.colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(2),
),
),
Expand Down