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

pull/1954/head
Ellet 10 months ago committed by GitHub
parent fe6787272a
commit 26b04443f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      lib/src/l10n/extensions/localizations.dart
  2. 5
      lib/src/l10n/widgets/localizations.dart
  3. 7
      lib/src/widgets/raw_editor/raw_editor_actions.dart

@ -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',
));
}
}

@ -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,

@ -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';
@ -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,
),
),
);
}

Loading…
Cancel
Save