flutter. Container组件参数说明

  Widget _buildSettingButton(String leftImage, String buttonTitle, String rightImage, GetView page) {
    return Row(
      children: <Widget>[
        Expanded(
          child: MaterialButton(
            color: Colors.white,
            child: 
            Container( width: 100.w, //宽
              height: 200.h,//高
              alignment: Alignment.center,//对其方式
              padding: EdgeInsets.only(//内边距
                top: 10.h,
                bottom: 10.h,
                left: 10.w,
                right: 10.w,
              ),
              margin: EdgeInsets.only(//外边距
                left: 10.w,
                right: 10.w,
              ),
              constraints: BoxConstraints(//容器大小限制
                minWidth: 1.w,
                maxWidth: 300.w,
                minHeight: 0.h,
                maxHeight: 60.h,
              ),
              decoration: BoxDecoration(//装饰
                border: Border.all(
                  color: Colors.red,
                  width: 1.0,
                  style: BorderStyle.solid,
                ),
              ),
              foregroundDecoration: BoxDecoration(//前景装饰
                border: Border.all(
                  color: Colors.red,
                  width: 1.0,
                  style: BorderStyle.solid,
                ),
              ),
              transform: Matrix4.rotationZ(0.2),//旋转
              child: Row(children: [//子组件
                Visibility(//是否可见
                  visible: false,
                  child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
                    Image.asset(
                      "assets/images/$leftImage.png",
                    ),
                  ]),
                ),
                Visibility(
                  visible: buttonTitle != "",
                  child: Expanded(
                    child: Container(
                        margin: EdgeInsets.only(left: 10.w),
                        child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
                          Text(buttonTitle.toString(),
                              style: TextStyle(
                                color: AppColors.primaryText,
                                fontFamily: "Avenir",
                                fontWeight: FontWeight.w400,
                                fontSize: 14.sp,
                              ))
                        ])),
                  ),
                ),
                Visibility(
                  visible: rightImage != "",
                  child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
                    Image.asset(
                      "assets/images/$rightImage.png",
                    ),
                  ]),
                ),
              ]),
            ),
            onPressed: () {
              // if (appRoute != "") {
              //   Get.toNamed(appRoute.toString());
              // } else {
              Get.to(page);
              // }
            },
          ),
        )
      ],
    );
  }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值