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

Created text editing controller which builds TextSpans from list of M… #19

Merged
merged 14 commits into from
Apr 28, 2023

Conversation

nazarski
Copy link
Contributor

Created text editing controller which builds text spans from MIstake list

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.

Good start. Added a handful of suggestions.
Primary focus on making the highlight work without any unexpected conditions, then look into making the controller more generic and customizable.

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
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
lib/presentation/language_tool_text_field.dart Outdated Show resolved Hide resolved
lib/presentation/language_tool_text_field.dart Outdated Show resolved Hide resolved
lib/presentation/language_tool_text_field.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
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 work rewriting the main logic to generators.
A few more suggestions below.

lib/domain/highlight_colors.dart Outdated Show resolved Hide resolved
lib/presentation/language_tool_text_field.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
lib/presentation/language_tool_text_field.dart Outdated Show resolved Hide resolved
lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
/// Breaks the loop if iterated Mistake offset is bigger than text
/// length.
if (mistake.offset > textLength ||
mistake.offset + mistake.length > textLength) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

mistake.offset + mistake.length
I see this used thrice in this method. DRY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

Still seeing this line being repeated. Please review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I swear i got rid of it in recent commits

lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
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.

Almost there!

lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
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.

LGTM!

Comment on lines +34 to +36
///set value triggers each time, even when cursor changes its location
///so this check avoid cleaning Mistake list when text wasn't really changed
if (newText.length == text.length) return;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a really helpful comment here, good job!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, I really appreciate it!

lib/core/controllers/colored_text_editing_controller.dart Outdated Show resolved Hide resolved
@solid-yuriiprykhodko solid-yuriiprykhodko merged commit 9833fb9 into nazarski Apr 28, 2023
1 check passed
@solid-yuriiprykhodko solid-yuriiprykhodko deleted the buld_text_spans branch April 28, 2023 14:34
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

2 participants