【问题标题】:How to solve The named parameter 'padding' isn't defined. The named parameter 'shape' isn't defined如何解决未定义命名参数“填充”。未定义命名参数“形状”
【发布时间】:2022-07-21 23:57:32
【问题描述】:

如何解决此错误 未定义命名参数“填充”。 尝试将名称更正为现有命名参数的名称,或使用名称“填充”定义命名参数。并且未定义命名参数“形状”。 尝试将名称更正为现有命名参数的名称,或使用名称“shape”定义命名参数。显示一个可以帮助我吗?

这是我的代码

 ElevatedButton(
    padding: EdgeInsets.fromLTRB(30, 0, 30, 0), // Error
    onPressed: () {
    setState(() {
    pageContent =
    new PatientDetailsProfilePage(
    token: widget.token,
    fullName: widget.fullName,
    apiEndPoint: widget.apiEndPoint,
    userUID: widget.userUID,
     patientProfile:
     widget.patientProfile);
    });
   },
    shape: new RoundedRectangleBorder( // Error
     borderRadius:
     new BorderRadius.circular(30.0),
     ),
    child: new Text('Profile',
    style: TextStyle(
    fontSize: 16,
    fontWeight: FontWeight.normal)),
  ),

【问题讨论】:

    标签: flutter dart flutter-layout


    【解决方案1】:

    使用ElevatedButton.styleFrom

    ElevatedButton(
      style: ElevatedButton.styleFrom(
        padding: EdgeInsets.fromLTRB(30, 0, 30, 0),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(30.0),
        ),
      ),
      onPressed: () {
         .....
      },
    
    ),
    

    【讨论】:

      猜你喜欢
      • 2022-01-04
      • 2020-02-13
      • 2022-11-01
      • 2020-06-24
      • 2018-05-14
      • 2020-02-16
      • 2021-06-12
      • 2021-06-15
      相关资源
      最近更新 更多