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已经不推荐使用了 #429

Open
18334581089 opened this issue Mar 17, 2021 · 3 comments
Open

FlatButton已经不推荐使用了 #429

18334581089 opened this issue Mar 17, 2021 · 3 comments

Comments

@18334581089
Copy link

2.2.1,当我使用vscode协商FlatButton时会提示.
信息如下
'FlatButton' is deprecated and shouldn't be used. Use TextButton instead. See the migration guide in flutter.dev/go/material-button-migration-guide). This feature was deprecated after v1.25.0-8.1.pre..

(本人刚开始学习flutter,使用的时2.0,谢谢了)

@toKnowMore
Copy link

同上

@Hwy152
Copy link

Hwy152 commented Apr 21, 2021

+1

@ltybenet
Copy link

ltybenet commented May 16, 2021

flutter 2020年8月更新
https://docs.google.com/document/d/1yohSuYrvyya5V1hB6j9pJskavCdVq9sVeTqSoEPsWH0/edit

FlatButton => TextButton

下面是修改后的代码

Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
      ... //省略无关代码
      TextButton(
          onPressed: (){
            Navigator.push(context, 
              MaterialPageRoute(builder: (context){
                return NewRoute();
              })
            );
          }, 
          child: Text("open new route"),
          style: ButtonStyle(
            foregroundColor: MaterialStateProperty.all(Colors.red)
          ),
          ),
       ],
 )

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

4 participants