From 58c0a454a60d7d555872f6e450ee636da7c9840e Mon Sep 17 00:00:00 2001 From: Ellet Date: Sun, 12 Nov 2023 17:49:15 +0300 Subject: [PATCH] Update doc --- README.md | 4 ++-- doc/{CodeIntroduction.md => code_introduction.md} | 0 doc/translation.md | 2 +- example/lib/main.dart | 3 +-- example/lib/pages/home_page.dart | 4 +--- lib/src/models/config/shared_configurations.dart | 5 ++++- lib/src/widgets/utils/localizations.dart | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) rename doc/{CodeIntroduction.md => code_introduction.md} (100%) diff --git a/README.md b/README.md index fedc5662..76b38f75 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ FlutterQuill is a rich text editor and a [Quill] component for [Flutter]. -This library is a WYSIWYG editor built for the modern Android, iOS, web and desktop platforms. Check out our [Youtube Playlist] or [Code Introduction] to take a detailed walkthrough of the code base. You can join our [Slack Group] for discussion. +This library is a WYSIWYG editor built for the modern Android, iOS, web and desktop platforms. Check out our [Youtube Playlist] or [Code Introduction](./doc/code_introduction.md) to take a detailed walkthrough of the code base. You can join our [Slack Group] for discussion. Pub: [FlutterQuill] @@ -339,6 +339,6 @@ You can check the [Todo](./doc/todo.md) list if you want to [Youtube Playlist]: https://youtube.com/playlist?list=PLbhaS_83B97vONkOAWGJrSXWX58et9zZ2 [Slack Group]: https://join.slack.com/t/bulletjournal1024/shared_invite/zt-fys7t9hi-ITVU5PGDen1rNRyCjdcQ2g [Sample Page]: https://github.com/singerdmx/flutter-quill/blob/master/example/lib/pages/home_page.dart -[Code Introduction]: https://github.com/singerdmx/flutter-quill/blob/master/doc/CodeIntroduction.md + [FluentUI]: https://pub.dev/packages/fluent_ui diff --git a/doc/CodeIntroduction.md b/doc/code_introduction.md similarity index 100% rename from doc/CodeIntroduction.md rename to doc/code_introduction.md diff --git a/doc/translation.md b/doc/translation.md index 18d99256..0a6fa3fe 100644 --- a/doc/translation.md +++ b/doc/translation.md @@ -1,6 +1,6 @@ # Translation -The package offers translations for the quill toolbar and editor, it will follow the system locale unless you set your own locale with: +The package offers translations for the quill toolbar and editor, it will follow the locale that is defined in your `WidgetsApp` for example `MaterialApp` which usually follow the system local and it unless you set your own locale with: ```dart QuillProvider( diff --git a/example/lib/main.dart b/example/lib/main.dart index 27936868..6cd05ee1 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -33,9 +33,8 @@ class MyApp extends StatelessWidget { GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, - FlutterQuillLocalizations.delegate, + // FlutterQuillLocalizations.delegate, ], - locale: const Locale('ar'), supportedLocales: FlutterQuillLocalizations.supportedLocales, home: const HomePage(), ); diff --git a/example/lib/pages/home_page.dart b/example/lib/pages/home_page.dart index c617a408..3f294612 100644 --- a/example/lib/pages/home_page.dart +++ b/example/lib/pages/home_page.dart @@ -632,9 +632,7 @@ class _HomePageState extends State { controller: _controller, sharedConfigurations: QuillSharedConfigurations( animationConfigurations: QuillAnimationConfigurations.enableAll(), - locale: const Locale( - 'de', - ), + locale: const Locale('fr'), ), ), child: Column( diff --git a/lib/src/models/config/shared_configurations.dart b/lib/src/models/config/shared_configurations.dart index 98a87e03..edad5404 100644 --- a/lib/src/models/config/shared_configurations.dart +++ b/lib/src/models/config/shared_configurations.dart @@ -31,7 +31,10 @@ class QuillSharedConfigurations extends Equatable { final QuillDialogTheme? dialogTheme; /// The locale to use for the editor and toolbar, defaults to system locale - /// More https://github.com/singerdmx/flutter-quill#translation + /// More https://github.com/singerdmx/flutter-quill/blob/master/doc/translation.md + /// this won't used if you defined the [FlutterQuillLocalizations.delegate] + /// in the `localizationsDelegates` which exists in + /// `MaterialApp` or `WidgetsApp` final Locale? locale; /// To configure which animations you want to be enabled diff --git a/lib/src/widgets/utils/localizations.dart b/lib/src/widgets/utils/localizations.dart index cfec9e5a..29f2061d 100644 --- a/lib/src/widgets/utils/localizations.dart +++ b/lib/src/widgets/utils/localizations.dart @@ -19,7 +19,7 @@ class FlutterQuillLocalizationsWidget extends StatelessWidget { return child; } return Localizations( - locale: context.quillSharedConfigurations?.locale ?? + locale: context.requireQuillSharedConfigurations.locale ?? Localizations.localeOf(context), delegates: FlutterQuillLocalizations.localizationsDelegates, child: child,