From abf6a1da4ed07a819de72aa67c33446341cc3c9a Mon Sep 17 00:00:00 2001 From: HosamHasanRamadan Date: Wed, 10 Jul 2024 00:22:49 +0300 Subject: [PATCH 1/4] remove backgroundColor from code text them --- packages/flutter_markdown/lib/src/style_sheet.dart | 5 ----- packages/flutter_markdown/test/style_sheet_test.dart | 3 --- 2 files changed, 8 deletions(-) diff --git a/packages/flutter_markdown/lib/src/style_sheet.dart b/packages/flutter_markdown/lib/src/style_sheet.dart index 3923e618ff3..478b2a47dc9 100644 --- a/packages/flutter_markdown/lib/src/style_sheet.dart +++ b/packages/flutter_markdown/lib/src/style_sheet.dart @@ -104,7 +104,6 @@ class MarkdownStyleSheet { p: theme.textTheme.bodyMedium, pPadding: EdgeInsets.zero, code: theme.textTheme.bodyMedium!.copyWith( - backgroundColor: theme.cardTheme.color ?? theme.cardColor, fontFamily: 'monospace', fontSize: theme.textTheme.bodyMedium!.fontSize! * 0.85, ), @@ -175,9 +174,6 @@ class MarkdownStyleSheet { p: theme.textTheme.textStyle, pPadding: EdgeInsets.zero, code: theme.textTheme.textStyle.copyWith( - backgroundColor: theme.brightness == Brightness.dark - ? CupertinoColors.systemGrey6.darkColor - : CupertinoColors.systemGrey6.color, fontFamily: 'monospace', fontSize: theme.textTheme.textStyle.fontSize! * 0.85, ), @@ -284,7 +280,6 @@ class MarkdownStyleSheet { p: theme.textTheme.bodyMedium, pPadding: EdgeInsets.zero, code: theme.textTheme.bodyMedium!.copyWith( - backgroundColor: theme.cardTheme.color ?? theme.cardColor, fontFamily: 'monospace', fontSize: theme.textTheme.bodyMedium!.fontSize! * 0.85, ), diff --git a/packages/flutter_markdown/test/style_sheet_test.dart b/packages/flutter_markdown/test/style_sheet_test.dart index b48465a415a..861bec039d1 100644 --- a/packages/flutter_markdown/test/style_sheet_test.dart +++ b/packages/flutter_markdown/test/style_sheet_test.dart @@ -62,8 +62,6 @@ void defineTests() { expect( style.code!.fontSize, cTheme.textTheme.textStyle.fontSize! * 0.85); expect(style.code!.fontFamily, 'monospace'); - expect( - style.code!.backgroundColor, CupertinoColors.systemGrey6.darkColor); // H1 expect(style.h1!.color, cTheme.textTheme.textStyle.color); @@ -152,7 +150,6 @@ void defineTests() { expect( style.code!.fontSize, theme.textTheme.bodyMedium!.fontSize! * 0.85); expect(style.code!.fontFamily, 'monospace'); - expect(style.code!.backgroundColor, theme.cardColor); // H1 expect(style.h1, theme.textTheme.headlineSmall); From 1f8fe6606ee3f880139beaec59af84e05cb32141 Mon Sep 17 00:00:00 2001 From: HosamHasanRamadan Date: Tue, 24 Sep 2024 22:05:58 +0300 Subject: [PATCH 2/4] remove `ThemeData.cardColor` from code background color when using material theme --- packages/flutter_markdown/lib/src/style_sheet.dart | 2 ++ packages/flutter_markdown/test/style_sheet_test.dart | 1 + 2 files changed, 3 insertions(+) diff --git a/packages/flutter_markdown/lib/src/style_sheet.dart b/packages/flutter_markdown/lib/src/style_sheet.dart index 478b2a47dc9..0a6b1b430e7 100644 --- a/packages/flutter_markdown/lib/src/style_sheet.dart +++ b/packages/flutter_markdown/lib/src/style_sheet.dart @@ -104,6 +104,7 @@ class MarkdownStyleSheet { p: theme.textTheme.bodyMedium, pPadding: EdgeInsets.zero, code: theme.textTheme.bodyMedium!.copyWith( + backgroundColor: theme.cardTheme.color, fontFamily: 'monospace', fontSize: theme.textTheme.bodyMedium!.fontSize! * 0.85, ), @@ -280,6 +281,7 @@ class MarkdownStyleSheet { p: theme.textTheme.bodyMedium, pPadding: EdgeInsets.zero, code: theme.textTheme.bodyMedium!.copyWith( + backgroundColor: theme.cardTheme.color, fontFamily: 'monospace', fontSize: theme.textTheme.bodyMedium!.fontSize! * 0.85, ), diff --git a/packages/flutter_markdown/test/style_sheet_test.dart b/packages/flutter_markdown/test/style_sheet_test.dart index 861bec039d1..30f071a1594 100644 --- a/packages/flutter_markdown/test/style_sheet_test.dart +++ b/packages/flutter_markdown/test/style_sheet_test.dart @@ -150,6 +150,7 @@ void defineTests() { expect( style.code!.fontSize, theme.textTheme.bodyMedium!.fontSize! * 0.85); expect(style.code!.fontFamily, 'monospace'); + expect(style.code!.backgroundColor, theme.cardTheme.color); // H1 expect(style.h1, theme.textTheme.headlineSmall); From 75cb69a977971166ac96f1b8d82e202a16ed1d95 Mon Sep 17 00:00:00 2001 From: HosamHasanRamadan Date: Wed, 25 Sep 2024 18:18:11 +0300 Subject: [PATCH 3/4] update version and changelog --- packages/flutter_markdown/CHANGELOG.md | 4 ++++ packages/flutter_markdown/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/flutter_markdown/CHANGELOG.md b/packages/flutter_markdown/CHANGELOG.md index ee577fa8209..4f41c7fbf0d 100644 --- a/packages/flutter_markdown/CHANGELOG.md +++ b/packages/flutter_markdown/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.7.3+2 + +* Resolved an issue where code blocks in markdown were not highlighted during selection. + ## 0.7.3+1 * Fixes issue with table column alignments not being respected. diff --git a/packages/flutter_markdown/pubspec.yaml b/packages/flutter_markdown/pubspec.yaml index 78a0ac36cfb..4c2dd8049bd 100644 --- a/packages/flutter_markdown/pubspec.yaml +++ b/packages/flutter_markdown/pubspec.yaml @@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output, formatted with simple Markdown tags. repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22 -version: 0.7.3+1 +version: 0.7.3+2 environment: sdk: ^3.3.0 From ffc4720ed033f35df08a330a2d4733aeeec34b1b Mon Sep 17 00:00:00 2001 From: HosamHasanRamadan Date: Thu, 26 Sep 2024 22:25:45 +0300 Subject: [PATCH 4/4] follow changelog style --- packages/flutter_markdown/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/flutter_markdown/CHANGELOG.md b/packages/flutter_markdown/CHANGELOG.md index 4f41c7fbf0d..b6df88cad18 100644 --- a/packages/flutter_markdown/CHANGELOG.md +++ b/packages/flutter_markdown/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.7.3+2 -* Resolved an issue where code blocks in markdown were not highlighted during selection. +* Resolves an issue where code blocks in markdown were not highlighted during selection. ## 0.7.3+1