You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter中FFButtonWidget borderRadius参数类型不匹配问题求助

解决Flutter中FFButtonWidget的borderRadius类型不匹配错误

错误提示The argument type 'BorderRadius' can't be assigned to the parameter type 'double?'的原因很明确:FFButtonOptions的borderRadius参数接受的是圆角数值(double类型),但你传入的是BorderRadius.circular(8)生成的BorderRadius对象,两者类型不兼容。

修复方案

直接将borderRadius的值改为对应的圆角数值即可:

Align(
  alignment: AlignmentDirectional(-0.03, 0.13),
  child: FFButtonWidget(
    onPressed: () {
      print('Login pressed ...');
    },
    text: 'Login',
    options: FFButtonOptions(
      width: 130,
      height: 40,
      color: FlutterFlowTheme.of(context).primaryColor,
      textStyle: FlutterFlowTheme.of(context).subtitle2.override(
        fontFamily: 'Poppins',
        color: Colors.white,
      ),
      borderSide: BorderSide(
        color: Colors.transparent,
        width: 1,
      ),
      borderRadius: 8, // 直接传圆角数值,替换原BorderRadius对象
    ),
  ),
),

内容的提问来源于stack exchange,提问作者user20879521

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 18:11:05