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

adding textDirection property to ThemeData class #62691

Open
hewa-jalal opened this issue Jul 31, 2020 · 4 comments
Open

adding textDirection property to ThemeData class #62691

hewa-jalal opened this issue Jul 31, 2020 · 4 comments
Labels
a: typography Text rendering, possibly libtxt c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@hewa-jalal
Copy link

hewa-jalal commented Jul 31, 2020

shouldn't textDirection be added to ThemeData so we can just change it once and not in every single Text widget, i know about the Directionality widget but it doesn't work like textDirection property inside the Text widget.

@hewa-jalal hewa-jalal changed the title adding textDirection property to ThemeData class adding textDirection property to ThemeData class Jul 31, 2020
@darshankawar
Copy link
Member

Hi @hiwa-jalal,
If you want to set text direction for entire app, you may define that inside MaterialApp as below:

void main() {
  runApp(
    MaterialApp(
      home: Directionality(
        textDirection: TextDirection.rtl // or ltr,
        child: Demo(),
      ),
    ),
  );
}

Does this answer your question or did I misread your question ?
Thanks.

@darshankawar darshankawar added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Aug 3, 2020
@hewa-jalal
Copy link
Author

hewa-jalal commented Aug 4, 2020

thank you, but as i mentioned i already used it but it doesn't work, i mean it changes nothing.
my widget tree in main.dart file look like this, sorry for the messy structure but that's because i use a lot of packages.

Directionality(
              textDirection: TextDirection.rtl,
              child: NeumorphicApp(
                debugShowCheckedModeBanner: false,
                home: get_package.GetMaterialApp(
                  theme: state.themeData,
                  debugShowCheckedModeBanner: false,
                  home: locationPrefs != null
                      ? Builder(
                          builder: (context) {
                            ScreenUtil.init(context);
                            return HomePage(
                              showDialog: false,
                              userLocation: locationPrefs,
                            );
                          },
                        )
                      : Builder(
                          builder: (context) {
                            SizeConfig().init(context);
                            ScreenUtil.init(context);
                            return I18n(
                              child: LanguageSelectionPage(),
                            );
                          },
                        ),
                ),
              ),
            );

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 4, 2020
@darshankawar
Copy link
Member

Hi @hiwa-jalal,
Can you please elaborate when you say it doesn't work, it changes nothing and what are you expecting by adding textDirection property` ?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 5, 2020
@hewa-jalal
Copy link
Author

hewa-jalal commented Aug 5, 2020

as i have an option for the user to choose the Arabic language in my app which is a RTL language, so i want my Text to have that direction too when the user select the Arabic language, as for Directionality i expect it to give me the same result as textDirection property inside the Text widget, but it doesn't it as i will show you below:

this is the result of when using textDirection: TextDirection.rtl property inside the Text widget.
image

and this is the result of using the Directionality textDirection: TextDirection.rtl, as you can see they are not similar for case of using the Directionalitywidget, it's like it has no effect in it, and the text is still ltr even though i set to be rtl inside theDirectionality` widegt, that's why i said it doesn't work and it changes nothing.
image

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 5, 2020
@darshankawar darshankawar added a: typography Text rendering, possibly libtxt f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: new feature Nothing broken; request for a new capability and removed in triage Presently being triaged by the triage team labels Aug 5, 2020
@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-design Owned by Design Languages team triaged-design Triaged by Design Languages team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: typography Text rendering, possibly libtxt c: new feature Nothing broken; request for a new capability f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
Development

No branches or pull requests

3 participants