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

Option to change the directionality of text and text-direction-sensitive render objects #56

Closed
Aanu1995 opened this issue Jan 21, 2022 · 3 comments

Comments

@Aanu1995
Copy link

In my app, I need to change the text direction of the title and the content in the dialog but I could not because there is no argument provided for text direction.

Expected Behaviour
The dialog should have support for text direction by making Directionality the root child of the dialog.

showModal(
      context: context,
      useRootNavigator: useRootNavigator,
      configuration: FadeScaleTransitionConfiguration(
        barrierDismissible: barrierDismissible,
      ),
      builder: (context) => Directionality(
        textDirection: TextDirection.rtl,
        child: WillPopScope(
          onWillPop: onWillPop,
          child: AlertDialog(
            title: titleText,
            content: messageText,
            actions: actions.convertToMaterialDialogActions(
              onPressed: pop,
              destructiveColor: colorScheme.error,
              fullyCapitalized: fullyCapitalizedForMaterial,
            ),
            actionsOverflowDirection: actionsOverflowDirection,
            scrollable: true,
          ),
        ),
      ),
    );
@Aanu1995 Aanu1995 changed the title Option to be able to change the text and text-direction-sensitive render objects Option to change the directionality of text and text-direction-sensitive render objects Jan 21, 2022
@mono0926
Copy link
Owner

@Aanu1995

Why do you want to change the directionality only for some screens, such as dialogs?
If you'd like to change the whole app directionality, you can do it by adding the following to

, and the dialog of adaptive_dialog will follow it. Is that not enough?

      builder: (context, child) => Directionality(
        textDirection: TextDirection.rtl,
        child: child!,
      ),

@Aanu1995
Copy link
Author

Thank you @mono0926 . I am actually aware of this and my app already handled that for Hebrew language. What I needed to do in the dialog was to enforce direction ltr instead of the global directionality because the text I intend to display is in English. Cases of changing direction for a particular screen or widget is possible and I believe it is the reason why the Flutter team added that support for widgets (e.g Text widget) in Flutter.

@mono0926
Copy link
Owner

builder parameter has been added at #60, and released as 1.5.0.

Examples:

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

No branches or pull requests

2 participants