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

Add RTL support (Bidi) #1239

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add RTL support (Bidi) #1239

wants to merge 2 commits into from

Conversation

Amjad50
Copy link

@Amjad50 Amjad50 commented Jul 22, 2024

Add Bidi support identification for text elements and dynamically change the direction of the text.

Fixes #63

Please make sure that your Pull Request meet the following acceptance criteria:

  • Code formatting and import sorting has been done with dart format lib/ test/ and dart run import_sorter:main --no-comments
  • The commit message uses the format of Conventional Commits
  • The commit message describes what has been changed, why it has been changed and how it has been changed
  • Every new feature or change of the design/GUI is linked to an approved design proposal in an issue
  • Every new feature in the app or the build system has a strategy how this will be tested and maintained from now on for every release, e.g. a volunteer who takes over maintainership

Pull Request has been tested on:

  • Android
  • iOS
  • Browser (Chromium based)
  • Browser (Firefox based)
  • Browser (WebKit based)
  • Desktop Linux
  • Desktop Windows
  • Desktop macOS

This will be used to control the direction of text elements depending on
the content.

We use `intl` to either add unicode characters to fix the display, or to
know which TextDirection it should use (to be used when displaying
HTML).

`AutoDirection` is used for dynamic content, such as TextField to change
the direction based on the input text.

Signed-off-by: Amjad Alsharafi <[email protected]>
Use the `utils/text_direction.dart` functions to:
- convert text Strings into a version that may contain unicode characters to change the
  direction of the text.
- control how to display HTML based on the text direction based on the
  content
- control the direction of TextField dynamically based on the written
  content.

Signed-off-by: Amjad Alsharafi <[email protected]>
Copy link
Owner

@krille-chan krille-chan left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, but this Pull Requests currently adds too much complexity, which I cannot maintain in the long term

@@ -33,7 +34,7 @@ class ChatAppBarListTile extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Linkify(
text: title,
text: title.bidiFormatted,
Copy link
Owner

Choose a reason for hiding this comment

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

Now every time I want to add a text somewhere, I need to think about adding the .bidiFormatted suffix? I would prefer a solution, which does not add more complexity

@Amjad50
Copy link
Author

Amjad50 commented Jul 22, 2024

Thanks @krille-chan for the review. You are right, I think a better solution is needed here. let me see what can be done to improve this.
The main issue is having direction control that is not tied to the system locale

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.

Add bidi support
2 participants