flutter 全选_Flutter实战视频-移动电商-60.购物车_全选按钮的交互效果制作

import 'package:flutter/material.dart';

import'package:flutter_screenutil/flutter_screenutil.dart';

import'package:provide/provide.dart';

import'../../provide/cart.dart';classCartBottom extends StatelessWidget {

@override

Widget build(BuildContext context) {returnContainer(

padding: EdgeInsets.all(5.0),

color: Colors.white,

child: Provide(

builder: (context,child,val){returnRow(

children:[

_selectAllBtn(context),

_allPriceArea(context),

_goButton(context)

],

);

}

)

);

}//全选

Widget _selectAllBtn(context){bool isAllCheck=Provide.value(context).isAllCheck;returnContainer(

child: Row(

children:[

Checkbox(

value: isAllCheck,

activeColor: Colors.pink,//激活的颜色

onChanged: (boolval){

Provide.value(context).changeAllCheckBtnState(val);

},//事件

),

Text('全选')

],

),

);

}//合计

Widget _allPriceArea(context){double allPrice = Provide.value(context).allPrice;returnContainer(

width: ScreenUtil().setWidth(430),

child: Column(

children:[

Row(

children:[

Container(

alignment: Alignment.centerRight,

width: ScreenUtil().setWidth(280),

child: Text('合计:',

style:TextStyle(

fontSize:ScreenUtil().setSp(36)

)

),

),//红色的价格

Container(

alignment: Alignment.centerLeft,

width: ScreenUtil().setWidth(150),

child: Text('${allPrice}',

style: TextStyle(

fontSize: ScreenUtil().setSp(36),

color: Colors.red

)

),

)

],

),//第二行

Container(

width: ScreenUtil().setWidth(430),//和第一行一样宽

alignment: Alignment.centerRight,

child: Text('满10元免配送费,预购免配送费',

style: TextStyle(

color: Colors.black38,

fontSize: ScreenUtil().setSp(22)

),

),

)

],

),

);

}//结算 用 inkWell

Widget _goButton(context){int allGoodsCount= Provide.value(context).allGoodsCount;returnContainer(

width: ScreenUtil().setWidth(160),

padding: EdgeInsets.only(left:10.0),

child: InkWell(

onTap: (){},

child: Container(

padding: EdgeInsets.all(10.0),

alignment: Alignment.center,//居中对齐

decoration: BoxDecoration(

color: Colors.red,

borderRadius: BorderRadius.circular(3.0)//圆角

),

child: Text('结算(${allGoodsCount})',

style: TextStyle(

color: Colors.white

),

),

),

),

);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值