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
),
),
),
),
);
}
}