# Conflicts:
#	lib/const/resource.dart
#	lib/constants/api.dart
#	lib/pages/splash/splash_page.dart
hmxc
章文轩 3 years ago
commit 7539d545a7

1
.gitignore vendored

@ -30,6 +30,7 @@
/dev/docs/pubspec.yaml /dev/docs/pubspec.yaml
/packages/flutter/coverage/ /packages/flutter/coverage/
version version
/tool/config.dart
# packages file containing multi-root paths # packages file containing multi-root paths
.packages.generated .packages.generated

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

@ -338,15 +338,11 @@ class _Manager {
String get sharePayRecord => String get sharePayRecord =>
'/user/meterReadingShareDetails/findAllMeterShareOrderByTel'; '/user/meterReadingShareDetails/findAllMeterShareOrderByTel';
/// ///
String get houseType => String get houseType => '/user/houseTypeDescription/list';
'/user/houseTypeDescription/list';
/// ///
String get surroundingEnterprises => String get surroundingEnterprises => '/user/surroundingEnterprises/list';
'/user/surroundingEnterprises/list';
///+ ///+
String get findUnpaidAmount => String get findUnpaidAmount =>
@ -465,8 +461,6 @@ class _Market {
///appid ///appid
String get orderDetail => '/user/shop/findOrderDetailByOrderId'; String get orderDetail => '/user/shop/findOrderDetailByOrderId';
/// ///
///jcook ///jcook
String get findGoodsList => '/user/jcookGoods/findRecommendGoodsList'; String get findGoodsList => '/user/jcookGoods/findRecommendGoodsList';
@ -480,11 +474,9 @@ class _Market {
///jcook ///jcook
String get settledBrandsNum => '/user/jcookGoods/settledBrandsNum'; String get settledBrandsNum => '/user/jcookGoods/settledBrandsNum';
///jcook SKU ///jcook SKU
String get skuTotal => '/user/jcookGoods/skuTotal'; String get skuTotal => '/user/jcookGoods/skuTotal';
///jcook ///jcook
String get newProductsTodayNum => '/user/jcookGoods/newProductsTodayNum'; String get newProductsTodayNum => '/user/jcookGoods/newProductsTodayNum';
@ -492,16 +484,19 @@ class _Market {
String get findMaxPopularity => '/user/jcookGoods/findMaxPopularity'; String get findMaxPopularity => '/user/jcookGoods/findMaxPopularity';
///jcook id ///jcook id
String get findAllCategoryByParentId => '/user/jcookGoods/findAllCategoryByParentId'; String get findAllCategoryByParentId =>
'/user/jcookGoods/findAllCategoryByParentId';
///jcook bigInfo ///jcook bigInfo
String get findGoodsDetailBigInfo => '/user/jcookGoods/findGoodsDetailBigInfo'; String get findGoodsDetailBigInfo =>
'/user/jcookGoods/findGoodsDetailBigInfo';
///jcook ///jcook
String get findAllBrand => '/user/jcookGoods/findAllBrand'; String get findAllBrand => '/user/jcookGoods/findAllBrand';
///jcook ///jcook
String get findRecommendGoodsList => '/user/jcookGoods/findRecommendGoodsList'; String get findRecommendGoodsList =>
'/user/jcookGoods/findRecommendGoodsList';
///jcook ///jcook
String get findGoodsDetail => '/user/jcookGoods/findGoodsDetail'; String get findGoodsDetail => '/user/jcookGoods/findGoodsDetail';
@ -513,7 +508,8 @@ class _Market {
String get insertShoppingCart => '/user/jcookShoppingCat/insertShoppingCart'; String get insertShoppingCart => '/user/jcookShoppingCat/insertShoppingCart';
///jcook ///jcook
String get updateShoppingCartNum => '/user/jcookShoppingCat/updateShoppingCartNum'; String get updateShoppingCartNum =>
'/user/jcookShoppingCat/updateShoppingCartNum';
///jcook ///jcook
String get deleteShoppingCart => '/user/jcookShoppingCat/deleteShoppingCart'; String get deleteShoppingCart => '/user/jcookShoppingCat/deleteShoppingCart';
@ -524,12 +520,24 @@ class _Market {
///jcook ///jcook
String get myOrder => '/user/jcookOrder/myOrder'; String get myOrder => '/user/jcookOrder/myOrder';
///jcook
String get shopCarList => '/user/jcookShoppingCat/myShoppingCart';
///jcook
String get shopCarAdd => '/user/jcookShoppingCat/insertShoppingCart';
///jcook 4 ///jcook 4
String get findAllCategoryInfo => '/user/jcookGoods/findAllCategoryInfo'; String get findAllCategoryInfo => '/user/jcookGoods/findAllCategoryInfo';
///jcook
String get shopCarChangeNum => '/user/jcookShoppingCat/updateShoppingCartNum';
///jcook
String get shopCarDelete => '/user/jcookShoppingCat/deleteShoppingCart';
///jcook
String get shopCarSettlement => '/user/jcookShoppingCat/settlement';
} }
class _Upload { class _Upload {

@ -0,0 +1,38 @@
import 'package:aku_community/ui/market/shop_car/shop_car_func.dart';
import 'package:json_annotation/json_annotation.dart';
part 'shop_car_list_model.g.dart';
@JsonSerializable()
class ShopCarListModel {
final int id;
final String skuName;
final String mainPhoto;
//0.1.()
final int status;
//0.1.jcook
final int shopStatus;
final double sellPrice;
final double discountPrice;
final String unit;
// 0= 1= 2= ,
final int kind;
final double weight;
final int num;
factory ShopCarListModel.fromJson(Map<String, dynamic> json) =>
_$ShopCarListModelFromJson(json);
GoodStatus get goodStatus => ShopCarFunc.getGoodsStatus(status, shopStatus);
const ShopCarListModel({
required this.id,
required this.skuName,
required this.mainPhoto,
required this.status,
required this.shopStatus,
required this.sellPrice,
required this.discountPrice,
required this.unit,
required this.kind,
required this.weight,
required this.num,
});
}

@ -0,0 +1,23 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'shop_car_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ShopCarListModel _$ShopCarListModelFromJson(Map<String, dynamic> json) {
return ShopCarListModel(
id: json['id'] as int,
skuName: json['skuName'] as String,
mainPhoto: json['mainPhoto'] as String,
status: json['status'] as int,
shopStatus: json['shopStatus'] as int,
sellPrice: (json['sellPrice'] as num).toDouble(),
discountPrice: (json['discountPrice'] as num).toDouble(),
unit: json['unit'] as String,
kind: json['kind'] as int,
weight: (json['weight'] as num).toDouble(),
num: json['num'] as int,
);
}

@ -1,48 +1,46 @@
// Dart imports: // Dart imports:
import 'package:aku_community/constants/application_objects.dart'; import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/activity_item_model.dart';
import 'package:aku_community/model/community/board_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/pages/home/widget/animate_app_bar.dart';
import 'package:aku_community/pages/life_pay/life_pay_choose_page.dart'; import 'package:aku_community/pages/life_pay/life_pay_choose_page.dart';
import 'package:aku_community/pages/message_center_page/message_center_page.dart';
import 'package:aku_community/pages/one_alarm/widget/alarm_page.dart'; import 'package:aku_community/pages/one_alarm/widget/alarm_page.dart';
import 'package:aku_community/pages/things_page/fixed_submit_page.dart'; import 'package:aku_community/pages/things_page/fixed_submit_page.dart';
import 'package:aku_community/pages/visitor_access_page/visitor_access_page.dart'; import 'package:aku_community/pages/visitor_access_page/visitor_access_page.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/activity/activity_card.dart';
import 'package:aku_community/ui/community/activity/activity_list_page.dart';
import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/community/facility/facility_appointment_page.dart'; import 'package:aku_community/ui/community/facility/facility_appointment_page.dart';
import 'package:aku_community/ui/home/application/all_application.dart'; import 'package:aku_community/ui/home/application/all_application.dart';
import 'package:aku_community/ui/home/home_notification.dart';
import 'package:aku_community/ui/home/home_title.dart';
import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_community/ui/manager/advice/advice_page.dart'; import 'package:aku_community/ui/manager/advice/advice_page.dart';
import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/ui/search/bee_search.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/login_util.dart';
import 'package:aku_community/widget/animated/OverlayWidget.dart'; import 'package:aku_community/widget/animated/OverlayWidget.dart';
import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:aku_community/widget/others/user_tool.dart';
import 'package:badges/badges.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:badges/badges.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/community/activity_item_model.dart';
import 'package:aku_community/model/community/board_model.dart';
import 'package:aku_community/pages/home/widget/animate_app_bar.dart';
import 'package:aku_community/pages/message_center_page/message_center_page.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/activity/activity_card.dart';
import 'package:aku_community/ui/community/activity/activity_list_page.dart';
import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/home/home_notification.dart';
import 'package:aku_community/ui/home/home_title.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/login_util.dart';
import 'widget/home_search.dart'; import 'widget/home_search.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key); HomePage({Key? key}) : super(key: key);
@ -53,7 +51,6 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
int _currentIndicator = 0; int _currentIndicator = 0;
ScrollController? _scrollController; ScrollController? _scrollController;
@ -66,6 +63,7 @@ class _HomePageState extends State<HomePage>
int commentCount = 0; int commentCount = 0;
int sysCount = 0; int sysCount = 0;
int sum = 0; int sum = 0;
// ActivityItemModel? _activityItemModel; // ActivityItemModel? _activityItemModel;
List<ActivityItemModel> _activityItemModels = []; List<ActivityItemModel> _activityItemModels = [];
List<BoardItemModel> _boardItemModels = []; List<BoardItemModel> _boardItemModels = [];
@ -74,6 +72,15 @@ class _HomePageState extends State<HomePage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (UserTool.userProvider.isLogin) {
try {
JPush().setAlias(UserTool.userProvider.userInfoModel!.id.toString());
LoggerData.addData(
'setAlias ${UserTool.userProvider.userInfoModel!.id} ${DateTime.now()}');
} catch (e) {
LoggerData.addData('${e.toString()} ${DateTime.now()}');
}
}
_scrollController = ScrollController(); _scrollController = ScrollController();
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
} }
@ -96,7 +103,7 @@ class _HomePageState extends State<HomePage>
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: AnimateAppBar( appBar: AnimateAppBar(
scrollController: _scrollController, scrollController: _scrollController,
actions: [ actions: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.to(() => BeeSearch()); Get.to(() => BeeSearch());
@ -171,8 +178,7 @@ class _HomePageState extends State<HomePage>
HomeSwiper(), // HomeSwiper(), //
// SizedBox(height: 100.w), // SizedBox(height: 100.w),
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(top: 24.w, bottom: 32.w),
top: 24.w, bottom: 32.w),
child: getFunction(), //ApplicationView(), child: getFunction(), //ApplicationView(),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -194,7 +200,8 @@ class _HomePageState extends State<HomePage>
SliverToBoxAdapter( SliverToBoxAdapter(
child: Container( child: Container(
height: 40, height: 40,
margin: EdgeInsets.only(left: 32.w, right: 32.w, top: 24.w), margin:
EdgeInsets.only(left: 32.w, right: 32.w, top: 24.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius: BorderRadius.all(Radius.circular(8)),
@ -219,9 +226,9 @@ class _HomePageState extends State<HomePage>
height: 150, height: 150,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
fit: BoxFit.fill, fit: BoxFit.fill,
image: image: AssetImage(R.ASSETS_IMAGES_CARD_YELLOW_PNG),
AssetImage(R.ASSETS_IMAGES_CARD_YELLOW_PNG),)), )),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -236,50 +243,53 @@ class _HomePageState extends State<HomePage>
Text( Text(
'一键分享', '一键分享',
style: TextStyle( style: TextStyle(
color: Color(0x73000000), color: Color(0x73000000),
fontSize: 20.sp, fontSize: 20.sp,
), ),
), ),
Text( Text(
'让拜访不再是难事', '让拜访不再是难事',
style: TextStyle( style: TextStyle(
color: Color(0x73000000), color: Color(0x73000000),
fontSize: 20.sp, fontSize: 20.sp,
), ),
), ),
Spacer(), Spacer(),
Image.asset(R.ASSETS_ICONS_ICON_MAIN_INVITE_PNG,width: 100.w,height: 100.w,), Image.asset(
R.ASSETS_ICONS_ICON_MAIN_INVITE_PNG,
width: 100.w,
height: 100.w,
),
30.hb, 30.hb,
], ],
), ),
), ),
onTap: (){ onTap: () {
Get.to(VisitorAccessPage()); Get.to(VisitorAccessPage());
}, },
), ),
25.wb, 25.wb,
Container( Container(
margin: EdgeInsets.only(top: 24.w), margin: EdgeInsets.only(top: 24.w),
child: Column( child: Column(
children: [ children: [
GestureDetector( GestureDetector(
child: Container( child: Container(
width: 190, width: 190,
height: 69, height: 69,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
fit: BoxFit.fill, fit: BoxFit.fill,
image: AssetImage(R.ASSETS_IMAGES_CARD_PINK_PNG), image:
AssetImage(R.ASSETS_IMAGES_CARD_PINK_PNG),
)), )),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
20.wb, 20.wb,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
20.hb, 20.hb,
Text( Text(
@ -300,12 +310,16 @@ class _HomePageState extends State<HomePage>
], ],
), ),
Spacer(), Spacer(),
Image.asset(R.ASSETS_ICONS_ICON_MAIN_POLICE_PNG,width: 98.w,height: 98.w,), Image.asset(
R.ASSETS_ICONS_ICON_MAIN_POLICE_PNG,
width: 98.w,
height: 98.w,
),
20.wb, 20.wb,
], ],
), ),
), ),
onTap: (){ onTap: () {
Get.to(AlarmPage()); Get.to(AlarmPage());
}, },
), ),
@ -316,15 +330,17 @@ class _HomePageState extends State<HomePage>
height: 69, height: 69,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
fit: BoxFit.fill, fit: BoxFit.fill,
image: AssetImage(R.ASSETS_IMAGES_CARD_BLUE_PNG), image:
)), AssetImage(R.ASSETS_IMAGES_CARD_BLUE_PNG),
)),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
20.wb, 20.wb,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
20.hb, 20.hb,
Text( Text(
@ -345,79 +361,81 @@ class _HomePageState extends State<HomePage>
], ],
), ),
Spacer(), Spacer(),
Image.asset(R.ASSETS_ICONS_ICON_MAIN_CONSULT_PNG,width: 98.w,height: 98.w,), Image.asset(
R.ASSETS_ICONS_ICON_MAIN_CONSULT_PNG,
width: 98.w,
height: 98.w,
),
20.wb, 20.wb,
], ],
), ),
), ),
onTap: (){ onTap: () {
Get.to(AdvicePage(type: AdviceType.SUGGESTION)); Get.to(AdvicePage(type: AdviceType.SUGGESTION));
}, },
) )
], ],
), ),
) )
], ],
), ),
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(
children: [ children: [
// HomeTitle( // HomeTitle(
// title: '公共资讯', // title: '公共资讯',
// suffixTitle: '更多资讯', // suffixTitle: '更多资讯',
// onTap: () async { // onTap: () async {
// final cancel = BotToast.showLoading(); // final cancel = BotToast.showLoading();
// BaseModel model = await NetUtil().get(API.news.category); // BaseModel model = await NetUtil().get(API.news.category);
// List<NewsCategoryModel>? category; // List<NewsCategoryModel>? category;
// if (model.status == true && model.data != null) { // if (model.status == true && model.data != null) {
// category = (model.data as List) // category = (model.data as List)
// .map((e) => NewsCategoryModel.fromJson(e)) // .map((e) => NewsCategoryModel.fromJson(e))
// .toList(); // .toList();
// } // }
// cancel(); // cancel();
// Get.to( // Get.to(
// () => PublicInfomationPage(models: category ?? [])); // () => PublicInfomationPage(models: category ?? []));
// }, // },
// ), // ),
HomeTitle( HomeTitle(
title: '社区活动', title: '社区活动',
suffixTitle: '查看全部', suffixTitle: '查看全部',
onTap: () => Get.to(() => ActivityListPage()), onTap: () => Get.to(() => ActivityListPage()),
), ),
_activityItemModels == [] _activityItemModels == []
? SizedBox() ? SizedBox()
:Container( : Container(
height: 400.w, height: 400.w,
padding: EdgeInsets.only(left: 32.w), padding: EdgeInsets.only(left: 32.w),
child: ListView.separated( child: ListView.separated(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return SizedBox(width: 16.w,); return SizedBox(
}, width: 16.w,
scrollDirection: Axis.horizontal, );
itemBuilder: (context, index) { },
return Container( scrollDirection: Axis.horizontal,
width: 500.w, itemBuilder: (context, index) {
child: Builder( return Container(
builder: (context) { width: 500.w,
child: Builder(
return ActivityCard(model: _activityItemModels[index]); builder: (context) {
return ActivityCard(
}, model: _activityItemModels[index]);
), },
); ),
}, );
itemCount: _activityItemModels.length, },
), itemCount: _activityItemModels.length,
), ),
// : ActivityCard(model: _activityItemModel) ),
// .pSymmetric(h: 24.w, v: 24.w), // : ActivityCard(model: _activityItemModel)
], // .pSymmetric(h: 24.w, v: 24.w),
) ],
), )),
], ],
), ),
), ),
@ -473,8 +491,7 @@ class _HomePageState extends State<HomePage>
Widget getSwiperImage(SwiperModel swiperModel) { Widget getSwiperImage(SwiperModel swiperModel) {
return Container( return Container(
child: child: FadeInImage.assetNetwork(
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(swiperModel.voResourcesImgList)), image: API.image(ImgModel.first(swiperModel.voResourcesImgList)),
fit: BoxFit.fill, fit: BoxFit.fill,

@ -3,12 +3,14 @@ import 'dart:io';
import 'package:aku_community/const/resource.dart'; import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/user/ProvinceModel.dart'; import 'package:aku_community/model/user/ProvinceModel.dart';
import 'package:aku_community/main_initialize.dart';
import 'package:aku_community/pages/setting_page/agreement_page/agreement_page.dart'; import 'package:aku_community/pages/setting_page/agreement_page/agreement_page.dart';
import 'package:aku_community/pages/setting_page/agreement_page/privacy_page.dart'; import 'package:aku_community/pages/setting_page/agreement_page/privacy_page.dart';
import 'package:aku_community/pages/tab_navigator.dart'; import 'package:aku_community/pages/tab_navigator.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/utils/developer_util.dart'; import 'package:aku_community/utils/developer_util.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/hive_store.dart'; import 'package:aku_community/utils/hive_store.dart';
import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
@ -23,11 +25,6 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/utils/headers.dart';
class SplashPage extends StatefulWidget { class SplashPage extends StatefulWidget {
SplashPage({Key? key}) : super(key: key); SplashPage({Key? key}) : super(key: key);
@ -116,7 +113,7 @@ class _SplashPageState extends State<SplashPage> {
super.initState(); super.initState();
PowerLogger.start( PowerLogger.start(
context, context,
debug:true //DeveloperUtil.dev, debug: DeveloperUtil.dev,
); );
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
List<ProvinceModel> _province = []; List<ProvinceModel> _province = [];
@ -154,73 +151,110 @@ class _SplashPageState extends State<SplashPage> {
await Permission.locationWhenInUse.request(); await Permission.locationWhenInUse.request();
} }
await _initOp(); await _initOp();
MainInitialize.initTheme();
MainInitialize.initWechat();
MainInitialize.initWebSocket();
Get.offAll(() => TabNavigator()); Get.offAll(() => TabNavigator());
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
color: Colors.white, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
Align( Align(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
child: child: Row(
Row( mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, children: [
children: [ Container(
Container( child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
child: Column( Text(
mainAxisAlignment: MainAxisAlignment.start, '\n',
children: [ style: TextStyle(
color: Color(0xFF000000),
Text('\n',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),), fontSize: 40.sp,
], height: 1.15),
),
],
),
margin: EdgeInsets.only(top: 450.w),
), ),
margin: EdgeInsets.only(top: 450.w), 25.wb,
Container(
), child: Column(
25.wb, mainAxisAlignment: MainAxisAlignment.start,
Container( children: [
child: Text(
Column( '\n便\n\n\n\n\n\n\n',
mainAxisAlignment: MainAxisAlignment.start, style: TextStyle(
children: [ color: Color(0xFF000000),
fontSize: 40.sp,
Text('\n便\n\n\n\n\n\n\n',style: TextStyle(color:Color(0xFF000000),fontSize: 40.sp,height: 1.15),), height: 1.15),
),
], ],
),
margin: EdgeInsets.only(top: 530.w),
),
25.wb,
Container(
height: 400.w,
width: 2.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x99000000), Color(0x00000000)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(2.w),
),
), ),
margin: EdgeInsets.only(top: 530.w),
),
], 25.wb,
) Container(
height: 400.w,
width: 2.w,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x99000000), Color(0x00000000)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(2.w),
),
),
],
)),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_TEXT_PNG,
width: 61.w,
height: 72.w,
fit: BoxFit.fill,
),
top: 410.w,
left: 275.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_RIGHT_TOP_PNG,
width: 185.w,
height: 249.w,
fit: BoxFit.fill,
),
top: 0.w,
right: 0.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_LEFT_BOTTOM_PNG,
width: 270.w,
height: 504.w,
fit: BoxFit.fill,
),
bottom: 224.w,
left: 0.w,
),
Positioned(
child: Image.asset(
R.ASSETS_IMAGES_CIRCLE_RIGHT_BOTTOM_PNG,
width: 88.w,
height: 180.w,
fit: BoxFit.fill,
),
bottom: 150.w,
right: 0.w,
), ),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_TEXT_PNG,width: 61.w,height: 72.w,fit: BoxFit.fill,),top: 410.w,left: 275.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_RIGHT_TOP_PNG,width: 185.w,height: 249.w,fit: BoxFit.fill,),top: 0.w,right: 0.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_LEFT_BOTTOM_PNG,width: 270.w,height: 504.w,fit: BoxFit.fill,),bottom: 224.w,left: 0.w,),
Positioned(child: Image.asset(R.ASSETS_IMAGES_CIRCLE_RIGHT_BOTTOM_PNG,width: 88.w,height: 180.w,fit: BoxFit.fill,),bottom: 150.w,right: 0.w,),
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: Container( child: Container(
@ -229,11 +263,20 @@ class _SplashPageState extends State<SplashPage> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Image.asset(R.ASSETS_IMAGES_SPLASH_LOGO_PNG,width: 140.w,height: 140.w,fit: BoxFit.fill,), Image.asset(
R.ASSETS_IMAGES_SPLASH_LOGO_PNG,
Text('小蜜蜂智慧社区',style: TextStyle(color:Color(0xD9000000),fontSize: 32.sp,fontWeight: FontWeight.bold),), width: 140.w,
height: 140.w,
fit: BoxFit.fill,
),
Text(
'小蜜蜂智慧社区',
style: TextStyle(
color: Color(0xD9000000),
fontSize: 32.sp,
fontWeight: FontWeight.bold),
),
], ],
), ),
), ),
) )

@ -1,6 +1,7 @@
// import 'package:aku_community/base/base_style.dart'; // import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/models/market/goods_classification.dart'; import 'package:aku_community/models/market/goods_classification.dart';
@ -9,37 +10,22 @@ import 'package:aku_community/models/market/order/goods_home_model.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/community_func.dart'; import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_community/ui/market/widget/animated_home_background.dart'; import 'package:aku_community/ui/market/widget/animated_home_background.dart';
import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/home/home_sliver_app_bar.dart'; import 'package:aku_community/widget/home/home_sliver_app_bar.dart';
import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart'; import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/display_category_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/ui/market/category/category_card.dart';
import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/ui/market/order/my_order_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'market_home_goods_card.dart'; import 'market_home_goods_card.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart'; // import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
@ -54,7 +40,7 @@ class MarketPage extends StatefulWidget {
} }
class _MarketPageState extends State<MarketPage> class _MarketPageState extends State<MarketPage>
with TickerProviderStateMixin,AutomaticKeepAliveClientMixin{ with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
late ScrollController _sliverListController; late ScrollController _sliverListController;
GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey(); GlobalKey<HomeSliverAppBarState> _sliverAppBarGlobalKey = GlobalKey();
@ -88,11 +74,14 @@ class _MarketPageState extends State<MarketPage>
int? orderByPrice; int? orderByPrice;
Future updateMarketInfo() async { Future updateMarketInfo() async {
BaseListModel baseListModel = await NetUtil().getList(
BaseListModel baseListModel = API.market.findRecommendGoodsList,
await NetUtil().getList( API.market.findRecommendGoodsList, params: {
params: {'pageNum': _pageNum, 'size': _size, 'pageNum': _pageNum,
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -103,10 +92,14 @@ class _MarketPageState extends State<MarketPage>
} }
Future loadMarketInfo() async { Future loadMarketInfo() async {
BaseListModel baseListModel = BaseListModel baseListModel = await NetUtil().getList(
await NetUtil().getList( API.market.findRecommendGoodsList, API.market.findRecommendGoodsList,
params: {'pageNum': _pageNum, 'size': _size, params: {
'orderBySalesVolume': orderBySalesVolume,'orderByPrice': orderByPrice,}, 'pageNum': _pageNum,
'size': _size,
'orderBySalesVolume': orderBySalesVolume,
'orderByPrice': orderByPrice,
},
); );
if (baseListModel.tableList!.isNotEmpty) { if (baseListModel.tableList!.isNotEmpty) {
_goodsHomeModelList = (baseListModel.tableList as List) _goodsHomeModelList = (baseListModel.tableList as List)
@ -119,18 +112,19 @@ class _MarketPageState extends State<MarketPage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
for(int i=0;i<10;i++){ for (int i = 0; i < 10; i++) {
_goodsClassificationList.add(GoodsClassification(id: 0,name: '',imgUrls: null)); _goodsClassificationList
.add(GoodsClassification(id: 0, name: '', imgUrls: null));
} }
for(int i=0;i<6;i++){ for (int i = 0; i < 6; i++) {
_goodsPopularModelList.add(GoodsPopularModel(id: 0,skuName: '',mainPhoto: '',viewsNum: 0)); _goodsPopularModelList.add(
GoodsPopularModel(id: 0, skuName: '', mainPhoto: '', viewsNum: 0));
} }
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
_sliverListController = ScrollController(); _sliverListController = ScrollController();
_tabController = TabController( _tabController = TabController(initialIndex: 0, length: 3, vsync: this);
initialIndex: 0, length: 3, vsync: this);
///appbar refresh ///appbar refresh
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
await updateMarketInfo(); await updateMarketInfo();
@ -149,11 +143,11 @@ class _MarketPageState extends State<MarketPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// super.build(context); super.build(context);
final mediaWidth = MediaQuery.of(context).size.width; final mediaWidth = MediaQuery.of(context).size.width;
return Scaffold( return Scaffold(
body:EasyRefresh( body: EasyRefresh(
firstRefresh: false, firstRefresh: false,
enableControlFinishLoad: false, enableControlFinishLoad: false,
header: MaterialHeader(), header: MaterialHeader(),
@ -170,31 +164,25 @@ class _MarketPageState extends State<MarketPage>
} }
setState(() {}); setState(() {});
}, },
child: _buildBody(context), child: _buildBody(context),
), ),
); );
} }
_refresh() async {
_refresh() async{
_pageNum = 1; _pageNum = 1;
await updateMarketInfo(); await updateMarketInfo();
_swiperModels = await CommunityFunc.swiper(); _swiperModels = await CommunityFunc.swiper();
_newTotal = await CommunityFunc.getNewProductsTodayNum(); _newTotal = await CommunityFunc.getNewProductsTodayNum();
_total = await CommunityFunc.getSkuTotal(); _total = await CommunityFunc.getSkuTotal();
_brandTotal = await CommunityFunc.getSettledBrandsNum(); _brandTotal = await CommunityFunc.getSettledBrandsNum();
_goodsClassificationList = await CommunityFunc.getGoodsClassificationList(0);//0 _goodsClassificationList =
await CommunityFunc.getGoodsClassificationList(0); //0
//_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); //_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6);
setState(() {}); setState(() {});
} }
Widget _buildBody(BuildContext context) { Widget _buildBody(BuildContext context) {
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () async { onPressed: () async {
@ -208,11 +196,10 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'综合', '综合',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.NORMAL ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp, fontSize: _orderType == OrderType.NORMAL ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.NORMAL fontWeight: _orderType == OrderType.NORMAL
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -231,11 +218,10 @@ class _MarketPageState extends State<MarketPage>
child: Text( child: Text(
'销量', '销量',
style: TextStyle( style: TextStyle(
color: color: _orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
_orderType == OrderType.SALES ? kBalckSubColor : ktextPrimary,
fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp, fontSize: _orderType == OrderType.SALES ? 32.sp : 28.sp,
fontWeight: _orderType == OrderType.SALES fontWeight: _orderType == OrderType.SALES
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -275,16 +261,16 @@ class _MarketPageState extends State<MarketPage>
'价格', '价格',
style: TextStyle( style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kBalckSubColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
fontSize: _orderType == OrderType.PRICE_HIGH || fontSize: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? 32.sp ? 32.sp
: 28.sp, : 28.sp,
fontWeight: _orderType == OrderType.PRICE_HIGH || fontWeight: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
?FontWeight.bold ? FontWeight.bold
: FontWeight.normal, : FontWeight.normal,
), ),
), ),
@ -292,7 +278,7 @@ class _MarketPageState extends State<MarketPage>
priceIcon, priceIcon,
size: 32.w, size: 32.w,
color: _orderType == OrderType.PRICE_HIGH || color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW _orderType == OrderType.PRICE_LOW
? kBalckSubColor ? kBalckSubColor
: ktextPrimary, : ktextPrimary,
), ),
@ -309,63 +295,67 @@ class _MarketPageState extends State<MarketPage>
actions: _actionsWidget(), actions: _actionsWidget(),
title: _buildTitle(), title: _buildTitle(),
backgroundColor: Colors.red, backgroundColor: Colors.red,
expandedHeight: MessageHeight+ expandedHeight: MessageHeight +
bannerHeight + bannerHeight +
buttonsHeight+ buttonsHeight +
searchHeight +tabBarHeight+ScreenUtil().statusBarHeight +kToolbarHeight+280.w, searchHeight +
tabBarHeight +
ScreenUtil().statusBarHeight +
kToolbarHeight +
280.w,
flexibleSpace: _flexibleSpaceBar(context), flexibleSpace: _flexibleSpaceBar(context),
bottom: PreferredSize(
bottom: PreferredSize( preferredSize: Size.fromHeight(tabBarHeight),
preferredSize: Size.fromHeight(tabBarHeight), child: _goodsTitle(
child: _goodsTitle( normalTypeButton, salesTypeButton, priceButton,) normalTypeButton,
)), salesTypeButton,
priceButton,
))),
SliverPadding( SliverPadding(
padding: EdgeInsets.all(10.w), padding: EdgeInsets.all(10.w),
), ),
SliverPadding( SliverPadding(
padding: EdgeInsets.only(left: 20.w,right: 20.w), padding: EdgeInsets.only(left: 20.w, right: 20.w),
sliver: buildSliverGrid(), sliver: buildSliverGrid(),
), ),
], ],
); );
} }
SliverGrid buildSliverGrid() { SliverGrid buildSliverGrid() {
return SliverGrid( return SliverGrid(
// child: WaterfallFlow.builder(
// child: WaterfallFlow.builder( // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( // crossAxisCount: 2,
// crossAxisCount: 2, // mainAxisSpacing: 20.w,
// mainAxisSpacing: 20.w, // crossAxisSpacing: 20.w,
// crossAxisSpacing: 20.w, // ),
// ), // padding: EdgeInsets.all(32.w),
// padding: EdgeInsets.all(32.w), // itemBuilder: (context, index) {
// itemBuilder: (context, index) { // final item = _hotItems[index];
// final item = _hotItems[index]; // return GoodsCard(item: item);
// return GoodsCard(item: item); // },
// }, // itemCount: _hotItems.length,
// itemCount: _hotItems.length, // ),
// ),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 20.w, mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w, crossAxisSpacing: 20.w,
childAspectRatio:0.57, childAspectRatio: 0.57,
), ),
///Item ///Item
delegate: new SliverChildBuilderDelegate( delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
///Item ///Item
return MarketHomeGoodsCard(item: _goodsHomeModelList[index]); return MarketHomeGoodsCard(item: _goodsHomeModelList[index]);
// return Container( // return Container(
// width: 200.w, // width: 200.w,
// height: 200.w, // height: 200.w,
// color: Colors.blue, // color: Colors.blue,
// ); // );
}, },
///Item ///Item
childCount: _goodsHomeModelList.length, childCount: _goodsHomeModelList.length,
), ),
@ -376,13 +366,13 @@ class _MarketPageState extends State<MarketPage>
return <Widget>[ return <Widget>[
GestureDetector( GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); Get.to(() => ShopCarPage()); //
}, },
child: Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, child:
height: 40.w, width: 40.w), Image.asset(R.ASSETS_ICONS_SHOP_CAR_PNG, height: 40.w, width: 40.w),
), ),
Padding( Padding(
padding: EdgeInsets.only( left: 32.w,right: 32.w), padding: EdgeInsets.only(left: 32.w, right: 32.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); //Get.to(() => BeeSearch());
@ -403,36 +393,36 @@ class _MarketPageState extends State<MarketPage>
//color: Colors.blue, //color: Colors.blue,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children:[ children: [
Container( Container(
height: 40.w, height: 40.w,
child: Flex( child: Flex(
direction: Axis.horizontal, direction: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Row( Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
crossAxisAlignment: CrossAxisAlignment.center, if (appProvider.location != null)
children: [ Padding(
if (appProvider.location != null) padding: EdgeInsets.only(right: 5.w, top: 5.w),
Padding( child: Image.asset(
padding:EdgeInsets.only(right: 5.w,top: 5.w), R.ASSETS_ICONS_SHOP_LOCATION_PNG,
child: Image.asset( width: 40.w,
R.ASSETS_ICONS_SHOP_LOCATION_PNG, height: 40.w,
width: 40.w, fit: BoxFit.fitHeight,
height: 40.w, //color: Colors.white,
fit: BoxFit.fitHeight,
//color: Colors.white,
),
),
Text(
appProvider.location?['city']==null?'':appProvider.location?['city'] as String? ?? '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: Colors.white,
),
//textAlign: TextAlign.center,
), ),
]), ),
Text(
appProvider.location?['city'] == null
? ''
: appProvider.location?['city'] as String? ?? '',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: Colors.white,
),
//textAlign: TextAlign.center,
),
]),
// Expanded( // Expanded(
// child: ges, // child: ges,
// ) // )
@ -449,25 +439,24 @@ class _MarketPageState extends State<MarketPage>
} }
FlexibleSpaceBar _flexibleSpaceBar(context) { FlexibleSpaceBar _flexibleSpaceBar(context) {
return FlexibleSpaceBar( return FlexibleSpaceBar(
collapseMode: CollapseMode.pin, collapseMode: CollapseMode.pin,
background: Container( background: Container(
// //
height: double.infinity, height: double.infinity,
color: Color(0xFFF9F9F9), color: Color(0xFFF9F9F9),
// color: Colors.white, // color: Colors.white,
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
AnimatedHomeBackground( AnimatedHomeBackground(
key: _animatedBackgroundState, key: _animatedBackgroundState,
height: 530.w, height: 530.w,
backgroundColor: Colors.white , backgroundColor: Colors.white,
), ),
Column( Column(
children: <Widget>[ children: <Widget>[
Container( Container(
height: ScreenUtil().statusBarHeight +kToolbarHeight, height: ScreenUtil().statusBarHeight + kToolbarHeight,
), ),
geSearch(), geSearch(),
20.hb, 20.hb,
@ -478,7 +467,6 @@ class _MarketPageState extends State<MarketPage>
_buttonTitle(), _buttonTitle(),
20.hb, 20.hb,
_recommend(), _recommend(),
], ],
), ),
], ],
@ -486,11 +474,10 @@ class _MarketPageState extends State<MarketPage>
); );
} }
geSearch() {
geSearch(){ return Container(
return Container( margin: EdgeInsets.symmetric(horizontal: 24.w),
margin: EdgeInsets.symmetric(horizontal: 24.w), child: MaterialButton(
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 74.w, height: 74.w,
shape: StadiumBorder(), shape: StadiumBorder(),
@ -512,63 +499,73 @@ class _MarketPageState extends State<MarketPage>
], ],
), ),
), ),
); );
} }
getNum(){ getNum() {
return Container( return Container(
margin: EdgeInsets.only(left: 18.w,right: 18.w), margin: EdgeInsets.only(left: 18.w, right: 18.w),
padding: EdgeInsets.only(right:8.w ), padding: EdgeInsets.only(right: 8.w),
height: 76.w, height: 76.w,
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12), ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12),
left: Radius.circular(12),
),
gradient: LinearGradient( gradient: LinearGradient(
begin: FractionalOffset.centerRight, begin: FractionalOffset.centerRight,
end: FractionalOffset.centerLeft, end: FractionalOffset.centerLeft,
colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)], colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)],
), ),
), ),
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
bottom: 5, bottom: 5,
right: 0, right: 0,
top: 5, top: 5,
child: Container( child: Container(
padding: EdgeInsets.only(top: 5.w,bottom: 5.w), padding: EdgeInsets.only(top: 5.w, bottom: 5.w),
alignment: Alignment.center, alignment: Alignment.center,
height: 61.w, height: 61.w,
width: 694.w, width: 694.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFDEEBF), color: Color(0xFFFDEEBF),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12) ), borderRadius: BorderRadius.horizontal(
right: Radius.circular(12), left: Radius.circular(12)),
), ),
child: Container( child: Container(
height: 50.w, height: 50.w,
width: 682.w, width: 682.w,
decoration: BoxDecoration( decoration: BoxDecoration(
//color: Color(0x99F5AF16), //color: Color(0x99F5AF16),
borderRadius: BorderRadius.horizontal(right: Radius.circular(12),left:Radius.circular(12)), borderRadius: BorderRadius.horizontal(
border: Border.all(width: 2.w,color: Color(0x99F5AF16)), right: Radius.circular(12), left: Radius.circular(12)),
border: Border.all(width: 2.w, color: Color(0x99F5AF16)),
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
80.wb, 80.wb,
Image.asset(R.ASSETS_ICONS_SHOP_LABA_PNG,width: 36.w,height: 34.w,), Image.asset(
R.ASSETS_ICONS_SHOP_LABA_PNG,
width: 36.w,
height: 34.w,
),
20.wb, 20.wb,
Text('今日上新${_total}',style: TextStyle(color: Color(0xFFD0564B),fontSize: 24.sp,height: 1.05),), Text(
'今日上新${_total}',
style: TextStyle(
color: Color(0xFFD0564B),
fontSize: 24.sp,
height: 1.05),
),
], ],
), ),
), ),
) )),
),
Positioned( Positioned(
left: 0, left: 0,
top: 0, top: 0,
@ -577,25 +574,28 @@ class _MarketPageState extends State<MarketPage>
height: 76.w, height: 76.w,
width: 258.w, width: 258.w,
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: FractionalOffset.centerLeft, begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight, end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)], colors: <Color>[Color(0xFFAD2222), Color(0xFFCD392B)],
), ),
borderRadius: BorderRadius.horizontal(right: Radius.circular(50),left: Radius.circular(24)) borderRadius: BorderRadius.horizontal(
), right: Radius.circular(50), left: Radius.circular(24))),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text('SKU总数${_newTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),), Text(
Text('入驻品牌数:${_brandTotal}',style: TextStyle(color: Colors.white,fontSize: 24.sp),) 'SKU总数${_newTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
Text(
'入驻品牌数:${_brandTotal}',
style: TextStyle(color: Colors.white, fontSize: 24.sp),
)
], ],
), ),
)), )),
], ],
), ),
); );
@ -618,21 +618,21 @@ class _MarketPageState extends State<MarketPage>
alignment: Alignment.bottomRight, alignment: Alignment.bottomRight,
builder: SwiperCustomPagination( builder: SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) { builder: (BuildContext context, SwiperPluginConfig config) {
return RectIndicator( return RectIndicator(
position: config.activeIndex, position: config.activeIndex,
count: _swiperModels.length, count: _swiperModels.length,
activeColor: Color(0x99FFFFFF), activeColor: Color(0x99FFFFFF),
color: Color(0xD9FFFFFF), color: Color(0xD9FFFFFF),
// keyColor // keyColor
width: 4, width: 4,
// //
activeWidth: 14, activeWidth: 14,
// //
radius: 4, radius: 4,
// //
height: 4, height: 4,
); // ); //
})), })),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
// control: new SwiperControl(), // control: new SwiperControl(),
autoplay: true, autoplay: true,
@ -652,12 +652,10 @@ class _MarketPageState extends State<MarketPage>
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12.w)), borderRadius: BorderRadius.all(Radius.circular(12.w)),
), ),
child: child: FadeInImage.assetNetwork(
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(swiperModel.voResourcesImgList)), image: API.image(ImgModel.first(swiperModel.voResourcesImgList)),
fit: BoxFit.fill, fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset( return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP, R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -668,7 +666,6 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buttonTitle() { _buttonTitle() {
Container titles = Container( Container titles = Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -676,23 +673,21 @@ class _MarketPageState extends State<MarketPage>
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: GridView.builder(
GridView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5), SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 5),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if(index == 9){ if (index == 9) {
return _buildAllTile(); return _buildAllTile();
}else{ } else {
return _buildTile(_goodsClassificationList[index]); return _buildTile(_goodsClassificationList[index]);
} }
}, },
itemCount: 10, itemCount: 10,
shrinkWrap: true, shrinkWrap: true,
), ),
); );
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
@ -703,10 +698,8 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_buildTile(GoodsClassification item) { _buildTile(GoodsClassification item) {
return GestureDetector( return GestureDetector(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -716,15 +709,18 @@ class _MarketPageState extends State<MarketPage>
height: 88.w, height: 88.w,
image: API.image(ImgModel.first(item.imgUrls)), image: API.image(ImgModel.first(item.imgUrls)),
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 88.w, return Image.asset(
width: 88.w,); R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 88.w,
width: 88.w,
);
}, },
), ),
8.hb, 8.hb,
Text( (item.name??'').replaceAll('', ''),style: TextStyle( Text(
fontSize: 28.sp, (item.name ?? '').replaceAll('', ''),
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -735,13 +731,16 @@ class _MarketPageState extends State<MarketPage>
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(R.ASSETS_ICONS_TEST_KINGCION_PNG,height: 88.w, Image.asset(
width: 88.w,), R.ASSETS_ICONS_TEST_KINGCION_PNG,
height: 88.w,
width: 88.w,
),
8.hb, 8.hb,
Text( '全部分类',style: TextStyle( Text(
fontSize: 28.sp, '全部分类',
color: ktextPrimary style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
),) )
], ],
), ),
); );
@ -750,14 +749,13 @@ class _MarketPageState extends State<MarketPage>
Widget getkingCoin() { Widget getkingCoin() {
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.symmetric(horizontal: 20.w,vertical: 20.w), padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
width: double.infinity, width: double.infinity,
height: buttonsHeight, height: buttonsHeight,
child:_buttonTitleRow(), child: _buttonTitleRow(),
); );
} }
_buttonTitleRow({onPressed}) { _buttonTitleRow({onPressed}) {
return Expanded( return Expanded(
child: CupertinoButton( child: CupertinoButton(
@ -765,21 +763,22 @@ class _MarketPageState extends State<MarketPage>
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
width: 88.w,
height: 88.w,
child: Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 88.w, width: 88.w,
height: 88.w, height: 88.w,
child: Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,width: 88.w,height: 88.w,), ),
// FadeInImage.assetNetwork( // FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: Api.getImgUrl(kingCoin.url),) // image: Api.getImgUrl(kingCoin.url),)
), ),
Container( Container(
margin: EdgeInsets.only(top: 6.w), margin: EdgeInsets.only(top: 6.w),
child: Text( child: Text(
'数码产品', '数码产品',
style: TextStyle( style: TextStyle(fontSize: 28.sp, color: Color(0xFF333333)),
fontSize: 28.sp,
color: Color(0xFF333333)),
), ),
) )
], ],
@ -793,122 +792,110 @@ class _MarketPageState extends State<MarketPage>
); );
} }
_recommend() {
_recommend(){
return Container( return Container(
height: 184.w, height: 184.w,
margin: EdgeInsets.only(left: 20.w,right: 20.w), margin: EdgeInsets.only(left: 20.w, right: 20.w),
padding: EdgeInsets.only(top: 8.w,left: 16.w,right: 16.w), padding: EdgeInsets.only(top: 8.w, left: 16.w, right: 16.w),
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(12.w), borderRadius: BorderRadius.circular(12.w),
), ),
child: child: Column(
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Text( Row(
'爆款推荐', mainAxisAlignment: MainAxisAlignment.start,
style: TextStyle( children: [
fontWeight: FontWeight.bold, Text(
fontSize: 28.sp, '爆款推荐',
color: ktextPrimary), style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: ktextPrimary),
),
],
), ),
], GridView.builder(
), padding: EdgeInsets.zero,
GridView.builder( physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero, gridDelegate:
physics: NeverScrollableScrollPhysics(), SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6),
gridDelegate: itemBuilder: (context, index) {
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 6), return Row(
itemBuilder: (context, index) { mainAxisAlignment: MainAxisAlignment.center,
return Row( children: [
mainAxisAlignment: MainAxisAlignment.center, Container(
children: [ width: 96.w,
Container( height: 96.w,
width: 96.w, child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: _goodsPopularModelList[index].mainPhoto ?? '',
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 96.w, height: 96.w,
child:FadeInImage.assetNetwork( width: 96.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, );
image: _goodsPopularModelList[index].mainPhoto??'', },
imageErrorBuilder: (context, error, stackTrace) { ),
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w, ),
width: 96.w,); ],
}, );
), },
), itemCount: 6,
shrinkWrap: true,
], ),
); // Row(
}, // mainAxisAlignment: MainAxisAlignment.center,
itemCount: 6, // children: [
shrinkWrap: true, // ..._goodsPopularModelList.map((e) => Row(
), // children: [
// Row( // Container(
// mainAxisAlignment: MainAxisAlignment.center, // width: 96.w,
// children: [ // height: 96.w,
// ..._goodsPopularModelList.map((e) => Row( // child:FadeInImage.assetNetwork(
// children: [ // placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// Container( // image: e.mainPhoto??'',
// width: 96.w, // imageErrorBuilder: (context, error, stackTrace) {
// height: 96.w, // return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w,
// child:FadeInImage.assetNetwork( // width: 96.w,);
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, // },
// image: e.mainPhoto??'', // ),
// imageErrorBuilder: (context, error, stackTrace) { // ),
// return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 96.w, // 20.wb,
// width: 96.w,); // ],
// }, // ),)
// ), // ],
// ), // ).expand(),
// 20.wb, ],
// ], ));
// ),)
// ],
// ).expand(),
],
)
);
} }
_goodsTitle(
Widget normalTypeButton,
Widget salesTypeButton,
Widget priceButton,
) {
_goodsTitle(Widget normalTypeButton,Widget salesTypeButton,Widget priceButton,){
return Container( return Container(
height: 90.w, height: 90.w,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
color: Color(0xFFF9F9F9), color: Color(0xFFF9F9F9),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: child: Container(
Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
child:Row( child: Row(
children: [ children: [
normalTypeButton, normalTypeButton,
salesTypeButton, salesTypeButton,
priceButton, priceButton,
], ],
), ),
), ),
); );
} }
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -0,0 +1,18 @@
class ShopCarFunc {
static GoodStatus getGoodsStatus(int jcook, int bee) {
if (jcook == 0) {
return GoodStatus.unSell;
} else {
if (bee == 0) {
return GoodStatus.unSell;
} else {
return GoodStatus.onSell;
}
}
}
}
enum GoodStatus {
onSell,
unSell,
}

@ -0,0 +1,496 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/shop_car/shop_car_list_model.dart';
import 'package:aku_community/ui/market/shop_car/shop_car_func.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/buttons/bee_check_radio.dart';
import 'package:aku_community/widget/buttons/end_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
class ShopCarPage extends StatefulWidget {
const ShopCarPage({Key? key}) : super(key: key);
@override
_ShopCarPageState createState() => _ShopCarPageState();
}
class _ShopCarPageState extends State<ShopCarPage> {
bool _editStatus = false;
List<TextEditingController> _controllers = [];
List<ShopCarListModel> _models = [];
//model
List<int> _selectIndex = [];
bool get _allSelect =>
_selectIndex.length == _models.length && _selectIndex.length != 0;
double get total {
var num = 0.0;
_selectIndex.forEach((element) {
num += _models[element].sellPrice;
});
return num;
}
@override
void dispose() {
_controllers.forEach((element) {
element.dispose();
});
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
backgroundColor: Color(0xFFF9F9F9),
titleSpacing: 0,
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
GestureDetector(
onTap: () {
Get.back();
},
child: Material(
child: Align(
alignment: Alignment.centerLeft,
child: Icon(
CupertinoIcons.back,
size: 48.w,
),
),
),
),
'购物车'.text.size(32.sp).black.bold.make(),
],
),
actions: [
TextButton(
onPressed: () {
_editStatus = !_editStatus;
},
child: (_editStatus ? '完成' : '管理')
.text
.size(32.sp)
.black
.bold
.make())
],
),
body: SafeArea(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
10.widthBox,
'${_models.length}件商品'.text.size(28.sp).black.make(),
],
),
16.heightBox,
Expanded(
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
var base = await NetUtil().get(API.market.shopCarList);
if (base.status ?? false) {
_models = (base.data as List)
.map((e) => ShopCarListModel.fromJson(e))
.toList();
_controllers.forEach((element) {
element.dispose();
});
_controllers.clear();
_models.forEach((element) {
_controllers.add(
TextEditingController(text: element.num.toString()));
});
}
if (mounted) {
setState(() {});
}
},
child: _models.isEmpty
? _emptyWidget()
: ListView(
shrinkWrap: true,
children: _models
.mapIndexed((e, index) => _goodCard(e, index))
.toList()),
),
)
],
),
),
bottomNavigationBar: Container(
width: double.infinity,
height: 100.w,
color: Colors.white,
child: Row(
children: [
10.widthBox,
GestureDetector(
onTap: () {
if (_allSelect) {
_selectIndex.clear();
} else {
_selectIndex.clear();
_selectIndex
.addAll(List.generate(_models.length, (index) => index));
}
setState(() {});
},
child: Container(
width: 44.w,
height: 44.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22.w),
border: Border.all(color: Color(0xFFBBBBBB))),
child: AnimatedOpacity(
duration: Duration(milliseconds: 500),
opacity: _allSelect ? 1 : 0,
child: Container(
width: 24.w,
height: 24.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.w),
color: Color(0xFFE52E2E),
),
),
),
),
),
8.w.widthBox,
Spacer(),
Offstage(
offstage: _editStatus,
child: '合计:'
.richText
.withTextSpanChildren([
'¥${total}'
.textSpan
.color(ktextSubColor)
.size(28.sp)
.make(),
])
.black
.size(28.sp)
.make(),
),
20.widthBox,
EndButton(
onPressed: _editStatus ? _delete : _settleEnd,
text: (_editStatus ? '删除' : '结算')
.text
.size(32.sp)
.color(Colors.white)
.make()),
10.widthBox,
],
),
),
);
}
Future _settleEnd() async {}
Future _delete() async {
await NetUtil().post(
API.market.shopCarDelete,
params: {
'jcookGoodsIds': _selectIndex.map((e) => _models[e].id).toList()
},
showMessage: true,
);
}
Widget _goodCard(ShopCarListModel model, int index) {
var top = RichText(
text: TextSpan(children: [
WidgetSpan(
child: _getKindWd(model.kind),
),
TextSpan(
text: model.skuName,
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
]),
maxLines: 2,
overflow: TextOverflow.ellipsis,
);
var mid = Container(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.w), color: Color(0xFFF2F3F4)),
child: '规格:${model.weight}kg/${model.unit}'
.text
.size(24.sp)
.color(Color(0xFFBBBBBB))
.make(),
);
var bottom = Row(
children: [
'¥'
.richText
.withTextSpanChildren([
model.sellPrice
.toInt()
.toString()
.textSpan
.size(40.sp)
.color(Color(0xFFE52E2E))
.make(),
'.${_getPointBehind(model.sellPrice)}'
.textSpan
.size(28.sp)
.color(Color(0xFFE52E2E))
.make()
])
.color(Color(0xFFE52E2E))
.size(28.sp)
.make(),
Spacer(),
_getBottomSuffix(model.goodStatus, model.id, index)
],
);
return Container(
alignment: Alignment.center,
height: 260.w,
margin: EdgeInsets.symmetric(horizontal: 20.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
if (_selectIndex.contains(model.id)) {
_selectIndex.remove(index);
} else {
_selectIndex.add(index);
}
setState(() {});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 16.w),
height: double.infinity,
alignment: Alignment.center,
child: BeeCheckRadio(
value: model.id,
groupValue: _selectIndex,
backColor: Colors.white,
indent: Container(
width: 24.w,
height: 24.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.w),
color: Color(0xFFE52E2E),
),
),
),
),
),
Container(
width: 220.w,
height: 220.w,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w),
image: DecorationImage(
fit: BoxFit.scaleDown,
image: NetworkImage(API.image(model.mainPhoto)))),
child: _getGoodsStatusImg(model.goodStatus),
),
16.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
20.heightBox,
top,
8.heightBox,
mid,
Spacer(),
bottom,
10.heightBox,
],
).expand(),
16.widthBox,
],
),
);
}
String _getPointBehind(double num) {
var str = (num - num.toInt().toDouble()).toStringAsFixed(2);
return str.substring(str.length - 2);
}
Widget _getKindWd(int kind) {
switch (kind) {
case 1:
return Container(
// width: 90.w,
// height: 26.w,
padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 2.w),
margin: EdgeInsets.only(right: 10.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.w),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
child: '京东自营'.text.size(18.sp).color(Colors.white).make());
case 2:
return Container(
width: 90.w,
height: 26.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
child: '其他'.text.size(18.sp).color(Colors.white).make());
default:
return SizedBox();
}
}
Widget? _getGoodsStatusImg(GoodStatus status) {
switch (status) {
case GoodStatus.onSell:
return Container(
width: double.infinity,
height: double.infinity,
color: Color(0xFF000000).withOpacity(0.5),
alignment: Alignment.center,
child: Text(
'已下架',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 28.sp,
color: Colors.white),
),
);
case GoodStatus.unSell:
return null;
}
}
Widget _getBottomSuffix(GoodStatus status, int id, int index) {
switch (status) {
case GoodStatus.onSell:
return Container(
width: 108.w + 64.w,
height: 40.w,
child: Row(
children: [
GestureDetector(
onTap: () async {
int num = int.parse(_controllers[index].text);
var result = await changeNum(id, num - 1);
if (result) {
_controllers[index].text = (num - 1).toString();
}
setState(() {});
},
child: Padding(
padding: EdgeInsets.only(right: 12.w),
child: Icon(
CupertinoIcons.minus,
size: 30.w,
),
),
),
Container(
width: 84.w,
height: 40.w,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
borderRadius: BorderRadius.circular(4.w)),
child: TextField(
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
onChanged: (text) async {
var result = await changeNum(id, int.parse(text));
if (!result) {
// _controllers[index].text=
}
setState(() {});
},
controller: _controllers[index],
textAlign: TextAlign.center,
decoration: InputDecoration(
border: InputBorder.none,
isDense: true,
contentPadding: EdgeInsets.zero,
),
),
),
GestureDetector(
onTap: () async {
var result = await changeNum(
id, int.parse(_controllers[index].text) + 1);
if (result) {
_controllers[index].text =
(int.parse(_controllers[index].text) + 1).toString();
}
setState(() {});
},
child: Padding(
padding: EdgeInsets.only(left: 12.w),
child: Icon(
CupertinoIcons.plus,
size: 30.w,
),
),
)
],
),
);
case GoodStatus.unSell:
return '商品已下架'.text.size(24.sp).color(Color(0x80000000)).make();
}
}
Widget _emptyWidget() {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
R.ASSETS_IMAGES_SHOP_CAR_EMPTY_PNG,
width: 400.w,
height: 400.w,
),
'暂时没有加购商品'.text.size(28.sp).color(Color(0xFFBBBBBB)).make()
],
),
);
}
Future<bool> changeNum(int jcookGoodsId, int num) async {
var cancel = BotToast.showLoading();
var base = await NetUtil().post(API.market.shopCarChangeNum,
params: {'jcookGoodsId': jcookGoodsId, 'num': num});
if (!(base.status ?? false)) {
BotToast.showText(text: base.message ?? '');
}
cancel();
return base.status ?? false;
}
}

@ -1,13 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class BeeCheckRadio<T> extends StatefulWidget { class BeeCheckRadio<T> extends StatefulWidget {
final T? value; final T? value;
final List<T>? groupValue; final List<T>? groupValue;
BeeCheckRadio({Key? key, this.value, this.groupValue}) : super(key: key); final Widget? indent;
final Color? backColor;
BeeCheckRadio(
{Key? key, this.value, this.groupValue, this.indent, this.backColor})
: super(key: key);
@override @override
_BeeCheckRadioState createState() => _BeeCheckRadioState(); _BeeCheckRadioState createState() => _BeeCheckRadioState();
@ -28,9 +32,11 @@ class _BeeCheckRadioState extends State<BeeCheckRadio> {
height: 40.w, height: 40.w,
width: 40.w, width: 40.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: kPrimaryColor.withOpacity(_selected ? 1 : 0), color: widget.backColor ?? kPrimaryColor.withOpacity(_selected ? 1 : 0),
border: Border.all( border: Border.all(
color: _selected ? kPrimaryColor : Color(0xFF979797), color: widget.backColor != null
? Color(0xFFBBBBBB)
: (_selected ? kPrimaryColor : Color(0xFF979797)),
width: 3.w, width: 3.w,
), ),
borderRadius: BorderRadius.circular(20.w), borderRadius: BorderRadius.circular(20.w),
@ -39,14 +45,15 @@ class _BeeCheckRadioState extends State<BeeCheckRadio> {
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
alignment: Alignment.center, alignment: Alignment.center,
child: AnimatedOpacity( child: AnimatedOpacity(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 500),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
opacity: _selected ? 1 : 0, opacity: _selected ? 1 : 0,
child: Icon( child: widget.indent ??
CupertinoIcons.checkmark, Icon(
color: Colors.white, CupertinoIcons.checkmark,
size: 28.w, color: Colors.white,
), size: 28.w,
),
), ),
); );
} }

@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class EndButton extends StatelessWidget {
final VoidCallback onPressed;
final Widget text;
final double? width;
final EdgeInsetsGeometry? padding;
final Color? color;
const EndButton(
{Key? key,
required this.onPressed,
required this.text,
this.width,
this.padding,
this.color})
: super(key: key);
@override
Widget build(BuildContext context) {
return MaterialButton(
elevation: 0,
focusElevation: 0,
highlightElevation: 0,
disabledElevation: 0,
disabledTextColor: Colors.white.withOpacity(0.3),
minWidth: width ?? 220.w,
padding:
padding ?? EdgeInsets.symmetric(horizontal: 48.w, vertical: 20.w),
color: color ?? Colors.red,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(42.w)),
onPressed: onPressed,
child: text,
);
}
}
Loading…
Cancel
Save