Dropdown QuillToolbarSelectHeaderStyleButton

pull/1566/head
Ellet 1 year ago
parent 08e55abb84
commit 913c33cc80
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 24
      lib/src/l10n/generated/quill_localizations.dart
  2. 12
      lib/src/l10n/generated/quill_localizations_ar.dart
  3. 12
      lib/src/l10n/generated/quill_localizations_bg.dart
  4. 12
      lib/src/l10n/generated/quill_localizations_bn.dart
  5. 12
      lib/src/l10n/generated/quill_localizations_cs.dart
  6. 12
      lib/src/l10n/generated/quill_localizations_da.dart
  7. 12
      lib/src/l10n/generated/quill_localizations_de.dart
  8. 12
      lib/src/l10n/generated/quill_localizations_en.dart
  9. 12
      lib/src/l10n/generated/quill_localizations_es.dart
  10. 12
      lib/src/l10n/generated/quill_localizations_fa.dart
  11. 12
      lib/src/l10n/generated/quill_localizations_fr.dart
  12. 12
      lib/src/l10n/generated/quill_localizations_he.dart
  13. 12
      lib/src/l10n/generated/quill_localizations_hi.dart
  14. 12
      lib/src/l10n/generated/quill_localizations_id.dart
  15. 12
      lib/src/l10n/generated/quill_localizations_it.dart
  16. 12
      lib/src/l10n/generated/quill_localizations_ja.dart
  17. 12
      lib/src/l10n/generated/quill_localizations_ko.dart
  18. 12
      lib/src/l10n/generated/quill_localizations_ms.dart
  19. 12
      lib/src/l10n/generated/quill_localizations_nl.dart
  20. 12
      lib/src/l10n/generated/quill_localizations_no.dart
  21. 12
      lib/src/l10n/generated/quill_localizations_pl.dart
  22. 12
      lib/src/l10n/generated/quill_localizations_pt.dart
  23. 12
      lib/src/l10n/generated/quill_localizations_ru.dart
  24. 12
      lib/src/l10n/generated/quill_localizations_sr.dart
  25. 12
      lib/src/l10n/generated/quill_localizations_sw.dart
  26. 12
      lib/src/l10n/generated/quill_localizations_tk.dart
  27. 12
      lib/src/l10n/generated/quill_localizations_tr.dart
  28. 12
      lib/src/l10n/generated/quill_localizations_uk.dart
  29. 12
      lib/src/l10n/generated/quill_localizations_ur.dart
  30. 12
      lib/src/l10n/generated/quill_localizations_vi.dart
  31. 12
      lib/src/l10n/generated/quill_localizations_zh.dart
  32. 4
      lib/src/l10n/quill_en.arb
  33. 132
      lib/src/l10n/untranslated.json
  34. 2
      lib/src/widgets/toolbar/base_toolbar.dart
  35. 7
      lib/src/widgets/toolbar/buttons/color/color_button.dart
  36. 278
      lib/src/widgets/toolbar/buttons/select_header_style_button.dart
  37. 235
      lib/src/widgets/toolbar/buttons/select_header_style_buttons.dart
  38. 2
      lib/src/widgets/toolbar/buttons/toggle_check_list_button.dart
  39. 3
      lib/src/widgets/toolbar/toolbar.dart

