Button 按钮 文档地址
view
TDButton(text: '确认支付', // 按钮文案isBlock: true, // 是否时Blockwidth:345.w, // 自定义宽度height: 43.w, // 自定义高度padding: EdgeInsets.all(0), // 默认的paddingmargin: EdgeInsets.all(0), // 默认的margin// 文案左侧图标,根据提交状态判断是否显示loadingiconWidget: controller.loading ? TDLoading(size: TDLoadingSize.small,icon: TDLoadingIcon.circle,) : Container(),size: TDButtonSize.large, // 按钮尺寸type: TDButtonType.fill, // 类型:填充,描边,文字theme: TDButtonTheme.primary, // 主题shape: TDButtonShape.filled, // 形状:圆角,胶囊,方形,圆形,填充 rectangle, round, square, circle, filledstyle: TDButtonStyle( // 按钮文字具体样式backgroundColor: Colors.blue,textColor: Colors.white,radius: BorderRadius.circular(0), // 如果不设置shape属性,也可通过radius控制是方形还是圆角),disabled:controller.loading, // 按钮状态,提交时禁用onTap:controller.submit, // 点击提交按钮触发
),
controller
bool loading = false; // 按钮提交状态
void submit(){if(!submit_disabled){Loading.show();loading = true;update(["address_edit"]);// 模拟发送接口Future.delayed(Duration(seconds: 3),(){Loading.success('编辑成功');loading = false;update(["address_edit"]);});}
}