Skip to content

Commit

Permalink
feat(text-editor): add autocorrect and enableSuggestions configs
Browse files Browse the repository at this point in the history
- This was requested in [#132](#132)
  • Loading branch information
hm21 committed Jun 22, 2024
1 parent 931370a commit d4d2e63
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## Version 4.0.10
- **feat(text-editor)**: Add autocorrect and enableSuggestions configs. This was requsted in [#132](https://github.com/hm21/pro_image_editor/issues/132)

## Version 4.0.9
- **fix(emoji-picker)**: Ensure the emoji-picker is rendered inside the safe areas. This resolves issue [#126](https://github.com/hm21/pro_image_editor/issue/126).

Expand Down
16 changes: 16 additions & 0 deletions lib/models/editor_configs/text_editor_configs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,27 @@ class TextEditorConfigs {
/// The maximum scale factor from the layer.
final double maxScale;

/// Whether to show input suggestions as the user types.
///
/// This flag only affects Android. On iOS, suggestions are tied directly to
/// [autocorrect], so that suggestions are only shown when [autocorrect] is
/// true. On Android autocorrection and suggestion are controlled separately.
///
/// Defaults to true.
final bool enableSuggestions;

/// Whether to enable autocorrection.
///
/// Defaults to true.
final bool autocorrect;

/// Creates an instance of TextEditorConfigs with optional settings.
///
/// By default, the text editor is enabled, and most text formatting options
/// are enabled. The initial font size is set to 24.0.
const TextEditorConfigs({
this.autocorrect = true,
this.enableSuggestions = true,
this.enabled = true,
this.showSelectFontStyleBottomBar = false,
this.canToggleTextAlign = true,
Expand Down
2 changes: 2 additions & 0 deletions lib/modules/text_editor/text_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ class TextEditorState extends State<TextEditor>
onEditingComplete:
textEditorCallbacks?.handleEditingComplete,
onSubmitted: textEditorCallbacks?.handleSubmitted,
autocorrect: textEditorConfigs.autocorrect,
enableSuggestions: textEditorConfigs.enableSuggestions,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.newline,
textCapitalization: TextCapitalization.sentences,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: pro_image_editor
description: "A Flutter image editor: Seamlessly enhance your images with user-friendly editing features."
version: 4.0.9
version: 4.0.10
homepage: https://github.com/hm21/pro_image_editor/
repository: https://github.com/hm21/pro_image_editor/
issue_tracker: https://github.com/hm21/pro_image_editor/issues/
Expand Down

0 comments on commit d4d2e63

Please sign in to comment.