Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: search dialog throw an exception due to missing FlutterQuillLocalizations.delegate in the editor #1938

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/l10n/extensions/localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension LocalizationsExt on BuildContext {
' required, please make sure you wrapping the current widget with '
'FlutterQuillLocalizationsWidget or add '
'FlutterQuillLocalizations.delegate to the localizationsDelegates '
'in your App widget, please consider report this in GitHub as a bug',
'in your App widget, please consider reporting this as a bug',
));
}
}
5 changes: 4 additions & 1 deletion lib/src/l10n/widgets/localizations.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

import '../../extensions/quill_configurations_ext.dart';
import '../extensions/localizations.dart';

/// A widget that check if [FlutterQuillLocalizations.delegate] is provided
/// in the widgets app (e.g, [MaterialApp] or [WidgetsApp]).
///
/// If not, will provide in the [child] to access it in the widget tree.
class FlutterQuillLocalizationsWidget extends StatelessWidget {
const FlutterQuillLocalizationsWidget({
required this.child,
Expand Down
7 changes: 5 additions & 2 deletions lib/src/widgets/raw_editor/raw_editor_actions.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import '../../../translations.dart';
import '../../models/documents/attribute.dart';
import '../editor/editor.dart';
import '../toolbar/buttons/link_style2_button.dart';
Expand Down Expand Up @@ -460,8 +461,10 @@ class QuillEditorOpenSearchAction extends ContextAction<OpenSearchIntent> {
}
await showDialog<String>(
context: context,
builder: (_) => QuillToolbarSearchDialog(
controller: state.controller,
builder: (_) => FlutterQuillLocalizationsWidget(
child: QuillToolbarSearchDialog(
controller: state.controller,
),
),
);
}
Expand Down