diff --git a/CHANGELOG.md b/CHANGELOG.md index d0b85d9f..73786105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [4.2.3] +* Ignore color:inherit and convert double to int for level. + # [4.2.2] * Add clear option to font size dropdown. diff --git a/lib/src/utils/color.dart b/lib/src/utils/color.dart index 8ee1d1b0..3dc5d07a 100644 --- a/lib/src/utils/color.dart +++ b/lib/src/utils/color.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -Color stringToColor(String? s) { +Color stringToColor(String? s, [Color? originalColor]) { switch (s) { case 'transparent': return Colors.transparent; @@ -114,7 +114,7 @@ Color stringToColor(String? s) { // TODO: take care of "color": "inherit" if (s.startsWith('inherit')) { - return Colors.black; + return originalColor ?? Colors.black; } if (!s.startsWith('#')) { diff --git a/lib/src/widgets/text_line.dart b/lib/src/widgets/text_line.dart index 3a4e6092..ed2c8f10 100644 --- a/lib/src/widgets/text_line.dart +++ b/lib/src/widgets/text_line.dart @@ -308,7 +308,7 @@ class _TextLineState extends State { if (k == Attribute.underline.key || k == Attribute.strikeThrough.key) { var textColor = defaultStyles.color; if (color?.value is String) { - textColor = stringToColor(color?.value); + textColor = stringToColor(color?.value, textColor); } res = _merge(res.copyWith(decorationColor: textColor), s!.copyWith(decorationColor: textColor)); diff --git a/pubspec.yaml b/pubspec.yaml index 9a2572ec..5bab3208 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 4.2.2 +version: 4.2.3 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill