From ee3660cc1fbcd1dbafd5e24b21b5accc6e617c2c Mon Sep 17 00:00:00 2001 From: wurong <953969641@qq.com> Date: Thu, 29 Jun 2023 17:58:31 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=84=8F=E6=80=BB=E8=A7=88=EF=BC=9A?= =?UTF-8?q?=20=E6=80=BB=E8=A7=88=EF=BC=88=E5=BE=85=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/business_home_page.dart | 187 ++++-------------- .../home/home_view/home_sideslip_dialog.dart | 178 +++++++++++++++++ .../home/{ => home_view}/my_line_chart.dart | 2 +- .../home/trade_overview_page.dart | 79 ++++++++ lib/business_system/home/trade_summary.dart | 162 +++++++++++++++ lib/main.dart | 4 + 6 files changed, 459 insertions(+), 153 deletions(-) create mode 100644 lib/business_system/home/home_view/home_sideslip_dialog.dart rename lib/business_system/home/{ => home_view}/my_line_chart.dart (99%) create mode 100644 lib/business_system/home/trade_overview_page.dart create mode 100644 lib/business_system/home/trade_summary.dart diff --git a/lib/business_system/home/business_home_page.dart b/lib/business_system/home/business_home_page.dart index 4cf51021..59cd3117 100644 --- a/lib/business_system/home/business_home_page.dart +++ b/lib/business_system/home/business_home_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:huixiang/business_system/home/home_view/home_sideslip_dialog.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; @@ -7,7 +8,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import '../../utils/font_weight.dart'; -import 'my_line_chart.dart'; +import 'home_view/my_line_chart.dart'; class BusinessHomePage extends StatefulWidget { @override @@ -17,7 +18,7 @@ class BusinessHomePage extends StatefulWidget { } class _BusinessHomePage extends State - with AutomaticKeepAliveClientMixin { + with AutomaticKeepAliveClientMixin{ ApiService apiService; final RefreshController refreshController = RefreshController(); final ScrollController scrollController = ScrollController(); @@ -35,6 +36,11 @@ class _BusinessHomePage extends State super.initState(); } + @override + void dispose() { + super.dispose(); + } + @override Widget build(BuildContext context) { super.build(context); @@ -62,7 +68,7 @@ class _BusinessHomePage extends State child: Column( children: [ homeTop(), - businessOverview(), + tradeOverview(), userOverview(), hotSellHotCharts(), todayFlow(), @@ -288,146 +294,13 @@ class _BusinessHomePage extends State ///侧面弹窗 showAlertDialog() { showCupertinoModalPopup( - builder: (BuildContext context) { - return StatefulBuilder(builder: ( - context, - state, - ) { - return WillPopScope( - ///点击背景不收起弹窗; - // onWillPop: () async => false, - child: Container( - width: double.infinity, - margin: EdgeInsets.only(right:61.w), - height: double.infinity, - padding: EdgeInsets.only(top: 55.h), - decoration: new BoxDecoration( - color: Colors.white, - ), - child:Container( - child: - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - padding:EdgeInsets.only(left:14.w,bottom: 33.h), - child: Row( - children: [ - Image.asset( - "assets/image/default_user.webp", - width:57, - height:57, - ), - SizedBox(width: 10.w,), - Expanded(child: - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children:[ - Text("前进麦味烘焙*海峡姐妹茶", - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF1A1A1A) - ),), - SizedBox(height: 5.h,), - Text("123****1234", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF4D4D4D) - ),), - ], - )) - ], - ), - ), - Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h), - child: - Row( - children: [ - Image.asset( - "assets/image/bs_switch_shop.webp", - width:24, - height:24, - ), - SizedBox(width: 4.w,), - Text("门店切换", - style: TextStyle( - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF1A1A1A) - ),), - ], - ),), - Expanded(child:ListView.builder( - padding: EdgeInsets.zero, - itemCount:5, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - }, - child: shopItem(), - ); - }, - )), - Container( - alignment: Alignment.center, - width: double.infinity, - padding: EdgeInsets.symmetric(vertical: 9.h), - margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h), - decoration: BoxDecoration( - color: Color(0xFF30415B), - borderRadius: BorderRadius.circular(4.w), - ), - child:Text("退出登录", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Colors.white - ),),), - ], - ), - ), - ),); - }); - }, + builder: (context) { + return HomeSideslipDialog();}, context: context); } - ///门店选择 - Widget shopItem(){ - return Container( - decoration: BoxDecoration( - color: Color(0xFFF8F9FA), - borderRadius: BorderRadius.circular(4.w), - ), - margin:EdgeInsets.only(bottom: 11.h), - padding: EdgeInsets.only(top: 5.h,bottom: 8.h,left: 16.w,right: 17.w), - child: Row( - children: [ - Expanded(child:Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.medium, - color: Color(0xFF30415B) - ),)), - Icon( - Icons.check, - size: 20, - color: Color(0xFF4D4D4D),) - ], - ), - ); - } - ///生意总览 - Widget businessOverview() { + Widget tradeOverview() { return Container( padding: EdgeInsets.only(left: 16.w, right: 21.w, top: 12.h, bottom: 16.h), @@ -457,20 +330,30 @@ class _BusinessHomePage extends State color: Color(0x99000000), ), )), - Text( - "更多数据", - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF252626), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pushNamed('/router/trade_overview_page'); + }, + child: Row( + children: [ + Text( + "更多数据", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF252626), + ), + ), + SizedBox(width: 5.w,), + Image.asset( + "assets/image/bs_right.webp", + width: 8.w, + height: 12.h, + ), + ], ), - ), - SizedBox(width: 5.w,), - Image.asset( - "assets/image/bs_right.webp", - width: 8.w, - height: 12.h, - ), + ) ], ), SizedBox( diff --git a/lib/business_system/home/home_view/home_sideslip_dialog.dart b/lib/business_system/home/home_view/home_sideslip_dialog.dart new file mode 100644 index 00000000..ff1e3337 --- /dev/null +++ b/lib/business_system/home/home_view/home_sideslip_dialog.dart @@ -0,0 +1,178 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/store.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/store/scan.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/border_text.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +class HomeSideslipDialog extends StatefulWidget { + + @override + State createState() { + return _HomeSideslipDialog(); + } +} + +class _HomeSideslipDialog extends State with SingleTickerProviderStateMixin{ + AnimationController _animationController; + Animation _animation; + + @override + void initState() { + super.initState(); + _animationController = AnimationController( + duration: Duration(milliseconds: 500), + vsync: this, + ); + _animation = Tween( + begin: Offset(1.0, 0.0), + end: Offset.zero, + ).animate(CurvedAnimation( + parent: _animationController, + curve: Curves.easeInOut, + )); + _animationController.forward(); + } + + @override + void dispose() { + _animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return SlideTransition(position: _animation, + child: WillPopScope( + ///点击背景不收起弹窗; + // onWillPop: () async => false, + child: Container( + width: double.infinity, + margin: EdgeInsets.only(right:61.w), + height: double.infinity, + padding: EdgeInsets.only(top: 55.h), + decoration: new BoxDecoration( + color: Colors.white, + ), + child:Container( + child: + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding:EdgeInsets.only(left:14.w,bottom: 33.h), + child: Row( + children: [ + Image.asset( + "assets/image/default_user.webp", + width:57, + height:57, + ), + SizedBox(width: 10.w,), + Expanded(child: + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children:[ + Text("前进麦味烘焙*海峡姐妹茶", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF1A1A1A) + ),), + SizedBox(height: 5.h,), + Text("123****1234", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF4D4D4D) + ),), + ], + )) + ], + ), + ), + Padding(padding: EdgeInsets.only(left: 16.w,bottom: 22.h), + child: + Row( + children: [ + Image.asset( + "assets/image/bs_switch_shop.webp", + width:24, + height:24, + ), + SizedBox(width: 4.w,), + Text("门店切换", + style: TextStyle( + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF1A1A1A) + ),), + ], + ),), + Expanded(child:ListView.builder( + padding: EdgeInsets.zero, + itemCount:5, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + }, + child: shopItem(), + ); + }, + )), + Container( + alignment: Alignment.center, + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 9.h), + margin: EdgeInsets.only(left:16.w,right: 16.w,bottom: 103.h,top: 20.h), + decoration: BoxDecoration( + color: Color(0xFF30415B), + borderRadius: BorderRadius.circular(4.w), + ), + child:Text("退出登录", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white + ),),), + ], + ), + ), + ),),); + } + + ///门店选择 + Widget shopItem(){ + return Container( + decoration: BoxDecoration( + color: Color(0xFFF8F9FA), + borderRadius: BorderRadius.circular(4.w), + ), + margin:EdgeInsets.only(bottom: 11.h), + padding: EdgeInsets.only(top: 5.h,bottom: 8.h,left: 16.w,right: 17.w), + child: Row( + children: [ + Expanded(child:Text("前进麦味烘焙*海峡姐妹茶(哈乐城店)", + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B) + ),)), + Icon( + Icons.check, + size: 20, + color: Color(0xFF4D4D4D),) + ], + ), + ); + } +} diff --git a/lib/business_system/home/my_line_chart.dart b/lib/business_system/home/home_view/my_line_chart.dart similarity index 99% rename from lib/business_system/home/my_line_chart.dart rename to lib/business_system/home/home_view/my_line_chart.dart index 851b22da..53425da3 100644 --- a/lib/business_system/home/my_line_chart.dart +++ b/lib/business_system/home/home_view/my_line_chart.dart @@ -2,7 +2,7 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import '../../utils/font_weight.dart'; +import '../../../utils/font_weight.dart'; class LineChartSample2 extends StatefulWidget { final List lineChartSample2Data; diff --git a/lib/business_system/home/trade_overview_page.dart b/lib/business_system/home/trade_overview_page.dart new file mode 100644 index 00000000..58eee0dd --- /dev/null +++ b/lib/business_system/home/trade_overview_page.dart @@ -0,0 +1,79 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/business_system/home/trade_summary.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../generated/l10n.dart'; +import '../../mine/coupons_page.dart'; +import '../../mine/vip_card_page.dart'; +import '../../view_widget/classic_header.dart'; +import '../../view_widget/my_footer.dart'; +import '../../view_widget/my_tab.dart'; + +class TradeOverviewPage extends StatefulWidget { + @override + State createState() { + return _TradeOverviewPage(); + } +} + +class _TradeOverviewPage extends State with SingleTickerProviderStateMixin{ + ApiService apiService; + final RefreshController refreshController = RefreshController(); + var isShowMore = false; + + @override + void initState() { + super.initState(); + } + + @override + Widget build(BuildContext context) { + return DefaultTabController( + length: 3, + child: Scaffold( + appBar: MyAppBar( + title:"", + titleColor: Colors.black, + background: Colors.white, + leadingColor: Colors.black, + toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, + bottom: TabBar( + // isScrollable: true, //可滚动 + 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:"总览"), + MyTab(text: "订单"), + MyTab(text: "商品"), + ], + ), + ), + body: TabBarView( + children: [ + TradeSummary(), + CouponsPage(), + VipCardPage(),], + ), + ), + ); + } + +} diff --git a/lib/business_system/home/trade_summary.dart b/lib/business_system/home/trade_summary.dart new file mode 100644 index 00000000..20f1cb3e --- /dev/null +++ b/lib/business_system/home/trade_summary.dart @@ -0,0 +1,162 @@ +import 'dart:convert'; + +import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/coupon.dart'; +import 'package:huixiang/retrofit/data/page.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/coupon_details_dialog.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:huixiang/view_widget/new_coupon_widget.dart'; +import 'package:huixiang/view_widget/no_data_view.dart'; +import 'package:huixiang/view_widget/receive_success.dart'; +import 'package:huixiang/view_widget/selector_store_dialog.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +import '../../utils/font_weight.dart'; + +class TradeSummary extends StatefulWidget { + @override + State createState() { + return _TradeSummary(); + } +} + +class _TradeSummary extends State { + ApiService apiService; + final RefreshController _refreshController = RefreshController(); + final ScrollController scrollController = ScrollController(); + + @override + void dispose() { + super.dispose(); + _refreshController.dispose(); + } + + @override + void initState() { + super.initState(); + } + + _onRefresh() async { + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Column( + children: [ + Container( + color: Color(0xFFD8D8D8), + width:double.infinity, + height: 1.h, + ), + Expanded(child: SmartRefresher( + controller: _refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + scrollController: scrollController, + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + setState(() {}); + }, + child: SingleChildScrollView( + physics: NeverScrollableScrollPhysics(), + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Color(0xFFF6F6F6), + borderRadius: BorderRadius.circular(2), + border: Border.all(color: Color(0xFFCFD0D1), width: 1.w), + ), + margin: EdgeInsets.only(top: 16.h,right: 20.w,left: 20.w,bottom:12.h), + child: Row( + children: [ + Expanded(child:Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0xFF30415B), + ), + padding: EdgeInsets.symmetric(vertical:9.h), + child: Text( + "日报", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Colors.white, + ), + ), + ),), + Expanded(child:Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + // color: Color(0xFF30415B), + ), + padding: EdgeInsets.symmetric(vertical:9.h), + child: Text( + "周报", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B), + ), + ), + ),), + Expanded(child:Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + // color: Color(0xFF30415B), + ), + padding: EdgeInsets.symmetric(vertical:9.h), + child: Text( + "月报", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B), + ), + ), + ),), + Expanded(child:Container( + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + // color: Color(0xFF30415B), + ), + padding: EdgeInsets.symmetric(vertical:9.h), + child: Text( + "自定义", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF30415B), + ), + ), + ),), + ], + ), + ) + ], + )), + ),) + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index a055da2d..9c7e631a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -88,6 +88,7 @@ import 'business_system/business_page.dart'; import 'business_system/home/business_home_page.dart'; import 'business_system/home/flow_page.dart'; import 'business_system/home/select_shop.dart'; +import 'business_system/home/trade_overview_page.dart'; import 'business_system/login/business_login_page.dart'; import 'community/community_view/class_details.dart'; import 'community/headlines/headlines_column_details.dart'; @@ -453,4 +454,7 @@ Map routers = { FlowPage(), '/router/select_shop': (context, {arguments}) => SelectShop(), + '/router/trade_overview_page': (context, {arguments}) => + TradeOverviewPage(), + };