Add `defaultItemColor`

pull/1182/head
BambinoUA 2 years ago
parent d5b075f876
commit fb819027b6
  1. 10
      lib/src/widgets/toolbar/quill_font_family_button.dart
  2. 7
      lib/src/widgets/toolbar/quill_font_size_button.dart

@ -30,6 +30,7 @@ class QuillFontFamilyButton extends StatefulWidget {
this.overrideTooltipByFontFamily = false, this.overrideTooltipByFontFamily = false,
this.itemHeight, this.itemHeight,
this.itemPadding, this.itemPadding,
this.defaultItemColor = Colors.red,
Key? key, Key? key,
}) : assert(rawItemsMap.length > 0), }) : assert(rawItemsMap.length > 0),
assert(initialValue == null || initialValue.length > 0), assert(initialValue == null || initialValue.length > 0),
@ -57,6 +58,7 @@ class QuillFontFamilyButton extends StatefulWidget {
final bool overrideTooltipByFontFamily; final bool overrideTooltipByFontFamily;
final double? itemHeight; final double? itemHeight;
final EdgeInsets? itemPadding; final EdgeInsets? itemPadding;
final Color? defaultItemColor;
@override @override
_QuillFontFamilyButtonState createState() => _QuillFontFamilyButtonState(); _QuillFontFamilyButtonState createState() => _QuillFontFamilyButtonState();
@ -171,9 +173,11 @@ class _QuillFontFamilyButtonState extends State<QuillFontFamilyButton> {
child: Text( child: Text(
fontFamily.key.toString(), fontFamily.key.toString(),
style: TextStyle( style: TextStyle(
fontFamily: fontFamily: widget.renderFontFamilies ? fontFamily.value : null,
widget.renderFontFamilies ? fontFamily.value : null, color: fontFamily.value == 'Clear'
color: fontFamily.value == 'Clear' ? Colors.red : null), ? widget.defaultItemColor
: null,
),
), ),
), ),
], ],

@ -29,6 +29,7 @@ class QuillFontSizeButton extends StatefulWidget {
this.labelOverflow = TextOverflow.visible, this.labelOverflow = TextOverflow.visible,
this.itemHeight, this.itemHeight,
this.itemPadding, this.itemPadding,
this.defaultItemColor = Colors.red,
Key? key, Key? key,
}) : assert(rawItemsMap.length > 0), }) : assert(rawItemsMap.length > 0),
assert(initialValue == null || initialValue.length > 0), assert(initialValue == null || initialValue.length > 0),
@ -54,6 +55,7 @@ class QuillFontSizeButton extends StatefulWidget {
final TextOverflow labelOverflow; final TextOverflow labelOverflow;
final double? itemHeight; final double? itemHeight;
final EdgeInsets? itemPadding; final EdgeInsets? itemPadding;
final Color? defaultItemColor;
@override @override
_QuillFontSizeButtonState createState() => _QuillFontSizeButtonState(); _QuillFontSizeButtonState createState() => _QuillFontSizeButtonState();
@ -157,8 +159,9 @@ class _QuillFontSizeButtonState extends State<QuillFontSizeButton> {
padding: widget.itemPadding, padding: widget.itemPadding,
child: Text( child: Text(
fontSize.key.toString(), fontSize.key.toString(),
style: style: TextStyle(
TextStyle(color: fontSize.value == '0' ? Colors.red : null), color: fontSize.value == '0' ? widget.defaultItemColor : null,
),
), ),
), ),
], ],

Loading…
Cancel
Save