没有为类定义“RaisedButton”方法

问题描述 投票:0回答:1

lib/main.dart:90:15:错误:没有为类“_girisState”定义吸气剂“RaisedButton”。

  • '_girisState' 来自 'package:flutterapp/main.dart' ('lib/main.dart')。 尝试将名称更正为现有 getter 的名称,或者定义一个名为“RaisedButton”的 getter 或字段。 RaisedButton.icon( ^^^^^^^^^^^^ lib/main.dart:99:15: 错误:未为类“_girisState”定义方法“RaisedButton”。
  • '_girisState' 来自 'package:flutterapp/main.dart' ('lib/main.dart')。 尝试将名称更正为现有方法的名称,或定义名为“RaisedButton”的方法。 RaisedButton( ^^^^^^^^^^^^^

我的代码

              RaisedButton.icon(
                onPressed: () {
                  _handleSignIn();
                },
                color: Colors.blue,
                textColor: Colors.white,
                label: Text("Google Giris Yap"),
                icon: Icon(Icons.sentiment_very_satisfied),
              ),
              RaisedButton(
                child: Text("Daha Karpuz Kesecektik :("),
                color: Colors.blue,
                textColor: Colors.white,
                onPressed: () {
                  SystemChannels.platform.invokeMethod('SystemNavigator.pop');
                },

我想我应该更改按钮,但这样做有问题,我不擅长 flutter 谁能帮忙?

我试着换成高架按钮,但没用

flutter
1个回答
0
投票

ElevatedButton
不具有与
RaisedButton
完全相同的属性。 但是你可以像下面那样做你用 RaisedButton 做的一切

ElevatedButton(
        onPressed: () {
          _handleSignIn();
        },
       //Styles contains all the design related to button
        style: ButtonStyle(
          backgroundColor: MaterialStatePropertyAll(Colors.blue),
        ),
        //Child is basically what you want to display inside button It can be Text, Row, Column, or Icon.
        child: Row(
          children: const [
            Text("Google Giris Yap", style: TextStyle(color: Colors.white),),
            Icon(Icons.sentiment_very_satisfied),
          ],
        ),
      )
© www.soinside.com 2019 - 2024. All rights reserved.