diff --git a/CHANGELOG.md b/CHANGELOG.md index d69209f9..3494e510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [4.2.1] +* Refactor font size dropdown. + # [4.2.0] * Ensure selectionOverlay is available for showToolbar. diff --git a/lib/src/translations/toolbar.i18n.dart b/lib/src/translations/toolbar.i18n.dart index 3506903d..56f2197d 100644 --- a/lib/src/translations/toolbar.i18n.dart +++ b/lib/src/translations/toolbar.i18n.dart @@ -22,6 +22,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'en_us': { 'Paste a link': 'Paste a link', @@ -42,6 +43,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'ar': { 'Paste a link': 'نسخ الرابط', @@ -62,6 +64,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'da': { 'Paste a link': 'Indsæt link', @@ -82,6 +85,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'de': { 'Paste a link': 'Link hinzufügen', @@ -103,6 +107,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'fr': { 'Paste a link': 'Coller un lien', @@ -123,6 +128,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'zh_CN': { 'Paste a link': '粘贴链接', @@ -143,6 +149,7 @@ extension Localization on String { 'Resize': '调整大小', 'Width': '宽度', 'Height': '高度', + 'Size': '文字大小', }, 'ko': { 'Paste a link': '링크를 붙여넣어 주세요.', @@ -183,6 +190,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'es': { 'Paste a link': 'Pega un enlace', @@ -204,6 +212,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'tr': { 'Paste a link': 'Bağlantıyı Yapıştır', @@ -224,6 +233,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'uk': { 'Paste a link': 'Вставити посилання', @@ -244,6 +254,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'pt': { 'Paste a link': 'Colar um link', @@ -265,6 +276,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'pl': { 'Paste a link': 'Wklej link', @@ -286,6 +298,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'vi': { 'Paste a link': 'Chèn liên kết', @@ -307,6 +320,7 @@ extension Localization on String { 'Resize': 'Resize', 'Width': 'Width', 'Height': 'Height', + 'Size': 'Size', }, 'ur': { 'Paste a link': 'لنک پیسٹ کریں', @@ -327,6 +341,7 @@ extension Localization on String { 'Resize': 'سائز تبدیل کریں۔', 'Width': 'چوڑائی', 'Height': 'اونچائی', + 'Size': 'Size', }, 'id': { 'Paste a link': 'Tempel tautan', @@ -347,6 +362,7 @@ extension Localization on String { 'Resize': 'Ubah Ukuran', 'Width': 'Lebar', 'Height': 'Tinggi', + 'Size': 'Size', }, 'no': { 'Paste a link': 'Lim inn lenke', @@ -367,6 +383,7 @@ extension Localization on String { 'Resize': 'Endre størrelse', 'Width': 'Bredde', 'Height': 'Høyde', + 'Size': 'Size', }, 'fa': { 'Paste a link': 'جایگذاری لینک', @@ -387,6 +404,7 @@ extension Localization on String { 'Resize': 'تغییر اندازه', 'Width': 'عرض', 'Height': 'طول', + 'Size': 'Size', }, 'hi': { 'Paste a link': 'लिंक पेस्ट करें', @@ -407,6 +425,7 @@ extension Localization on String { 'Resize': 'आकार बदलें', 'Width': 'चौड़ाई', 'Height': 'ऊंचाई', + 'Size': 'Size', }, }; diff --git a/lib/src/widgets/toolbar/quill_font_size_button.dart b/lib/src/widgets/toolbar/quill_font_size_button.dart index fc9b894e..55379265 100644 --- a/lib/src/widgets/toolbar/quill_font_size_button.dart +++ b/lib/src/widgets/toolbar/quill_font_size_button.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import '../../models/documents/attribute.dart'; import '../../models/documents/style.dart'; import '../../models/themes/quill_icon_theme.dart'; +import '../../translations/toolbar.i18n.dart'; import '../../utils/font.dart'; import '../controller.dart'; @@ -37,13 +38,14 @@ class QuillFontSizeButton extends StatefulWidget { } class _QuillFontSizeButtonState extends State { - static const defaultDisplayText = 'Size'; - String _currentValue = defaultDisplayText; + late String _defaultDisplayText; + late String _currentValue; Style get _selectionStyle => widget.controller.getSelectionStyle(); @override void initState() { super.initState(); + _currentValue = _defaultDisplayText = 'Size'.i18n; widget.controller.addListener(_didChangeEditingValue); } @@ -68,11 +70,11 @@ class _QuillFontSizeButtonState extends State { } final attribute = _selectionStyle.attributes[widget.attribute.key]; if (attribute == null) { - setState(() => _currentValue = defaultDisplayText); + setState(() => _currentValue = _defaultDisplayText); return; } final keyName = _getKeyName(attribute.value); - setState(() => _currentValue = keyName ?? defaultDisplayText); + setState(() => _currentValue = keyName ?? _defaultDisplayText); } String? _getKeyName(dynamic value) { @@ -130,7 +132,7 @@ class _QuillFontSizeButtonState extends State { } final keyName = _getKeyName(newValue); setState(() { - _currentValue = keyName ?? defaultDisplayText; + _currentValue = keyName ?? _defaultDisplayText; if (keyName != null) { widget.onSelected(newValue); } diff --git a/pubspec.yaml b/pubspec.yaml index 7eeedb59..cdb5f4d9 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.0 +version: 4.2.1 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill