From 80861b46aae5b90f2d3a90cf7845e1738a489ace Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:39:23 +0100 Subject: [PATCH] Fix getting of `QuillStyles` --- .../buttons/dropdown_header_style.dart | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 1abb91ca..cd7e5d6f 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -100,8 +100,16 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } @override - void didChangeDependencies() { - super.didChangeDependencies(); + void initState() { + super.initState(); + controller.addListener(_didChangeEditingValue); + _selectedAttribute = _getHeaderValue(); + } + + @override + Widget build(BuildContext context) { + assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); + if (_headerTextStyles == null) { final defaultStyles = QuillStyles.getStyles(context, false); _headerTextStyles = { @@ -113,18 +121,6 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Attribute.h6: defaultStyles.h6!.style, }; } - } - - @override - void initState() { - super.initState(); - controller.addListener(_didChangeEditingValue); - _selectedAttribute = _getHeaderValue(); - } - - @override - Widget build(BuildContext context) { - assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); final baseButtonConfigurations = context.requireQuillToolbarBaseButtonOptions;