|
|
|
@ -11,7 +11,8 @@ import '../base_toolbar.dart'; |
|
|
|
|
class QuillToolbarFontFamilyButton extends StatefulWidget { |
|
|
|
|
QuillToolbarFontFamilyButton({ |
|
|
|
|
required this.controller, |
|
|
|
|
required this.defaultDisplayText, |
|
|
|
|
@Deprecated('Please use the default display text from the options') |
|
|
|
|
this.defaultDisplayText, |
|
|
|
|
this.options = const QuillToolbarFontFamilyButtonOptions(), |
|
|
|
|
super.key, |
|
|
|
|
}) : assert(options.rawItemsMap?.isNotEmpty ?? (true)), |
|
|
|
@ -21,8 +22,7 @@ class QuillToolbarFontFamilyButton extends StatefulWidget { |
|
|
|
|
|
|
|
|
|
final QuillToolbarFontFamilyButtonOptions options; |
|
|
|
|
|
|
|
|
|
@Deprecated('Please use the default display text from the options') |
|
|
|
|
final String defaultDisplayText; |
|
|
|
|
final String? defaultDisplayText; |
|
|
|
|
|
|
|
|
|
/// Since we can't get the state from the instace of the widget for comparing |
|
|
|
|
/// in [didUpdateWidget] then we will have to store reference here |
|
|
|
@ -50,10 +50,15 @@ class QuillToolbarFontFamilyButtonState |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void _initState() { |
|
|
|
|
_currentValue = _defaultDisplayText; |
|
|
|
|
// controller.addListener(_didChangeEditingValue); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void didChangeDependencies() { |
|
|
|
|
super.didChangeDependencies(); |
|
|
|
|
_currentValue = _defaultDisplayText; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @override |
|
|
|
|
// void dispose() { |
|
|
|
|
// controller.removeListener(_didChangeEditingValue); |
|
|
|
@ -63,8 +68,8 @@ class QuillToolbarFontFamilyButtonState |
|
|
|
|
String get _defaultDisplayText { |
|
|
|
|
return options.initialValue ?? |
|
|
|
|
widget.options.defaultDisplayText ?? |
|
|
|
|
// ignore: deprecated_member_use_from_same_package |
|
|
|
|
widget.defaultDisplayText; |
|
|
|
|
widget.defaultDisplayText ?? |
|
|
|
|
context.loc.font; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// @override |
|
|
|
@ -169,12 +174,7 @@ class QuillToolbarFontFamilyButtonState |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return ConstrainedBox( |
|
|
|
|
constraints: BoxConstraints.tightFor( |
|
|
|
|
height: iconSize * 1.81, |
|
|
|
|
width: options.width, |
|
|
|
|
), |
|
|
|
|
child: UtilityWidgets.maybeWidget( |
|
|
|
|
return UtilityWidgets.maybeWidget( |
|
|
|
|
enabled: tooltip.isNotEmpty || options.overrideTooltipByFontFamily, |
|
|
|
|
wrapper: (child) { |
|
|
|
|
var effectiveTooltip = tooltip; |
|
|
|
@ -209,7 +209,6 @@ class QuillToolbarFontFamilyButtonState |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|