![](https://i-blog.csdnimg.cn/blog_migrate/bddec5cc212a3fc3568978d091804d4e.png)
CartNum.dart
import 'package:flutter/material.dart';
import 'package:jdflutter/flutter_jdshop/services/ScreenAdaper.dart';
import 'package:provider/provider.dart';
import '../../provider/Cart.dart';
class CartNum extends StatefulWidget {
const CartNum({Key? key}) : super(key: key);
@override
_CartNumState createState() => _CartNumState();
}
class _CartNumState extends State<CartNum> {
@override
Widget build(BuildContext context) {
return Container(
width: ScreenAdaper.width(164),
decoration: BoxDecoration(
border: Border.all(width: 1,color: Colors.black12)
),
child: Row(
children: [
_leftBtn(),
_centerArea(),
_rightBtn()
],
),
);
}
/// 左侧按钮
Widget _leftBtn(){
return InkWell(
onTap: (){},
child: Container(
alignment: Alignment.center,
width: ScreenAdaper.width(45),
height: ScreenAdaper.height(45),
child: Text("-"),
),
);
}
//右侧按钮
Widget _rightBtn() {
return InkWell(
onTap: (){
},
child: Container(
alignment: Alignment.center,
width: ScreenAdaper.width(45),
height: Sc