@ -421,6 +421,30 @@ abstract class FlutterQuillLocalizations {
/// **'Header style'**
String get headerStyle;
/// No description provided for @normal.
///
/// In en, this message translates to:
/// **'Normal'**
String get normal;
/// No description provided for @heading1.
///
/// In en, this message translates to:
/// **'Heading 1'**
String get heading1;
/// No description provided for @heading2.
///
/// In en, this message translates to:
/// **'Heading 2'**
String get heading2;
/// No description provided for @heading3.
///
/// In en, this message translates to:
/// **'Heading 3'**
String get heading3;
/// No description provided for @numberedList.
///
/// In en, this message translates to:

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsAr extends FlutterQuillLocalizations {
@override
String get headerStyle => 'ستايل العنوان';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'قائمة مرقمة';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsBg extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Стил на заглавието';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Номериран списък';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsBn extends FlutterQuillLocalizations {
@override
String get headerStyle => 'র সইল';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'ত তি';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsCs extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Styl záhlaví';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Číslovaný seznam';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsDa extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsDe extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Überschrift-Stil';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Nummerierte Liste';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsEn extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsEs extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsFa extends FlutterQuillLocalizations {
@override
String get headerStyle => 'سبک هدر';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'لیست شمارهدار';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsFr extends FlutterQuillLocalizations {
@override
String get headerStyle => "Style d'en-tête";
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Liste numérotée';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsHe extends FlutterQuillLocalizations {
@override
String get headerStyle => 'סגנון הכותרת';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'רשימה ממוספרת';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsHi extends FlutterQuillLocalizations {
@override
String get headerStyle => 'डर श';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'बदध स';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsId extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Gaya Header';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Daftar Bernomor';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsIt extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Stile intestazione';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Elenco numerato';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsJa extends FlutterQuillLocalizations {
@override
String get headerStyle => 'タイトルスタイル';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => '順序付きリスト';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsKo extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsMs extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsNl extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsNo extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Overskriftsstil';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Nummerert liste';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsPl extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsPt extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsRu extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Header style';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numbered list';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsSr extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Stil zaglavlja';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numerisana lista';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsSw extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Mtindo wa Mada';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Orodha ya Nambari';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsTk extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Sözbaşy stili';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Sanly sanaw';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsTr extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Başlık Stili';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Numaralı Liste';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsUk extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Стиль заголовка';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Нумерований список';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsUr extends FlutterQuillLocalizations {
@override
String get headerStyle => 'ہیڈر کا انداز';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'مرقم فہرست';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsVi extends FlutterQuillLocalizations {
@override
String get headerStyle => 'Kiểu tiêu đề';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => 'Danh sách có số';

@ -136,6 +136,18 @@ class FlutterQuillLocalizationsZh extends FlutterQuillLocalizations {
@override
String get headerStyle => '标题样式';
@override
String get normal => 'Normal';
@override
String get heading1 => 'Heading 1';
@override
String get heading2 => 'Heading 2';
@override
String get heading3 => 'Heading 3';
@override
String get numberedList => '编号列表';

@ -44,6 +44,10 @@
"justifyWinWidth": "Justify win width",
"textDirection": "Text direction",
"headerStyle": "Header style",
"normal": "Normal",
"heading1": "Heading 1",
"heading2": "Heading 2",
"heading3": "Heading 3",
"numberedList": "Numbered list",
"bulletList": "Bullet list",
"checkedList": "Checked list",

@ -1,5 +1,9 @@
{
"ar": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -9,6 +13,10 @@
],
"bg": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -18,6 +26,10 @@
],
"bn": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -27,6 +39,10 @@
],
"cs": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -36,6 +52,10 @@
],
"da": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -45,6 +65,10 @@
],
"de": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -54,6 +78,10 @@
],
"en_US": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -63,6 +91,10 @@
],
"es": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -72,6 +104,10 @@
],
"fa": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -81,6 +117,10 @@
],
"fr": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -90,6 +130,10 @@
],
"he": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -99,6 +143,10 @@
],
"hi": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -108,6 +156,10 @@
],
"id": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -117,6 +169,10 @@
],
"it": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -126,6 +182,10 @@
],
"ja": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -135,6 +195,10 @@
],
"ko": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -144,6 +208,10 @@
],
"ms": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -153,6 +221,10 @@
],
"nl": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -162,6 +234,10 @@
],
"no": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -171,6 +247,10 @@
],
"pl": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -180,6 +260,10 @@
],
"pt": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -189,6 +273,10 @@
],
"pt_BR": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -198,6 +286,10 @@
],
"ru": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -207,6 +299,10 @@
],
"sr": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -216,6 +312,10 @@
],
"sw": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -225,6 +325,10 @@
],
"tk": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -234,6 +338,10 @@
],
"tr": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -243,6 +351,10 @@
],
"uk": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -252,6 +364,10 @@
],
"ur": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -261,6 +377,10 @@
],
"vi": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -270,6 +390,10 @@
],
"zh": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -279,6 +403,10 @@
],
"zh_CN": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",
@ -288,6 +416,10 @@
],
"zh_HK": [
"normal",
"heading1",
"heading2",
"heading3",
"pickAPhotoFromYourGallery",
"takeAPhotoUsingYourCamera",
"pasteAPhotoUsingALink",

@ -20,7 +20,7 @@ export 'buttons/link_style_button.dart';
export 'buttons/quill_icon_button.dart';
export 'buttons/search/search_button.dart';
export 'buttons/select_alignment_button.dart';
export 'buttons/select_header_style_button.dart';
export 'buttons/select_header_style_buttons.dart';
export 'buttons/toggle_check_list_button.dart';
export 'buttons/toggle_style_button.dart';

@ -193,16 +193,13 @@ class QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
);
}
return QuillToolbarIconButton(
return IconButton(
tooltip: tooltip,
size: iconSize * iconButtonFactor,
iconSize: iconSize * iconButtonFactor,
icon: Icon(iconData,
size: iconSize,
color: widget.isBackground ? iconColorBackground : iconColor),
// fillColor: widget.isBackground ? fillColorBackground : fillColor,
isFilled: false,
onPressed: _showColorPicker,
afterPressed: afterButtonPressed,
);
}

