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

FlatButton() is deprecated #46

Open
FarhaanK opened this issue Aug 20, 2022 · 4 comments
Open

FlatButton() is deprecated #46

FarhaanK opened this issue Aug 20, 2022 · 4 comments

Comments

@FarhaanK
Copy link

hi,
the FlatButton widget is deprecated the alternatives are TextButton or ElevatedButton but neither seem to have a color property like FlatButton. am i right? which button should i use in this project and how do i define its color?

@lawrence-cruz
Copy link

You can use TextButton as an alternative to FlatButton.

To add color, just add the following code below:
style: TextButton.styleFrom(backgroundColor: Colors.red)

Here's an example:
image

@ChandraShekharRajput
Copy link

hi, the FlatButton widget is deprecated the alternatives are TextButton or ElevatedButton but neither seem to have a color property like FlatButton. am i right? which button should i use in this project and how do i define its color?

Icon Button

@umutonal
Copy link

hi,
the FlatButton widget is deprecated the alternatives are TextButton or ElevatedButton but neither seem to have a color property like FlatButton. am i right? which button should i use in this project and how do i define its color?

you can use it

Expanded buildKey({Color color, int soundNumber}) {
return Expanded(
child: TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateColor.resolveWith((states) => color)),
),
);
}

@sarmad-hzn
Copy link

Expanded(
child: TextButton(
onPressed: () {
playSound(7);
},
child: Text(''),
style: TextButton.styleFrom(backgroundColor: Colors.purple),
),
)

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

5 participants