fluttermaterial3

How to use a FilledButton in flutter (Material 3)


enter image description here

link1 (Screenshot) : https://flutter.github.io/samples/web/material_3_demo/#/

link2 (Document) : https://api.flutter.dev/flutter/material/FilledButton-class.html#material.FilledButton.1

I want use filled button

I try import material package like the official document code, But FilledButton class could not be found.

This widget not yet implemented?


[Edited]

I found a way to use FilledButton

[In terminal...]

flutter channel master
flutter pub upgrade

Then, Can find FilledButton class


Solution

  • No, it is not implemented yet, but you can build it with ElevatedButton like this:

    ElevatedButton(
        onPressed: () {},
        child: Text("Filled"),
        style: ButtonStyle(
          minimumSize: MaterialStateProperty.all(Size(130, 40)),
          elevation: MaterialStateProperty.all(0),
          shape: MaterialStateProperty.all<RoundedRectangleBorder>(
            RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(20.0),
            ),
          ),
        ),
      ),
    

    enter image description here