@ -1,17 +1,19 @@
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import '../../../../extensions.dart';
import '../../../extensions/quill_provider.dart';
import '../../../l10n/extensions/localizations.dart';
import '../../../../translations.dart';
import '../../../models/config/toolbar/buttons/select_header_style.dart';
import '../../../models/documents/attribute.dart';
import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../base_toolbar.dart';
class QuillToolbarSelectHeaderStyleButtons extends StatefulWidget {
const QuillToolbarSelectHeaderStyleButtons({
enum QuillToolbarSelectHeaderStyleButtonOptions {
normal,
headingOne,
headingTwo,
headingThree,
}
class QuillToolbarSelectHeaderStyleButton extends StatefulWidget {
const QuillToolbarSelectHeaderStyleButton({
required this.controller,
required this.options,
super.key,
@ -21,215 +23,93 @@ class QuillToolbarSelectHeaderStyleButtons extends StatefulWidget {
final QuillToolbarSelectHeaderStyleButtonsOptions options;
@override
QuillToolbarSelectHeaderStyleButtonsState createState() =>
QuillToolbarSelectHeaderStyleButtonsState();
State<QuillToolbarSelectHeaderStyleButton> createState() =>
_QuillToolbarSelectHeaderStyleButtonState();
}
class QuillToolbarSelectHeaderStyleButtonsState
extends State<QuillToolbarSelectHeaderStyleButtons> {
Attribute? _selectedAttribute;
Style get _selectionStyle => controller.getSelectionStyle();
final _valueToText = <Attribute, String>{
Attribute.header: 'N',
Attribute.h1: 'H1',
Attribute.h2: 'H2',
Attribute.h3: 'H3',
};
class _QuillToolbarSelectHeaderStyleButtonState
extends State<QuillToolbarSelectHeaderStyleButton> {
var _selectedItem = QuillToolbarSelectHeaderStyleButtonOptions.normal;
@override
void initState() {
super.initState();
setState(() {
_selectedAttribute = _getHeaderValue();
});
controller.addListener(_didChangeEditingValue);
}
QuillToolbarSelectHeaderStyleButtonsOptions get options {
return widget.options;
}
QuillController get controller {
return widget.controller;
}
double get iconSize {
final baseFontSize = baseButtonExtraOptions.globalIconSize;
final iconSize = options.iconSize;
return iconSize ?? baseFontSize;
}
double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor;
}
VoidCallback? get afterButtonPressed {
return options.afterButtonPressed ??
baseButtonExtraOptions.afterButtonPressed;
}
QuillIconTheme? get iconTheme {
return options.iconTheme ?? baseButtonExtraOptions.iconTheme;
}
QuillToolbarBaseButtonOptions get baseButtonExtraOptions {
return context.requireQuillToolbarBaseButtonOptions;
}
String get tooltip {
return options.tooltip ??
baseButtonExtraOptions.tooltip ??
context.loc.headerStyle;
}
Axis get axis {
return options.axis ??
context.quillToolbarConfigurations?.axis ??
context.quillBaseToolbarConfigurations?.axis ??
(throw ArgumentError(
'There is no default value for the Axis of the toolbar'));
}
void _sharedOnPressed(Attribute attribute) {
final attribute0 =
_selectedAttribute == attribute ? Attribute.header : attribute;
controller.formatSelection(attribute0);
afterButtonPressed?.call();
}
List<Attribute> get _attrbuites {
return options.attributes ??
const [
Attribute.header,
Attribute.h1,
Attribute.h2,
Attribute.h3,
];
}
@override
Widget build(BuildContext context) {
assert(
_attrbuites.every(
(element) => _valueToText.keys.contains(element),
),
'All attributes must be one of them: header, h1, h2 or h3',
);
final style = TextStyle(
fontWeight: FontWeight.w600,
fontSize: iconSize * 0.7,
);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions.childBuilder;
final children = _attrbuites.map((attribute) {
if (childBuilder != null) {
return childBuilder(
QuillToolbarSelectHeaderStyleButtonsOptions(
afterButtonPressed: afterButtonPressed,
attributes: _attrbuites,
axis: axis,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarSelectHeaderStyleButtonExtraOptions(
controller: controller,
context: context,
onPressed: () => _sharedOnPressed(attribute),
),
);
}
final theme = Theme.of(context);
final isSelected = _selectedAttribute == attribute;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0),
child: ConstrainedBox(
constraints: BoxConstraints.tightFor(
width: iconSize * iconButtonFactor,
height: iconSize * iconButtonFactor,
),
child: UtilityWidgets.maybeTooltip(
message: tooltip,
child: RawMaterialButton(
hoverElevation: 0,
highlightElevation: 0,
elevation: 0,
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(iconTheme?.borderRadius ?? 2)),
fillColor: isSelected
? (iconTheme?.iconSelectedFillColor ?? theme.primaryColor)
: (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor),
onPressed: () => _sharedOnPressed(attribute),
child: Text(
_valueToText[attribute] ??
(throw ArgumentError.notNull(
'attrbuite',
)),
style: style.copyWith(
color: isSelected
? (iconTheme?.iconSelectedColor ??
theme.primaryIconTheme.color)
: (iconTheme?.iconUnselectedColor ??
theme.iconTheme.color),
),
),
),
),
),
);
}).toList();
return axis == Axis.horizontal
? Row(
mainAxisSize: MainAxisSize.min,
children: children,
)
: Column(
mainAxisSize: MainAxisSize.min,
children: children,
);
widget.controller.addListener(_didChangeEditingValue);
}
void _didChangeEditingValue() {
setState(() {
_selectedAttribute = _getHeaderValue();
_selectedItem = _getOptionsItemByAttribute(_getHeaderValue());
});
}
Attribute<dynamic> _getHeaderValue() {
final attr = controller.toolbarButtonToggler[Attribute.header.key];
final attr = widget.controller.toolbarButtonToggler[Attribute.header.key];
if (attr != null) {
// checkbox tapping causes controller.selection to go to offset 0
controller.toolbarButtonToggler.remove(Attribute.header.key);
widget.controller.toolbarButtonToggler.remove(Attribute.header.key);
return attr;
}
return _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
}
@override
void didUpdateWidget(
covariant QuillToolbarSelectHeaderStyleButtons oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.controller != controller) {
oldWidget.controller.removeListener(_didChangeEditingValue);
controller.addListener(_didChangeEditingValue);
_selectedAttribute = _getHeaderValue();
}
return widget.controller
.getSelectionStyle()
.attributes[Attribute.header.key] ??
Attribute.header;
}
String _label(QuillToolbarSelectHeaderStyleButtonOptions value) {
final label = switch (value) {
QuillToolbarSelectHeaderStyleButtonOptions.normal => context.loc.normal,
QuillToolbarSelectHeaderStyleButtonOptions.headingOne =>
context.loc.heading1,
QuillToolbarSelectHeaderStyleButtonOptions.headingTwo =>
context.loc.heading2,
QuillToolbarSelectHeaderStyleButtonOptions.headingThree =>
context.loc.heading3,
};
return label;
}
Attribute<dynamic>? getAttributeByOptionsItem(
QuillToolbarSelectHeaderStyleButtonOptions option) {
return switch (option) {
QuillToolbarSelectHeaderStyleButtonOptions.normal => Attribute.header,
QuillToolbarSelectHeaderStyleButtonOptions.headingOne => Attribute.h1,
QuillToolbarSelectHeaderStyleButtonOptions.headingTwo => Attribute.h2,
QuillToolbarSelectHeaderStyleButtonOptions.headingThree => Attribute.h3,
};
}
QuillToolbarSelectHeaderStyleButtonOptions _getOptionsItemByAttribute(
Attribute<dynamic>? attribute) {
return switch (attribute) {
Attribute.h1 => QuillToolbarSelectHeaderStyleButtonOptions.headingOne,
Attribute.h2 => QuillToolbarSelectHeaderStyleButtonOptions.headingTwo,
Attribute.h2 => QuillToolbarSelectHeaderStyleButtonOptions.headingThree,
Attribute() => QuillToolbarSelectHeaderStyleButtonOptions.normal,
null => QuillToolbarSelectHeaderStyleButtonOptions.normal,
};
}
@override
void dispose() {
controller.removeListener(_didChangeEditingValue);
super.dispose();
Widget build(BuildContext context) {
return DropdownButton<QuillToolbarSelectHeaderStyleButtonOptions>(
value: _selectedItem,
items: QuillToolbarSelectHeaderStyleButtonOptions.values
.map(
(e) => DropdownMenuItem<QuillToolbarSelectHeaderStyleButtonOptions>(
value: e,
child: Text(_label(e)),
onTap: () {
widget.controller.formatSelection(getAttributeByOptionsItem(e));
},
),
)
.toList(),
onChanged: (newItem) {
if (newItem == null) {
return;
}
setState(() => _selectedItem = newItem);
},
);
}
}

@ -0,0 +1,235 @@
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import '../../../../extensions.dart';
import '../../../extensions/quill_provider.dart';
import '../../../l10n/extensions/localizations.dart';
import '../../../models/documents/attribute.dart';
import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../controller.dart';
import '../base_toolbar.dart';
class QuillToolbarSelectHeaderStyleButtons extends StatefulWidget {
const QuillToolbarSelectHeaderStyleButtons({
required this.controller,
required this.options,
super.key,
});
final QuillController controller;
final QuillToolbarSelectHeaderStyleButtonsOptions options;
@override
QuillToolbarSelectHeaderStyleButtonsState createState() =>
QuillToolbarSelectHeaderStyleButtonsState();
}
class QuillToolbarSelectHeaderStyleButtonsState
extends State<QuillToolbarSelectHeaderStyleButtons> {
Attribute? _selectedAttribute;
Style get _selectionStyle => controller.getSelectionStyle();
final _valueToText = <Attribute, String>{
Attribute.header: 'N',
Attribute.h1: 'H1',
Attribute.h2: 'H2',
Attribute.h3: 'H3',
};
@override
void initState() {
super.initState();
setState(() {
_selectedAttribute = _getHeaderValue();
});
controller.addListener(_didChangeEditingValue);
}
QuillToolbarSelectHeaderStyleButtonsOptions get options {
return widget.options;
}
QuillController get controller {
return widget.controller;
}
double get iconSize {
final baseFontSize = baseButtonExtraOptions.globalIconSize;
final iconSize = options.iconSize;
return iconSize ?? baseFontSize;
}
double get iconButtonFactor {
final baseIconFactor = baseButtonExtraOptions.globalIconButtonFactor;
final iconButtonFactor = options.iconButtonFactor;
return iconButtonFactor ?? baseIconFactor;
}
VoidCallback? get afterButtonPressed {
return options.afterButtonPressed ??
baseButtonExtraOptions.afterButtonPressed;
}
QuillIconTheme? get iconTheme {
return options.iconTheme ?? baseButtonExtraOptions.iconTheme;
}
QuillToolbarBaseButtonOptions get baseButtonExtraOptions {
return context.requireQuillToolbarBaseButtonOptions;
}
String get tooltip {
return options.tooltip ??
baseButtonExtraOptions.tooltip ??
context.loc.headerStyle;
}
Axis get axis {
return options.axis ??
context.quillToolbarConfigurations?.axis ??
context.quillBaseToolbarConfigurations?.axis ??
(throw ArgumentError(
'There is no default value for the Axis of the toolbar'));
}
void _sharedOnPressed(Attribute attribute) {
final attribute0 =
_selectedAttribute == attribute ? Attribute.header : attribute;
controller.formatSelection(attribute0);
afterButtonPressed?.call();
}
List<Attribute> get _attrbuites {
return options.attributes ??
const [
Attribute.header,
Attribute.h1,
Attribute.h2,
Attribute.h3,
];
}
@override
Widget build(BuildContext context) {
assert(
_attrbuites.every(
(element) => _valueToText.keys.contains(element),
),
'All attributes must be one of them: header, h1, h2 or h3',
);
final style = TextStyle(
fontWeight: FontWeight.w600,
fontSize: iconSize * 0.7,
);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions.childBuilder;
final children = _attrbuites.map((attribute) {
if (childBuilder != null) {
return childBuilder(
QuillToolbarSelectHeaderStyleButtonsOptions(
afterButtonPressed: afterButtonPressed,
attributes: _attrbuites,
axis: axis,
iconSize: iconSize,
iconButtonFactor: iconButtonFactor,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarSelectHeaderStyleButtonExtraOptions(
controller: controller,
context: context,
onPressed: () => _sharedOnPressed(attribute),
),
);
}
final theme = Theme.of(context);
final isSelected = _selectedAttribute == attribute;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0),
child: ConstrainedBox(
constraints: BoxConstraints.tightFor(
width: iconSize * iconButtonFactor,
height: iconSize * iconButtonFactor,
),
child: UtilityWidgets.maybeTooltip(
message: tooltip,
child: RawMaterialButton(
hoverElevation: 0,
highlightElevation: 0,
elevation: 0,
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(iconTheme?.borderRadius ?? 2)),
fillColor: isSelected
? (iconTheme?.iconSelectedFillColor ?? theme.primaryColor)
: (iconTheme?.iconUnselectedFillColor ?? theme.canvasColor),
onPressed: () => _sharedOnPressed(attribute),
child: Text(
_valueToText[attribute] ??
(throw ArgumentError.notNull(
'attrbuite',
)),
style: style.copyWith(
color: isSelected
? (iconTheme?.iconSelectedColor ??
theme.primaryIconTheme.color)
: (iconTheme?.iconUnselectedColor ??
theme.iconTheme.color),
),
),
),
),
),
);
}).toList();
return axis == Axis.horizontal
? Row(
mainAxisSize: MainAxisSize.min,
children: children,
)
: Column(
mainAxisSize: MainAxisSize.min,
children: children,
);
}
void _didChangeEditingValue() {
setState(() {
_selectedAttribute = _getHeaderValue();
});
}
Attribute<dynamic> _getHeaderValue() {
final attr = controller.toolbarButtonToggler[Attribute.header.key];
if (attr != null) {
// checkbox tapping causes controller.selection to go to offset 0
controller.toolbarButtonToggler.remove(Attribute.header.key);
return attr;
}
return _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
}
@override
void didUpdateWidget(
covariant QuillToolbarSelectHeaderStyleButtons oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.controller != controller) {
oldWidget.controller.removeListener(_didChangeEditingValue);
controller.addListener(_didChangeEditingValue);
_selectedAttribute = _getHeaderValue();
}
}
@override
void dispose() {
controller.removeListener(_didChangeEditingValue);
super.dispose();
}
}

@ -9,7 +9,7 @@ import '../../../models/documents/style.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/widgets.dart';
import '../../controller.dart';
import 'toggle_style.dart';
import 'toggle_style_button.dart';
class QuillToolbarToggleCheckListButton extends StatefulWidget {
const QuillToolbarToggleCheckListButton({

@ -6,6 +6,7 @@ import '../../models/config/toolbar/base_toolbar_configurations.dart';
import '../../models/documents/attribute.dart';
import '../utils/provider.dart';
import 'base_toolbar.dart';
import 'buttons/select_header_style_button.dart';
class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
const QuillToolbar({
@ -286,7 +287,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
space: configurations.sectionDividerSpace,
),
if (configurations.showHeaderStyle) ...[
QuillToolbarSelectHeaderStyleButtons(
QuillToolbarSelectHeaderStyleButton(
controller: toolbarConfigurations
.buttonOptions.selectHeaderStyleButtons.controller ??
globalController,

Loading…
Cancel
Save