|
|
@ -26,6 +26,11 @@ class QuillFontFamilyButton extends StatefulWidget { |
|
|
|
this.width, |
|
|
|
this.width, |
|
|
|
this.renderFontFamilies = true, |
|
|
|
this.renderFontFamilies = true, |
|
|
|
this.alignment, |
|
|
|
this.alignment, |
|
|
|
|
|
|
|
this.initialValue, |
|
|
|
|
|
|
|
this.labelOverflow = TextOverflow.visible, |
|
|
|
|
|
|
|
this.overrideTooltipByFontFamily = false, |
|
|
|
|
|
|
|
this.itemHeight, |
|
|
|
|
|
|
|
this.itemPadding, |
|
|
|
Key? key, |
|
|
|
Key? key, |
|
|
|
}) : super(key: key); |
|
|
|
}) : super(key: key); |
|
|
|
|
|
|
|
|
|
|
@ -47,6 +52,11 @@ class QuillFontFamilyButton extends StatefulWidget { |
|
|
|
final double? width; |
|
|
|
final double? width; |
|
|
|
final bool renderFontFamilies; |
|
|
|
final bool renderFontFamilies; |
|
|
|
final AlignmentGeometry? alignment; |
|
|
|
final AlignmentGeometry? alignment; |
|
|
|
|
|
|
|
final String? initialValue; |
|
|
|
|
|
|
|
final TextOverflow labelOverflow; |
|
|
|
|
|
|
|
final bool overrideTooltipByFontFamily; |
|
|
|
|
|
|
|
final double? itemHeight; |
|
|
|
|
|
|
|
final EdgeInsets? itemPadding; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
_QuillFontFamilyButtonState createState() => _QuillFontFamilyButtonState(); |
|
|
|
_QuillFontFamilyButtonState createState() => _QuillFontFamilyButtonState(); |
|
|
@ -60,7 +70,7 @@ class _QuillFontFamilyButtonState extends State<QuillFontFamilyButton> { |
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
_currentValue = _defaultDisplayText = 'Font'.i18n; |
|
|
|
_currentValue = _defaultDisplayText = widget.initialValue ?? 'Font'.i18n; |
|
|
|
widget.controller.addListener(_didChangeEditingValue); |
|
|
|
widget.controller.addListener(_didChangeEditingValue); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -146,6 +156,8 @@ class _QuillFontFamilyButtonState extends State<QuillFontFamilyButton> { |
|
|
|
PopupMenuItem<String>( |
|
|
|
PopupMenuItem<String>( |
|
|
|
key: ValueKey(fontFamily.key), |
|
|
|
key: ValueKey(fontFamily.key), |
|
|
|
value: fontFamily.value, |
|
|
|
value: fontFamily.value, |
|
|
|
|
|
|
|
height: widget.itemHeight ?? kMinInteractiveDimension, |
|
|
|
|
|
|
|
padding: widget.itemPadding, |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
fontFamily.key.toString(), |
|
|
|
fontFamily.key.toString(), |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
@ -181,14 +193,24 @@ class _QuillFontFamilyButtonState extends State<QuillFontFamilyButton> { |
|
|
|
alignment: widget.alignment ?? Alignment.center, |
|
|
|
alignment: widget.alignment ?? Alignment.center, |
|
|
|
padding: widget.padding ?? const EdgeInsets.fromLTRB(10, 0, 0, 0), |
|
|
|
padding: widget.padding ?? const EdgeInsets.fromLTRB(10, 0, 0, 0), |
|
|
|
child: Row( |
|
|
|
child: Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text(_currentValue, |
|
|
|
Expanded( |
|
|
|
style: widget.style ?? |
|
|
|
child: UtilityWidgets.maybeWidget( |
|
|
|
TextStyle( |
|
|
|
enabled: widget.overrideTooltipByFontFamily, |
|
|
|
fontSize: widget.iconSize / 1.15, |
|
|
|
wrapper: (child) => Tooltip(message: _currentValue, child: child), |
|
|
|
color: widget.iconTheme?.iconUnselectedColor ?? |
|
|
|
child: Text( |
|
|
|
theme.iconTheme.color)), |
|
|
|
_currentValue, |
|
|
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
|
|
overflow: widget.labelOverflow, |
|
|
|
|
|
|
|
style: widget.style ?? |
|
|
|
|
|
|
|
TextStyle( |
|
|
|
|
|
|
|
fontSize: widget.iconSize / 1.15, |
|
|
|
|
|
|
|
color: widget.iconTheme?.iconUnselectedColor ?? |
|
|
|
|
|
|
|
theme.iconTheme.color), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
const SizedBox(width: 3), |
|
|
|
const SizedBox(width: 3), |
|
|
|
Icon(Icons.arrow_drop_down, |
|
|
|
Icon(Icons.arrow_drop_down, |
|
|
|
size: widget.iconSize / 1.15, |
|
|
|
size: widget.iconSize / 1.15, |
|
|
|