You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
225 lines
8.7 KiB
225 lines
8.7 KiB
2 years ago
|
import 'package:dio/dio.dart';
|
||
|
import 'package:flutter/cupertino.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||
|
import 'package:huixiang/business_system/goods/business_goods_page.dart';
|
||
|
import 'package:huixiang/business_system/mine/business_mine_page.dart';
|
||
|
import 'package:huixiang/business_system/order/business_order_page.dart';
|
||
|
import 'package:huixiang/generated/l10n.dart';
|
||
|
import 'package:huixiang/retrofit/data/activity.dart';
|
||
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
||
|
import 'package:huixiang/retrofit/data/store_info.dart';
|
||
|
import 'package:huixiang/retrofit/min_api.dart';
|
||
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
||
|
import 'package:huixiang/store/shopping/shopping_cart/shopping_cart_page.dart';
|
||
|
import 'package:huixiang/store/shopping/shopping_home/shopping_home_page.dart';
|
||
|
import 'package:huixiang/utils/font_weight.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||
|
|
||
|
import 'home/business_home_page.dart';
|
||
|
|
||
|
class BusinessPage extends StatefulWidget {
|
||
|
final arguments;
|
||
|
|
||
|
BusinessPage({this.arguments});
|
||
|
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _BusinessPage();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _BusinessPage extends State<BusinessPage>
|
||
|
with AutomaticKeepAliveClientMixin {
|
||
|
ApiService apiService;
|
||
|
MinApiService minService;
|
||
|
int choiceIndex = 0;
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
super.build(context);
|
||
|
return Stack(
|
||
|
children: [
|
||
|
Container(
|
||
|
color: Color(0xFFF7F7F7),
|
||
|
),
|
||
|
Stack(
|
||
|
children: [
|
||
|
if(choiceIndex == 0)
|
||
|
BusinessHomePage(),
|
||
|
|
||
|
if(choiceIndex == 1)
|
||
|
BusinessOrderPage(),
|
||
|
|
||
|
if(choiceIndex == 2)
|
||
|
BusinessHomePage(),
|
||
|
|
||
|
if(choiceIndex == 3)
|
||
|
BusinessGoodsPage(),
|
||
|
|
||
|
if(choiceIndex == 4)
|
||
|
BusinessMinePage(),
|
||
|
|
||
|
Align(
|
||
|
alignment: Alignment.bottomCenter,
|
||
|
child: Container(
|
||
|
height:95.h,
|
||
|
width: double.infinity,
|
||
|
padding: EdgeInsets.only(top: 30.h),
|
||
|
child: Row(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
choiceIndex = 0;
|
||
|
});
|
||
|
},
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
choiceIndex == 0
|
||
|
? "assets/image/business_home.webp"
|
||
|
: "assets/image/business_ home_h.webp",
|
||
|
width: 30,
|
||
|
height: 30,
|
||
|
),
|
||
|
SizedBox(height: 5.h,),
|
||
|
Text(
|
||
|
"首页",
|
||
|
style: TextStyle(
|
||
|
fontSize: 10.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
color: choiceIndex == 0
|
||
|
? Color(0xFF4C4C4C)
|
||
|
: Color(0xFFACACAC),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
)),
|
||
|
),
|
||
|
Expanded(
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
choiceIndex = 1;
|
||
|
});
|
||
|
},
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
(choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4)
|
||
|
? "assets/image/business_order_h.webp"
|
||
|
: "assets/image/business_order.webp",
|
||
|
width: 30,
|
||
|
height: 30,
|
||
|
),
|
||
|
SizedBox(height: 5.h,),
|
||
|
Text(
|
||
|
"订单",
|
||
|
style: TextStyle(
|
||
|
fontSize: 10.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
color: (choiceIndex == 0 || choiceIndex == 2 || choiceIndex == 3 || choiceIndex == 4)
|
||
|
? Color(0xFFACACAC)
|
||
|
: Color(0xFF4C4C4C),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
)),
|
||
|
Expanded(
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
choiceIndex = 2;
|
||
|
});
|
||
|
},
|
||
|
child: Image.asset(
|
||
|
"assets/image/business_scan_code.webp",
|
||
|
width: 52,
|
||
|
height: 52,
|
||
|
),
|
||
|
)),
|
||
|
Expanded(
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
choiceIndex = 3;
|
||
|
});
|
||
|
},
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
(choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4)
|
||
|
? "assets/image/business_goods_h.webp"
|
||
|
: "assets/image/business_goods.webp",
|
||
|
width: 30,
|
||
|
height: 30,
|
||
|
),
|
||
|
SizedBox(height: 5.h,),
|
||
|
Text(
|
||
|
"商品",
|
||
|
style: TextStyle(
|
||
|
fontSize: 10.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 4)
|
||
|
? Color(0xFFACACAC)
|
||
|
: Color(0xFF4C4C4C),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
)),
|
||
|
Expanded(
|
||
|
child: GestureDetector(
|
||
|
onTap: () {
|
||
|
setState(() {
|
||
|
choiceIndex = 4;
|
||
|
});
|
||
|
},
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Image.asset(
|
||
|
(choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3)
|
||
|
? "assets/image/business_mine_h.webp"
|
||
|
: "assets/image/business_mine.webp",
|
||
|
width: 30,
|
||
|
height: 30,
|
||
|
),
|
||
|
SizedBox(height: 5.h,),
|
||
|
Text(
|
||
|
"我的",
|
||
|
style: TextStyle(
|
||
|
fontSize: 10.sp,
|
||
|
fontWeight: MyFontWeight.semi_bold,
|
||
|
color: (choiceIndex == 0 || choiceIndex == 1 || choiceIndex == 2 || choiceIndex == 3)
|
||
|
? Color(0xFFACACAC)
|
||
|
: Color(0xFF4C4C4C),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
bool get wantKeepAlive => true;
|
||
|
}
|