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

Suggestions popup #28

Closed
wants to merge 16 commits into from
Closed

Suggestions popup #28

wants to merge 16 commits into from

Conversation

Sammy275
Copy link

This PR contains all the work related to the suggestions popup that appears on a mistake.

Copy link
Collaborator

@solid-yuriiprykhodko solid-yuriiprykhodko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start -- a few suggestions for improvement added.
Please attach a screen recording to the PR each time you make a round of changes.

A gif will work too -- look up LICEcap.

lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
Comment on lines 128 to 129
/// it will be slightly below the tapped area.
final newDy = position.dy + 10;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to position the popup relative to the text, and not tap area?
Hardcoded offset from tap location won't look well if the font size is larger.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will have to check that.

lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
Comment on lines +34 to +41
final Widget Function(
String name,
String message,
Color color,
List<String> replacements,
Function(String) onSuggestionTap,
Function() onClose,
)? mistakeBuilder;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. No need to provide the colour ourselves. Let it be resolved dynamically from MistakeType.
  2. Use typedef for better readability.
Suggested change
final Widget Function(
String name,
String message,
Color color,
List<String> replacements,
Function(String) onSuggestionTap,
Function() onClose,
)? mistakeBuilder;
typedef ReplacementSuggestionsBuilder = Widget Function(
Mistake mistake,
List<String> replacements,
Function(String) onSuggestionTap,
Function() onClose,
);
final ReplacementSuggestionsBuilder? mistakeBuilder;

}

@override
void dispose() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the bottom of the class.
That's company convention -- all cleanup/disposal should be placed at the very bottom.

@solid-yuriiprykhodko solid-yuriiprykhodko deleted the suggestions-popup branch May 22, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants