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.
 
 
 
 
 
 

243 lines
9.2 KiB

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/business_login_info.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 {
int choiceIndex = 0;
BusinessLoginInfo businessLoginInfo;
int selectStoreIndex = 0;
@override
void initState() {
super.initState();
businessLoginInfo = widget?.arguments["businessLoginInfo"];
selectStoreIndex = widget.arguments["selectStoreIndex"] ?? 0;
}
@override
Widget build(BuildContext context) {
super.build(context);
return Stack(
children: [
Container(
color: Color(0xFFF7F7F7),
),
Stack(
children: [
if (choiceIndex == 0)
BusinessHomePage(businessLoginInfo, selectStoreIndex, (index) {
setState(() {
selectStoreIndex = index;
});
}),
if (choiceIndex == 1) BusinessOrderPage(),
if (choiceIndex == 2) BusinessOrderPage(),
if (choiceIndex == 3) BusinessGoodsPage(),
if (choiceIndex == 4) BusinessMinePage(),
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 85.h,
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.only(top: 20.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
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(
behavior: HitTestBehavior.opaque,
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(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
choiceIndex = 2;
});
},
child: Image.asset(
"assets/image/business_scan_code.webp",
width: 52,
height: 52,
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
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(
behavior: HitTestBehavior.opaque,
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;
}