import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/business_system/goods/off_shelf/off_shelf_page.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../view_widget/my_appbar.dart'; import '../../view_widget/my_tab.dart'; import 'on_sale/on_sale_page.dart'; class BusinessGoodsPage extends StatefulWidget { final String storeId; BusinessGoodsPage(this.storeId); @override State createState() { return _BusinessGoodsPage(); } } class _BusinessGoodsPage extends State with AutomaticKeepAliveClientMixin { final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); String offShelfTotal; String onSaleTotal; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { super.build(context); return Column( children: [ Expanded(child: DefaultTabController( length: 2, child: Scaffold( appBar: MyAppBar( title:"", leading: false, background: Colors.white, toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, 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) ), // controller: tabController, //未选中文字颜色 unselectedLabelColor: Color(0xffA29E9E), indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽 tabs: [ MyTab(text:"在售中(${onSaleTotal ?? "0"})"), MyTab(text: "已下架(${offShelfTotal ?? "0"})"), ], ), ), body: TabBarView( children: [ OnSalePage(widget.storeId,(value){ setState((){ onSaleTotal = value; }); }), OffShelfPage(widget.storeId,(value){ setState((){ offShelfTotal = value; }); })], ), ), ),), SizedBox( height: 76.h, ), ], ); } @override bool get wantKeepAlive => true; }