part of book_shop;


class BuildCounter extends StatelessWidget {
  final BookshopController controller;
  const BuildCounter({
    Key? key,
    required this.controller
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      padding: const EdgeInsets.only(left: 20,right: 15),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Row(
                children: [
                 GestureDetector(
                   onTap: (){
                     controller.selectAll();
                   },
                   child: Container(
                     color: Colors.white,
                     child: Row(
                       children: [
                         SizedBox(
                           height: 17,
                           width: 17,
                           child: Image.asset(controller.all?'assets/images/pay_check.png':'assets/images/pay_uncheck.png'),
                         ),
                         const SizedBox(width: 11),
                         const Text('全选',style: TextStyle(color: Color(0xFF333333),fontSize: 12,fontWeight: FontWeight.w500)),
                       ],
                     ),
                   ),
                 ),
                  const SizedBox(width: 15,),
                  Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('合计 ￥${controller.allPrice.toStringAsFixed(2)}',style: const TextStyle(color: AppTheme.primary,fontSize: 12,fontWeight: FontWeight.w500)),
                      Text('已选 ${controller.num} 件',style: const TextStyle(color: Color(0xFF999999),fontSize: 10,))
                    ],
                  )
                ],
              ),
              GestureDetector(
                onTap: (){
                  if (controller.num > 0){
                    context.pushNamed(Routes.bookPay,extra: controller.buy);
                  }
                },
                child: Container(
                  margin: const EdgeInsets.symmetric(vertical: 9),
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(17.5),
                      color: AppTheme.primary
                  ),
                  // height: 35,
                  alignment: Alignment.center,
                  padding: const EdgeInsets.symmetric(vertical: 8,horizontal: 20),
                  child:  Text('结算(${controller.num})',style: const TextStyle(fontSize: 14,color: Colors.white,height: 1.1,fontWeight: Fonts.medium),),
                ),
              )
            ],
          ),
          Container(
            height: 1,
            color: const Color(0xFFF9F9F9),
          )
        ],
      ),
    );
  }
}
