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

DialogTextField color change for dark mode #134

Open
vgavrilovikj opened this issue Jul 24, 2024 · 6 comments
Open

DialogTextField color change for dark mode #134

vgavrilovikj opened this issue Jul 24, 2024 · 6 comments

Comments

@vgavrilovikj
Copy link

Here's my code for the textinputdialog:

showTextInputDialog(
  context: context,
  textFields: [
    DialogTextField(
        initialText: widget
            .recentChatBlockEntity
            .title,
        hintText: 'Title'),
  ],
  title: 'Rename chat')

This works great - however when the app is in dark mode it shows black text on a black background - I want to change the color of the text of the DialogTextField, the initialText to be white and hintText to have lightgray color...

How can I achieve this?

P.S. Would be good to add some more documentation regarding the package and it's configutations

@devnta
Copy link

devnta commented Nov 26, 2024

@mono0926
But it's effect for whole project.
How to custom only DialogTextField?
Sorry for my bad English.

@mono0926
Copy link
Owner

@devnta

You can change the theme partially like this:

builder: (context, child) => Theme(
data: ThemeData(
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: Colors.orange,
),
),
// If this is commented out, the color for cupertino will be default blue/red.
cupertinoOverrideTheme: const CupertinoThemeData(
primaryColor: Colors.purple,
),
),
child: child,

@devnta
Copy link

devnta commented Nov 26, 2024

@mono0926
Thanks for your reply.
I will try it and report the result.

@devnta
Copy link

devnta commented Nov 26, 2024

@mono0926

final result = await showTextInputDialog(
                      context: context,
                      textFields: [
                        DialogTextField(
                          hintText: LocaleKeys.enter_bmi_value.tr(),
                        )
                      ],
                      builder: (context, child) {
                        return Theme(
                          data: ThemeData(
                            textButtonTheme: TextButtonThemeData(
                              style: TextButton.styleFrom(
                                foregroundColor: Colors.orange,
                              ),
                            ),
                            // If this is commented out, the color for cupertino will be default blue/red.
                            cupertinoOverrideTheme: const CupertinoThemeData(
                              primaryColor: Colors.purple,
                              textTheme: CupertinoTextThemeData(
                                textStyle: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                            ),
                          ),
                          child: child,
                        );
                      },
                    );

Not work in dark theme

@Allenxuxu
Copy link

I have the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

4 participants