import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../utils/font_weight.dart'; import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_tab.dart'; import '../order/ticket/ticket_tab.dart'; import 'off_shelf/off_shelf_page.dart'; import 'on_sale/on_sale_page.dart'; class BusinessGoodsPage extends StatefulWidget { final String storeId; BusinessGoodsPage(Key key,this.storeId): super(key: key); @override State createState() { return _BusinessGoodsPage(); } } class _BusinessGoodsPage extends State { final RefreshController refreshController = RefreshController(); String offShelfTotal; String onSaleTotal; int goodsIndex = 0; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { return Column( children: [ Expanded( child: DefaultTabController( length: 3, child: Scaffold( appBar: MyAppBar( title:"", leading: false, background: Colors.white, toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, bottom: TabBar( // isScrollable: true, //可滚动 //去掉按钮阴影 overlayColor: MaterialStateProperty.all(Colors.white), indicatorColor: Color(0xFF30415B), labelColor: Colors.black, labelStyle: TextStyle( fontSize: 15.sp, fontWeight: FontWeight.bold, ), unselectedLabelStyle: TextStyle( fontSize: 15.sp, fontWeight: FontWeight.normal, color: Color(0xFF666666) ), indicator: const TicketTab( width: 33, borderSide: BorderSide( width: 2.0, color: Color(0xFF30415B))), // controller: tabController, //未选中文字颜色 unselectedLabelColor: Color(0xffA29E9E), indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ MyTab(text:"在售中(${onSaleTotal ?? "0"})"), MyTab(text: "已下架(${offShelfTotal ?? "0"})"), GestureDetector( onTap: (){ Navigator.of(context).pushNamed( '/router/add_goods_page', arguments: { "storeId":widget.storeId ?? "", }); }, child:Row(children: [Padding( padding: EdgeInsets.only(right: 5.w), child: Text( "新增商品", textAlign: TextAlign.center, style: TextStyle( height: 1.5, color: Color(0xFF2E3552), fontSize: 16.sp, fontWeight: MyFontWeight.bold, ), )), Image.asset( "assets/image/bus_goods_add.webp", width: 14.w, height: 15.h, ), ]), ), ], ), ), body: TabBarView( physics: NeverScrollableScrollPhysics(), children: [ OnSalePage(widget.storeId,(value){ setState((){ onSaleTotal = value; }); }), OffShelfPage(widget.storeId,(value){ setState((){ offShelfTotal = value; }); }), Container() ], ), ), ), ), SizedBox( height: 76.h, ), ], ); } }