搜索 收藏

hmxc
章文轩 3 years ago
parent c61b1bcfe3
commit dcbf791fad

@ -98,6 +98,7 @@ dependencies {
implementation 'com.amap.api:3dmap:latest.integration' implementation 'com.amap.api:3dmap:latest.integration'
implementation 'com.amap.api:location:latest.integration' implementation 'com.amap.api:location:latest.integration'
implementation 'com.android.support:multidex:2.0.1' implementation 'com.android.support:multidex:2.0.1'
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -165,6 +165,17 @@ class R {
/// ![preview](file:///Users/datang/aku_community/assets/icons/change.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/change.png)
static const String ASSETS_ICONS_CHANGE_PNG = 'assets/icons/change.png'; static const String ASSETS_ICONS_CHANGE_PNG = 'assets/icons/change.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/collect.png)
static const String ASSETS_ICONS_COLLECT_PNG = 'assets/icons/collect.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/collection_setting.png)
static const String ASSETS_ICONS_COLLECTION_SETTING_PNG =
'assets/icons/collection_setting.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/collection_share.png)
static const String ASSETS_ICONS_COLLECTION_SHARE_PNG =
'assets/icons/collection_share.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/comment_notice.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/comment_notice.png)
static const String ASSETS_ICONS_COMMENT_NOTICE_PNG = static const String ASSETS_ICONS_COMMENT_NOTICE_PNG =
'assets/icons/comment_notice.png'; 'assets/icons/comment_notice.png';
@ -181,6 +192,9 @@ class R {
/// ![preview](file:///Users/datang/aku_community/assets/icons/contract.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/contract.png)
static const String ASSETS_ICONS_CONTRACT_PNG = 'assets/icons/contract.png'; static const String ASSETS_ICONS_CONTRACT_PNG = 'assets/icons/contract.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/delete.png)
static const String ASSETS_ICONS_DELETE_PNG = 'assets/icons/delete.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/device_alarm.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/device_alarm.png)
static const String ASSETS_ICONS_DEVICE_ALARM_PNG = static const String ASSETS_ICONS_DEVICE_ALARM_PNG =
'assets/icons/device_alarm.png'; 'assets/icons/device_alarm.png';
@ -188,12 +202,18 @@ class R {
/// ![preview](file:///Users/datang/aku_community/assets/icons/examine.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/examine.png)
static const String ASSETS_ICONS_EXAMINE_PNG = 'assets/icons/examine.png'; static const String ASSETS_ICONS_EXAMINE_PNG = 'assets/icons/examine.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/eye_close.png)
static const String ASSETS_ICONS_EYE_CLOSE_PNG = 'assets/icons/eye_close.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/facility.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/facility.png)
static const String ASSETS_ICONS_FACILITY_PNG = 'assets/icons/facility.png'; static const String ASSETS_ICONS_FACILITY_PNG = 'assets/icons/facility.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/file.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/file.png)
static const String ASSETS_ICONS_FILE_PNG = 'assets/icons/file.png'; static const String ASSETS_ICONS_FILE_PNG = 'assets/icons/file.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/filter.png)
static const String ASSETS_ICONS_FILTER_PNG = 'assets/icons/filter.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/finish.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/finish.png)
static const String ASSETS_ICONS_FINISH_PNG = 'assets/icons/finish.png'; static const String ASSETS_ICONS_FINISH_PNG = 'assets/icons/finish.png';
@ -227,6 +247,14 @@ class R {
static const String ASSETS_ICONS_HOUSE_KEEPING_PNG = static const String ASSETS_ICONS_HOUSE_KEEPING_PNG =
'assets/icons/house_keeping.png'; 'assets/icons/house_keeping.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_change_list.png)
static const String ASSETS_ICONS_ICON_CHANGE_LIST_PNG =
'assets/icons/icon_change_list.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_favor_choose.png)
static const String ASSETS_ICONS_ICON_FAVOR_CHOOSE_PNG =
'assets/icons/icon_favor_choose.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_main_all.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/icon_main_all.png)
static const String ASSETS_ICONS_ICON_MAIN_ALL_PNG = static const String ASSETS_ICONS_ICON_MAIN_ALL_PNG =
'assets/icons/icon_main_all.png'; 'assets/icons/icon_main_all.png';
@ -271,10 +299,25 @@ class R {
static const String ASSETS_ICONS_ICON_MAIN_SUBSCRIBE_PNG = static const String ASSETS_ICONS_ICON_MAIN_SUBSCRIBE_PNG =
'assets/icons/icon_main_subscribe.png'; 'assets/icons/icon_main_subscribe.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_more.png)
static const String ASSETS_ICONS_ICON_MORE_PNG = 'assets/icons/icon_more.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_notification.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/icon_notification.png)
static const String ASSETS_ICONS_ICON_NOTIFICATION_PNG = static const String ASSETS_ICONS_ICON_NOTIFICATION_PNG =
'assets/icons/icon_notification.png'; 'assets/icons/icon_notification.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_price.png)
static const String ASSETS_ICONS_ICON_PRICE_PNG =
'assets/icons/icon_price.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_setting.png)
static const String ASSETS_ICONS_ICON_SETTING_PNG =
'assets/icons/icon_setting.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_toTop.png)
static const String ASSETS_ICONS_ICON_TOTOP_PNG =
'assets/icons/icon_toTop.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/img_add.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/img_add.png)
static const String ASSETS_ICONS_IMG_ADD_PNG = 'assets/icons/img_add.png'; static const String ASSETS_ICONS_IMG_ADD_PNG = 'assets/icons/img_add.png';
@ -561,6 +604,9 @@ class R {
static const String ASSETS_ICONS_USER_ICON_WDSQHD_PNG = static const String ASSETS_ICONS_USER_ICON_WDSQHD_PNG =
'assets/icons/user_icon_wdsqhd.png'; 'assets/icons/user_icon_wdsqhd.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/xianshi.png)
static const String ASSETS_ICONS_XIANSHI_PNG = 'assets/icons/xianshi.png';
/// ![preview](file:///Users/datang/aku_community/assets/images/application.png) /// ![preview](file:///Users/datang/aku_community/assets/images/application.png)
static const String ASSETS_IMAGES_APPLICATION_PNG = static const String ASSETS_IMAGES_APPLICATION_PNG =
'assets/images/application.png'; 'assets/images/application.png';

@ -416,6 +416,20 @@ class _Market {
///appid ///appid
String get orderDetail => '/user/shop/findOrderDetailByOrderId'; String get orderDetail => '/user/shop/findOrderDetailByOrderId';
///
///jcook
String get findGoodsList => '/user/jcookGoods/findRecommendGoodsList';
///jcook
String get addCollection => '/user/jcookCollection/collection';
///jcook
String get collectionList => '/user/jcookCollection/myCollection';
} }
class _Upload { class _Upload {

@ -0,0 +1,44 @@
class CollectionGoodsModel {
int? id;
String? skuName;
String? mainPhoto;
int? status;
int? shopStatus;
double? sellPrice;
double? discountPrice;
int? kind;
CollectionGoodsModel(
{this.id,
this.skuName,
this.mainPhoto,
this.status,
this.shopStatus,
this.sellPrice,
this.discountPrice,
this.kind});
CollectionGoodsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
skuName = json['skuName'];
mainPhoto = json['mainPhoto'];
status = json['status'];
shopStatus = json['shopStatus'];
sellPrice = json['sellPrice'];
discountPrice = json['discountPrice'];
kind = json['kind'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['skuName'] = this.skuName;
data['mainPhoto'] = this.mainPhoto;
data['status'] = this.status;
data['shopStatus'] = this.shopStatus;
data['sellPrice'] = this.sellPrice;
data['discountPrice'] = this.discountPrice;
data['kind'] = this.kind;
return data;
}
}

@ -0,0 +1,40 @@
class SearchGoodsModel {
int? id;
String? skuName;
String? mainPhoto;
double? sellPrice;
double? discountPrice;
int? kind;
int? isCollection;
SearchGoodsModel(
{this.id,
this.skuName,
this.mainPhoto,
this.sellPrice,
this.discountPrice,
this.kind,
this.isCollection});
SearchGoodsModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
skuName = json['skuName'];
mainPhoto = json['mainPhoto'];
sellPrice = json['sellPrice'];
discountPrice = json['discountPrice'];
kind = json['kind'];
isCollection = json['isCollection'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['skuName'] = this.skuName;
data['mainPhoto'] = this.mainPhoto;
data['sellPrice'] = this.sellPrice;
data['discountPrice'] = this.discountPrice;
data['kind'] = this.kind;
data['isCollection'] = this.isCollection;
return data;
}
}

@ -22,7 +22,7 @@ class CommunityIntroducePage extends StatefulWidget {
class _CommunityIntroducePageState extends State<CommunityIntroducePage> { class _CommunityIntroducePageState extends State<CommunityIntroducePage> {
CommunityIontroduceModel _model = CommunityIontroduceModel.init(); CommunityIontroduceModel _model = CommunityIontroduceModel.init();
bool _onload = false; bool _onload = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -27,7 +27,7 @@ class GeographicInformationPage extends StatefulWidget {
class _GeographicInformationPageState extends State<GeographicInformationPage> { class _GeographicInformationPageState extends State<GeographicInformationPage> {
GeographicInformationModel _model = GeographicInformationModel.init(); GeographicInformationModel _model = GeographicInformationModel.init();
bool _onload = false; bool _onload = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(

@ -53,8 +53,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin { with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
@override
bool get wantKeepAlive => true;
int _currentIndicator = 0; int _currentIndicator = 0;
ScrollController? _scrollController; ScrollController? _scrollController;
@ -530,5 +529,6 @@ class _HomePageState extends State<HomePage>
); );
} }
@override
bool get wantKeepAlive => true;
} }

@ -3,11 +3,16 @@ 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/constants/application_objects.dart'; import 'package:aku_community/constants/application_objects.dart';
import 'package:aku_community/pages/personal/user_profile_page.dart'; import 'package:aku_community/pages/personal/user_profile_page.dart';
import 'package:aku_community/pages/setting_page/settings_page.dart';
import 'package:aku_community/pages/sign/sign_in_page.dart'; import 'package:aku_community/pages/sign/sign_in_page.dart';
import 'package:aku_community/painters/user_bottom_bar_painter.dart'; import 'package:aku_community/painters/user_bottom_bar_painter.dart';
import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/profile/car/car_manage_page.dart';
import 'package:aku_community/ui/profile/car_parking/car_parking_page.dart';
import 'package:aku_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_community/ui/profile/order/order_page.dart'; import 'package:aku_community/ui/profile/order/order_page.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/views/application_view.dart'; import 'package:aku_community/widget/views/application_view.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -26,14 +31,14 @@ class PersonalIndex extends StatefulWidget {
} }
class _PersonalIndexState extends State<PersonalIndex> class _PersonalIndexState extends State<PersonalIndex>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
SliverAppBar _sliverAppBar(double height) { SliverAppBar _sliverAppBar(double height) {
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
return SliverAppBar( return SliverAppBar(
pinned: true, pinned: false,
toolbarHeight: 0, toolbarHeight: 0,
elevation: 0, elevation: 0,
floating: true, floating: false,
expandedHeight: 450.w - height, expandedHeight: 450.w - height,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -68,7 +73,7 @@ class _PersonalIndexState extends State<PersonalIndex>
child: Row( child: Row(
children: [ children: [
Hero( Hero(
tag: 'AVATAR', tag: 'AVATAR1',
child: ClipOval( child: ClipOval(
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -148,66 +153,397 @@ class _PersonalIndexState extends State<PersonalIndex>
); );
} }
Container _containerBar(String title) { // Container _containerBar(String title) {
return Container( // return Container(
color: title == '我的物业' ? Colors.white : BaseStyle.colorf9f9f9, // color: title == '我的物业' ? Colors.white : BaseStyle.colorf9f9f9,
padding: EdgeInsets.all(title == '我的物业' ? 0 : 32.w), // padding: EdgeInsets.all(title == '我的物业' ? 0 : 32.w),
child: Row( // child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ // children: [
Text( // Text(
title, // title,
style: TextStyle( // style: TextStyle(
fontWeight: FontWeight.w600, // fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize34, // fontSize: BaseStyle.fontSize34,
color: ktextPrimary, // color: ktextPrimary,
), // ),
), // ),
], // ],
), // ),
); // );
} // }
Widget _orderButton({ Widget _orderButton({
required String name, required String name,
required String path, required String path,
required int index, required int index,
}) { }) {
return MaterialButton( return GestureDetector(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Image.asset(path, height: 50.w, width: 50.w), Image.asset(path, height: 64.w, width: 64.w),
10.hb, 10.hb,
Text( Text(
name, name,
style: TextStyle( style: TextStyle(
color: Color(0xFF333333), color: Color(0xFF333333),
fontSize: 22.sp, fontSize: 26.sp,
), ),
), ),
], ],
), ),
onPressed: () { onTap: () {
Get.to(() => OrderPage(initIndex: index)); Get.to(() => OrderPage(initIndex: index));
}, },
); ).expand();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double _statusHeight = MediaQuery.of(context).padding.top; final double _statusHeight = MediaQuery.of(context).padding.top;
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
var orderWidget = SliverToBoxAdapter( // var orderWidget = SliverToBoxAdapter(
// child: Container(
// decoration: BoxDecoration(
// color: Color(0xffffffff),
// borderRadius: BorderRadius.all(Radius.circular(8)),
// boxShadow: <BoxShadow>[
// BoxShadow(
// color: Colors.grey.withOpacity(0.1),
// offset: Offset(1, 1),
// ),
// ],
// ),
// margin: EdgeInsets.all(20.w),
// padding: EdgeInsets.all(12.w),
// child:
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// _containerBar('我的订单'),
// GridView(
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 5,
// ),
// shrinkWrap: true,
// children: [
// _orderButton(
// name: '待付款',
// path: R.ASSETS_ICONS_USER_ICON_DFK_PNG,
// index: 1,
// ),
// _orderButton(
// name: '待收货',
// path: R.ASSETS_ICONS_USER_ICON_DSH_PNG,
// index: 2,
// ),
// _orderButton(
// name: '待评价',
// path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG,
// index: 3,
// ),
// _orderButton(
// name: '售后',
// path: R.ASSETS_ICONS_USER_ICON_SH_PNG,
// index: 4,
// ),
// ],
// ),
// ],
// ),
// )
// );
return Scaffold(
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {
await userProvider.updateProfile();
await userProvider.updateUserDetail();
},
child: Stack(
children: [
// Container(
//
// width: double.infinity,
// height: 441.w,
// alignment: Alignment.topCenter,
//
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// colors: <Color>[
// Color(0xFFF9D57A),
// Color(0xFFF9D57A),
// ],
// ),
// ),
// padding: EdgeInsets.only(top: 130.w),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
//
// MaterialButton(
// padding: EdgeInsets.all(5.w),
// onPressed: () {
// if (!userProvider.isLogin)
// Get.to(() => SignInPage());
// else
// Get.to(() => UserProfilePage());
// },
// child: Container(
// margin: EdgeInsets.only(left: 32.w),
// child: Row(
// children: [
// Hero(
// tag: 'AVATAR',
// child: ClipOval(
// child: FadeInImage.assetNetwork(
// placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// image: API.image(userProvider
// .userInfoModel!.imgUrls.isNotEmpty
// ? userProvider
// .userInfoModel!.imgUrls.first.url
// : ''),
// height: 106.w,
// width: 106.w,
// fit: BoxFit.cover,
// imageErrorBuilder: (context, error, stackTrace) {
// return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 106.w,
// width: 106.w,);
// },
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(left: 16.w),
// child: userProvider.isLogin
// ? Text(
// userProvider.userInfoModel?.nickName ??
// '',
// style: TextStyle(
// fontSize: 32.sp,
// color: Color(0xffad8940),
// ),
// )
// : Text(
// '登录/注册',
// style: TextStyle(
// fontSize: 32.sp,
// color: Color(0xffad8940),
// ),
// )),
// ],
// ),
// ),
// ),
// // Stack(
// // children: [
// // Positioned(
// // bottom: 0,
// // left: 0,
// // right: 0,
// // child: Container(
// // height: 41.w,
// // width: double.infinity,
// // child: CustomPaint(
// // painter: UserBottomBarPainter(),
// // ),
// // ),
// // ),
// // Container(
// // margin: EdgeInsets.only(
// // top: 38.w,
// // left: 36.w,
// // right: 36.w,
// // bottom: 18.w,
// // ),
// // child: Image.asset(
// // R.ASSETS_IMAGES_MEMBER_BG_PNG,
// // width: 678.w,
// // height: 129.w,
// // ),
// // ),
// // ],
// // ),
// ],
// ),
// ),
Container(
width: double.infinity,
height: 441.w,
alignment: Alignment.topCenter,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: <Color>[
Color(0xFFF9D57A),
Color(0xFFF9D57A),
],
),
),
padding: EdgeInsets.only(top: 100.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
children: [
Spacer(),
GestureDetector(
onTap: (){
Get.to(SettingsPage());
},
child: Container(
width: 72.w,
height: 40.w,
alignment: Alignment.center,
child: Image.asset(R.ASSETS_ICONS_ICON_SETTING_PNG,width: 40.w,height: 40.w),
),
),
// 32.wb,
],
),
MaterialButton(
padding: EdgeInsets.all(5.w),
onPressed: () {
if (!userProvider.isLogin)
Get.to(() => SignInPage());
else
Get.to(() => UserProfilePage());
},
child: Container(
margin: EdgeInsets.only(left: 32.w),
child: Row(
children: [
Hero(
tag: 'AVATAR',
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(userProvider
.userInfoModel!.imgUrls.isNotEmpty
? userProvider
.userInfoModel!.imgUrls.first.url
: ''),
height: 106.w,
width: 106.w,
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 106.w,
width: 106.w,);
},
),
),
),
Container(
margin: EdgeInsets.only(left: 16.w),
child: userProvider.isLogin
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
userProvider.userInfoModel?.nickName ??
'',
style: TextStyle(
fontSize: 40.sp,
color: Colors.black.withOpacity(0.85),
),
),
4.hb,
Text(
'当一个新时代的有志青年',
style: TextStyle(
fontSize: 24.sp,
color: Colors.black.withOpacity(0.45),
),
),
],
) : Text(
'登录/注册',
style: TextStyle(
fontSize: 32.sp,
color: Color(0xffad8940),
),
)
),
],
),
),
),
// Stack(
// children: [
// Positioned(
// bottom: 0,
// left: 0,
// right: 0,
// child: Container(
// height: 41.w,
// width: double.infinity,
// child: CustomPaint(
// painter: UserBottomBarPainter(),
// ),
// ),
// ),
// Container(
// margin: EdgeInsets.only(
// top: 38.w,
// left: 36.w,
// right: 36.w,
// bottom: 18.w,
// ),
// child: Image.asset(
// R.ASSETS_IMAGES_MEMBER_BG_PNG,
// width: 678.w,
// height: 129.w,
// ),
// ),
// ],
// ),
],
),
),
Padding(
padding: EdgeInsets.only(top: 289.w),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min,
children: [ children: [
_containerBar('我的订单'), Container(
GridView( width: 686.w,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( height: 282.w,
crossAxisCount: 5, decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.1),
offset: Offset(1, 1),
),
],
), ),
shrinkWrap: true, margin: EdgeInsets.only(left: 32.w,right: 32.w),
padding: EdgeInsets.only(top: 24.w,left: 32.w,right: 32.w),
child:
Column(
//mainAxisAlignment: MainAxisAlignment.center,
children: [
_homeTitle('我的订单', () {}, '查看全部'),
50.hb,
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
_orderButton( _orderButton(
name: '待付款', name: '待付款',
@ -233,20 +569,8 @@ class _PersonalIndexState extends State<PersonalIndex>
), ),
], ],
), ),
); ),
return Scaffold( Container(
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {
await userProvider.updateProfile();
await userProvider.updateUserDetail();
},
child: CustomScrollView(
slivers: <Widget>[
_sliverAppBar(_statusHeight),
// orderWidget,
SliverToBoxAdapter(
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xffffffff), color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)), borderRadius: BorderRadius.all(Radius.circular(8)),
@ -257,23 +581,202 @@ class _PersonalIndexState extends State<PersonalIndex>
), ),
], ],
), ),
margin: EdgeInsets.all(20.w), margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(12.w), padding: EdgeInsets.all(32.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
_containerBar('我的物业'), _function('我的房屋', R.ASSETS_ICONS_USER_ICON_WDFW_PNG, () => HouseOwnersPage(
ApplicationView.custom( identify: UserTool.userProvider.userDetailModel!.type ?? 4,
items: userAppObjects, ),userProvider.userDetailModel!.estateNames?[0]??'',),
needAllApp: false, 36.hb,
_function('我的车位', R.ASSETS_ICONS_USER_ICON_WDCW_PNG, () => CarParkingPage(),'B区N392号'),
36.hb,
_function('我的车', R.ASSETS_ICONS_USER_ICON_WDC_PNG, () => CarManagePage(),'浙999999'),
36.hb,
_myVisitor()
//
// ApplicationView.custom(
// items: userAppObjects,
// needAllApp: false,
// ),
],
),
), ),
], ],
), ),
), ),
],
)
),
);
}
_homeTitle(String title, VoidCallback onTap, String suffixTitle) {
return Row(
children: [
title.text.size(32.sp).bold.make(),
Spacer(),
GestureDetector(
onTap: onTap,
child: Row(
children: [
suffixTitle.text.size(24.sp).color(Color(0xFF999999)).make(),
8.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 24.w,
color: Color(0xFF999999),
), ),
], ],
), ),
), ),
//24.wb,
],
);
}
_function( String title ,String path,dynamic page ,String msg,){
return Row(
children: [
Image.asset(path,width: 40.w,height: 40.w,fit:BoxFit.fitHeight,),
16.wb,
Text(
title,
style: TextStyle(
fontSize: 28.sp,
color: Colors.black.withOpacity(0.85),
),
),
Spacer(),
Text(
msg,
style: TextStyle(
fontSize: 24.sp,
color: Colors.black.withOpacity(0.45),
),
),
24.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 24.w,
color: Color(0xFF999999),
),
],
); );
} }
_myVisitor(){
final userProvider = Provider.of<UserProvider>(context);
return Row(
children: [
Text(
'我的访客',
style: TextStyle(
fontSize: 28.sp,
color: Colors.black.withOpacity(0.85),
),
),
Spacer(),
Container(
width: 110.w,
height: 40.w,
child: Stack(
children: [
Positioned(
child: Hero(
tag: 'AVATAR4',
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(userProvider
.userInfoModel!.imgUrls.isNotEmpty
? userProvider
.userInfoModel!.imgUrls.first.url
: ''),
height: 40.w,
width: 40.w,
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 40.w,
width: 40.w,);
},
),
),
),
top: 0,
bottom: 0,
right: 0,
),
Positioned(
child: Hero(
tag: 'AVATAR5',
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(userProvider
.userInfoModel!.imgUrls.isNotEmpty
? userProvider
.userInfoModel!.imgUrls.first.url
: ''),
height: 40.w,
width: 40.w,
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 106.w,
width: 106.w,);
},
),
),
),
top: 0,
bottom: 0,
right: 15,
),
Positioned(
child: Hero(
tag: 'AVATAR6',
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(userProvider
.userInfoModel!.imgUrls.isNotEmpty
? userProvider
.userInfoModel!.imgUrls.first.url
: ''),
height: 40.w,
width: 40.w,
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 106.w,
width: 106.w,);
},
),
),
),
top: 0,
bottom: 0,
right: 30,
),
],
)
),
24.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 24.w,
color: Color(0xFF999999),
),
],
);
}
@override
bool get wantKeepAlive => true;
} }

@ -31,7 +31,7 @@ class PropertyPage extends StatefulWidget {
} }
class _PropertyPageState extends State<PropertyPage> class _PropertyPageState extends State<PropertyPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
int sum = 0; int sum = 0;
int commentCount = 0; int commentCount = 0;
int sysCount = 0; int sysCount = 0;
@ -547,4 +547,8 @@ class _PropertyPageState extends State<PropertyPage>
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

@ -48,6 +48,7 @@ class BeeListView<T> extends StatefulWidget {
///... ///...
///``` ///```
final List<T> Function(BaseListModel model) convert; final List<T> Function(BaseListModel model) convert;
final List<T> Function(List<T?> model)? refreshExtra;
/// ///
final Widget Function(dynamic items) builder; final Widget Function(dynamic items) builder;
@ -64,7 +65,7 @@ class BeeListView<T> extends StatefulWidget {
required this.convert, required this.convert,
required this.builder, required this.builder,
this.size = 10, this.size = 10,
this.extraParams, this.extraParams, this.refreshExtra ,
}) : super(key: key); }) : super(key: key);
@override @override
@ -98,6 +99,9 @@ class _BeeListViewState<T> extends State<BeeListView> {
); );
_models = widget.convert(_model) as List<T?>; _models = widget.convert(_model) as List<T?>;
widget.controller?.resetLoadState(); widget.controller?.resetLoadState();
if(widget.refreshExtra!=null){
widget.refreshExtra!(_models);
}
if (mounted) setState(() {}); if (mounted) setState(() {});
}, },
firstRefresh: true, firstRefresh: true,

@ -1,6 +1,18 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/community/event_item_model.dart';
import 'package:aku_community/ui/community/activity/activity_list_page.dart';
import 'package:aku_community/ui/community/community_views/widgets/chat_card.dart';
import 'package:aku_community/ui/home/home_title.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -27,15 +39,25 @@ class CommunityPage extends StatefulWidget {
class _CommunityPageState extends State<CommunityPage> class _CommunityPageState extends State<CommunityPage>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
TabController? _tabController; TabController? _tabController;
late EasyRefreshController _easyRefreshController;
List<String> _tabs = []; List<String> _tabs = [];
GlobalKey<TopicCommunityViewState> topicKey = GlobalKey<TopicCommunityViewState> topicKey =
GlobalKey<TopicCommunityViewState>(); GlobalKey<TopicCommunityViewState>();
GlobalKey<MyCommunityViewState> myKey = GlobalKey<MyCommunityViewState>(); GlobalKey<MyCommunityViewState> myKey = GlobalKey<MyCommunityViewState>();
GlobalKey<NewCommunityViewState> newKey = GlobalKey<NewCommunityViewState>(); GlobalKey<NewCommunityViewState> newKey = GlobalKey<NewCommunityViewState>();
List<EventItemModel> _newItems = [];
int _pageNum = 1;
int _size = 4;
int _pageCount = 0;
bool _onload = true;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_easyRefreshController = EasyRefreshController();
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
if (userProvider.isLogin) _tabs = ['最新', '话题', '我的']; if (userProvider.isLogin) _tabs = ['最新', '话题', '我的'];
if (userProvider.isNotLogin) _tabs = ['最新', '话题']; if (userProvider.isNotLogin) _tabs = ['最新', '话题'];
@ -48,6 +70,7 @@ class _CommunityPageState extends State<CommunityPage>
@override @override
void dispose() { void dispose() {
_tabController?.dispose(); _tabController?.dispose();
_easyRefreshController.dispose();
super.dispose(); super.dispose();
} }
@ -56,8 +79,40 @@ class _CommunityPageState extends State<CommunityPage>
super.build(context); super.build(context);
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context); final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold( return Scaffold(
title: '社区', appBar: AppBar(
titleSpacing: 10.0,
title: Row(crossAxisAlignment: CrossAxisAlignment.center, children: [
if (appProvider.location != null)
Padding(
padding: const EdgeInsets.only(right: 5),
child: Image.asset(
R.ASSETS_ICONS_ICON_MAIN_LOCATION_PNG,
width: 32.w,
height: 32.w,
),
),
Text(
appProvider.location?['city'] == null
? ''
: appProvider.location?['city'] as String? ?? '',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
color: Color(0xff333333),
),
textAlign: TextAlign.center,
),
Text(
'(${appProvider.weatherType} ${appProvider.weatherTemp}℃)',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
),
textAlign: TextAlign.center,
),
]),
backgroundColor: Colors.white,
actions: [ actions: [
Badge( Badge(
elevation: 0, elevation: 0,
@ -77,7 +132,10 @@ class _CommunityPageState extends State<CommunityPage>
), ),
), ),
], ],
fab: FloatingActionButton( bottom: PreferredSize(
preferredSize: Size.fromHeight(90.w), child: _geSearch()),
),
floatingActionButton: FloatingActionButton(
onPressed: () async { onPressed: () async {
if (LoginUtil.isNotLogin) return; if (LoginUtil.isNotLogin) return;
bool? result = await Get.to(() => AddNewEventPage()); bool? result = await Get.to(() => AddNewEventPage());
@ -98,31 +156,326 @@ class _CommunityPageState extends State<CommunityPage>
heroTag: 'event_add', heroTag: 'event_add',
child: Icon(Icons.add), child: Icon(Icons.add),
), ),
appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(48),
child: Align(
alignment: Alignment.centerLeft, body: EasyRefresh(
child: BeeTabBar( firstRefresh: true,
controller: _tabController, header: MaterialHeader(),
tabs: _tabs, controller: _easyRefreshController,
scrollable: true, onRefresh: () async {
), await (getNewInfo());
), _onload = false;
), setState(() {});
body: TabBarView( },
children: userProvider.isLogin child: _onload
? [ ? SizedBox()
NewCommunityView(key: newKey), : ListView(
TopicCommunityView(key: topicKey), children: [
MyCommunityView(key: myKey), 2.hb,
] _getInfo(),
: [ 16.hb,
NewCommunityView(key: newKey), _getNews(),
TopicCommunityView(key: topicKey), 16.hb,
..._newItems.map((e) => ChatCard(
model: e,
)).toList()],
),
),
// ListView(
// children: [
// ],
// )
// TabBarView(
// children: userProvider.isLogin
// ? [
// NewCommunityView(key: newKey),
// TopicCommunityView(key: topicKey),
// MyCommunityView(key: myKey),
// ]
// : [
// NewCommunityView(key: newKey),
// TopicCommunityView(key: topicKey),
// ],
// controller: _tabController,
// ),
// bodyColor: Colors.white,
);
}
Future getNewInfo() async {
BaseListModel baseListModel =
await NetUtil().getList(API.community.newEventList, params: {
"pageNum": _pageNum,
"size": _size,
});
if (baseListModel.tableList!.isNotEmpty) {
_newItems = (baseListModel.tableList as List)
.map((e) => EventItemModel.fromJson(e))
.toList();
}
_pageCount = baseListModel.pageCount!;
}
Future loadNewInfo() async {
BaseListModel baseListModel =
await NetUtil().getList(API.market.hotTop, params: {
"pageNum": _pageNum,
"size": _size,
});
if (baseListModel.tableList!.isNotEmpty) {
_newItems.addAll((baseListModel.tableList as List)
.map((e) => EventItemModel.fromJson(e))
.toList());
}
_pageCount = baseListModel.pageCount!;
}
_getInfo() {
return Container(
color: Colors.white,
padding:
EdgeInsets.only(top: 32.w, bottom: 32.w, left: 32.w, right: 32.w),
child: Column(
children: [
_homeTitle('热门资讯', () {}, '更多'),
32.hb,
Container(
height: 204.w,
child: ListView.separated(
padding: EdgeInsets.zero,
separatorBuilder: (context, index) {
return SizedBox(
width: 24.w,
);
},
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
width: 396.w,
child: Builder(
builder: (context) {
return _infoCard();
},
),
);
},
itemCount: 3,
),
),
],
),
);
}
_homeTitle(String title, VoidCallback onTap, String suffixTitle) {
return Row(
children: [
title.text.size(32.sp).bold.make(),
Spacer(),
GestureDetector(
onTap: onTap,
child: Row(
children: [
suffixTitle.text.size(24.sp).color(Color(0xFF999999)).make(),
8.wb,
Icon(
CupertinoIcons.chevron_forward,
size: 24.w,
color: Color(0xFF999999),
),
],
),
),
//24.wb,
], ],
controller: _tabController, );
}
_infoCard() {
return Container(
width: 396.w,
height: 204.w,
padding:
EdgeInsets.only(top: 32.w, left: 40.w, right: 40.w, bottom: 32.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(
right: Radius.circular(12),
left: Radius.circular(16),
),
color: Colors.black38,
),
child: Column(
children: [
Container(
width: 316.w,
alignment: Alignment.center,
child: Text(
'肖生克的救赎到底在讲人性的还是在激励人在困...',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white.withOpacity(0.85),
fontSize: 28.sp,
fontWeight: FontWeight.bold),
)
),
24.hb,
Row(
children: [
Text(
'271.8w浏览',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white.withOpacity(0.85),
fontSize: 24.sp,
),
),
Spacer(),
Text(
'01-03',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white.withOpacity(0.85),
fontSize: 24.sp,
),
)
],
)
],
),
);
}
_getNews() {
return Container(
color: Colors.white,
padding:
EdgeInsets.only(top: 32.w, bottom: 32.w,),
child: Column(
children: [
Container(
padding: EdgeInsets.only(left: 32.w,right: 32.w),
child: _homeTitle('新鲜话题', () {}, '更多'),
),
32.hb,
_searchHistoryWidget()
],
),
);
}
_geSearch() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 32.w),
padding: EdgeInsets.only(bottom: 20.w),
child: MaterialButton(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
height: 74.w,
shape: StadiumBorder(),
elevation: 0,
minWidth: double.infinity,
color: Color(0xFFF3F3F3),
onPressed: () {
Get.to(() => SearchGoodsPage());
},
child: Row(
children: [
Icon(
Icons.search,
size: 32.w,
color: Color(0xFF666666),
),
10.wb,
'请输入关键字'.text.size(28.sp).color(ktextSubColor).make().expand(),
],
),
),
);
}
_searchHistoryWidget() {
return Container(
//margin: EdgeInsets.symmetric(horizontal: 32.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
//width: MediaQuery.of(context).size.width,
//padding: EdgeInsets.only(left: 10, right: 10),
child: Wrap(
children:
[_choiceChip('EDG夺冠',1),_choiceChip('双十一',2),
_choiceChip('11月吃土',2),_choiceChip('成都疫情',0),_choiceChip('万圣节',0)],
),
),
// Spacer()
],
),
);
}
_choiceChip(String title, int type) {
return Padding(
padding: EdgeInsets.only(right: 12.w,bottom: 24.w),
child: ChoiceChip(
backgroundColor: Color(0xFFF4F7FC),
// disabledColor: Colors.blue,
labelStyle: TextStyle(fontSize: 15 * 2.sp, color: Colors.black),
labelPadding: EdgeInsets.only(right: 12.w,left: 12.w),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onSelected: (bool value) {},
label: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'# ${title}',
style: TextStyle(
color: Colors.black.withOpacity(0.65),
fontSize: 28.sp,
fontWeight: FontWeight.w500),
),
type==1||type==2? 8.wb:SizedBox(),
type==1||type==2?_chipType(type):SizedBox()
],
),
selected: false,
),
);
}
_chipType(int type) {
return Container(
width: 32.w,
height: 32.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.4.w),
),
color:type == 1? Color(0xFFFFD76F):Color(0xFFFF8383),
),
child: Text(
type == 1 ? '' : '',
style: TextStyle(
color: type == 1
? Colors.black.withOpacity(0.65)
: Colors.white.withOpacity(0.85),
fontSize: 20.sp,
fontWeight: FontWeight.w500),
), ),
bodyColor: Colors.white,
); );
} }

@ -279,13 +279,13 @@ class _ChatCardState extends State<ChatCard> {
return DecoratedBox( return DecoratedBox(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
border: Border( // border: Border(
bottom: BorderSide( // bottom: BorderSide(
color: widget.hideLine // color: widget.hideLine
? Colors.transparent // ? Colors.transparent
: Color(0xFFE5E5E5).withOpacity(0.5), // : Color(0xFFE5E5E5).withOpacity(0.5),
), // ),
), // ),
), ),
child: MaterialButton( child: MaterialButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -294,36 +294,51 @@ class _ChatCardState extends State<ChatCard> {
Get.to(() => EventDetailPage(themeId: widget.model!.id)); Get.to(() => EventDetailPage(themeId: widget.model!.id));
} }
: null, : null,
child: Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
[
Material( Material(
color: Color(0xFFF5F5F5), color: Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(6.w), borderRadius: BorderRadius.circular(48.w),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API image: API
.image(ImgModel.first(widget.model!.headSculptureImgUrl)), .image(ImgModel.first(widget.model!.headSculptureImgUrl)),
height: 86.w, height: 96.w,
width: 86.w, width: 96.w,
fit: BoxFit.cover, fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 86.w, return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 86.w,
width: 86.w,); width: 86.w,);
}, },
), ),
), ).paddingOnly(left: 32.w),
24.wb, 20.wb,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
[ Text(
widget.model!.createName!.text.black widget.model!.createName!,
.size(36.sp) maxLines: 1,
.make() overflow: TextOverflow.ellipsis,
.expand(), style: TextStyle(
color: Colors.black.withOpacity(0.85),
fontSize: 30.sp,
fontWeight: FontWeight.w500),
),
12.hb,
BeeDateUtil(widget.model!.date)
.timeAgoWithHm
.text
.size(24.sp)
.color(Color(0xFF999999))
.make(),
],
),
Spacer(),
PopupMenuButton( PopupMenuButton(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w)), borderRadius: BorderRadius.circular(8.w)),
@ -343,36 +358,52 @@ class _ChatCardState extends State<ChatCard> {
cancel(); cancel();
BotToast.showText(text: '举报成功'); BotToast.showText(text: '举报成功');
}, },
), child: Container(
width: 40.w,height: 32.w,
child: Image.asset(R.ASSETS_ICONS_ICON_MORE_PNG,
width: 8.w,height: 32.w,fit: BoxFit.fitHeight,)),
).paddingOnly(right: 32.w),
].row(), ].row(),
6.hb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
32.hb,
widget.model!.content!.text.size(32.sp).black.make(), widget.model!.content!.text.size(32.sp).black.make(),
20.hb, 32.hb,
_renderImage(), _renderImage(),
widget.model!.gambitTitle?.isEmpty ?? true widget.model!.gambitTitle?.isEmpty ?? true
? SizedBox() ? SizedBox()
: Chip( : Chip(
label: '#${widget.model!.gambitTitle}' label: '# ${widget.model!.gambitTitle}'
.text .text
.size(22.sp) .color(Color(0xFF547fc0))
.size(28.sp)
.make(), .make(),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 5.w), horizontal: 16.w, vertical: 5.w),
labelPadding: EdgeInsets.zero, labelPadding: EdgeInsets.zero,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
shape: StadiumBorder( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
side: BorderSide(), // shape: StadiumBorder(
), // side: BorderSide(),
).pOnly(top: 10.w), // ),
).pOnly(top: 20.w),
20.hb,
],
).paddingOnly(right: 32.w,left: 32.w),
Divider(height: 1.w, thickness: 1.w),
10.hb,
Row( Row(
children: [ children: [
64.hb, 64.hb,
BeeDateUtil(widget.model!.date)
.timeAgo
.text
.size(28.sp)
.color(Color(0xFF999999))
.make(),
_isMyself _isMyself
? TextButton( ? TextButton(
onPressed: () async { onPressed: () async {
@ -411,12 +442,13 @@ class _ChatCardState extends State<ChatCard> {
_buildMoreButton(), _buildMoreButton(),
], ],
), ),
_renderLikeAndComment(), // _renderLikeAndComment(),
], ],
).expand(), ),
], ],
).p(20.w), ).paddingOnly(top: 24.w,bottom: 32.w),
), ),
); ).paddingOnly(bottom: 16.w);
} }
} }

@ -0,0 +1,90 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/collection/collection_goods_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/order/order_detail_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
class CollectionFunc {
///
static Future collection(int jcookGoodsId) async {
await NetUtil().get(API.market.addCollection,
params: {"jcookGoodsId": jcookGoodsId}, showMessage: true);
}
///
static Future<List<CollectionGoodsModel>> getCollectionList() async {
BaseModel baseModel =
await NetUtil().get(API.market.collectionList);
if (baseModel.status == true && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => CollectionGoodsModel.fromJson(e))
.toList();
}
return [];
}
// ///
// static Future confirmReceive(int goodsAppointmentId) async {
// await NetUtil().get(API.market.confirmReceive,
// params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
// }
//
// ///退
// static Future refundOrder(
// int goodsAppointmentId, String reson, int type) async {
// BaseModel baseModel = await NetUtil().get(API.market.refundOrder,
// params: {
// "goodsAppointmentId": goodsAppointmentId,
// "backReason": reson,
// "backType": type
// },
// showMessage: true);
// return baseModel;
// }
//
// ///
// static Future cancelOrder(int goodsAppointmentId) async {
// BaseModel baseModel = await NetUtil().get(API.market.cancleOrder,
// params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
// return baseModel;
// }
//
// ///
// static Future goodsEvalution(
// int goodsAppointmentId, int rating, String evaluationReason) async {
// BaseModel baseModel = await NetUtil().get(API.market.goodsEvaluation,
// params: {
// "goodsAppointmentId": goodsAppointmentId,
// "score": rating,
// "evaluationReason": evaluationReason
// },
// showMessage: true);
// return baseModel;
// }
//
// ///
// static Future<List<GoodsItem>> getHotTops(int supplierId) async {
// BaseModel baseModel =
// await NetUtil().get(API.market.suppliyerHotTop, params: {
// "supplierId": supplierId,
// });
// if (baseModel.status == true && baseModel.data != null) {
// return (baseModel.data as List)
// .map((e) => GoodsItem.fromJson(e))
// .toList();
// }
// return [];
// }
//
// ///
// static Future getOrderDetail(int goodsAppointmentId) async {
// BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
// params: {"goodsAppointmentId": goodsAppointmentId});
// if (baseModel.status! && baseModel.data != null) {
// return OrderDetailModel.fromJson(baseModel.data);
// }
// }
}

@ -0,0 +1,230 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/collection/collection_goods_model.dart';
import 'package:aku_community/models/search/search_goods_model.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:get/get.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/utils/headers.dart';
class CollectionListCard extends StatelessWidget {
final CollectionGoodsModel model;
const CollectionListCard({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
height: 280.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(16.w),
),
color: Colors.white),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(16.w),
),
child: FadeInImage.assetNetwork(
image: model.mainPhoto ?? '',
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 280.w,
width: 280.w,
fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 280.w,
width: 280.w,
);
},
),
),
16.wb,
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
8.hb,
SizedBox(
width: 400.w,
child: Text(
model.skuName ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 28.sp,
color: ktextPrimary,
),
),
),
5.hb,
_getIcon(2),
//_getIcon(model.kind??0),
Spacer(),
20.hb,
RichText(
text: TextSpan(
children: [
TextSpan(
text: '¥',
style: TextStyle(
color: Colors.red,
fontSize: 28.sp,
),
),
TextSpan(
text: '${model.sellPrice ?? 0} ',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 40.sp,
),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
children: [
TextSpan(
text: '官方指导价:¥',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: '${model.sellPrice ?? 0}',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
decoration: TextDecoration.lineThrough,
),
),
],
),
),
RichText(
text: TextSpan(
children: [
TextSpan(
text: '折扣:',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: ((model.discountPrice ??
1 / (model.sellPrice ?? 1)) *
10) <
1
? _getDiscount(model.sellPrice ?? -1,
model.discountPrice ?? -1)
: '暂无折扣',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
],
),
),
],
),
Spacer(),
Row(
children: [
GestureDetector(
child: Image.asset(R.ASSETS_ICONS_COLLECTION_SHARE_PNG,width: 44.w,height: 44.w,),
onTap: (){
},
),
24.wb,
GestureDetector(
child: Image.asset(R.ASSETS_ICONS_COLLECTION_SETTING_PNG,width: 44.w,height: 44.w,),
onTap: (){
},
),
],
),
44.wb,
],
),
16.hb,
],
).expand(),
],
),
),
);
}
_getDiscount(double sellPrice, double discountPrice) {
String count = '';
count = ((discountPrice / sellPrice) * 10).toStringAsFixed(1);
return count + '';
}
Widget _getIcon(int type) {
if (type == 1) {
return Container(
width: 86.w,
height: 26.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4.w),
),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFEC5329), Color(0xFFF58123)],
),
),
child: Text(
'京东自营',
style: TextStyle(fontSize: 18.sp, color: kForeGroundColor),
),
);
} else if (type == 2) {
return Container(
alignment: Alignment.center,
width: 86.w,
height: 30.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4.w),
),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFF59B1C), Color(0xFFF5AF16)],
),
),
child: Text(
'京东POP',
style: TextStyle(fontSize: 18.sp, color: kForeGroundColor),
),
);
} else
return SizedBox();
}
}

@ -0,0 +1,117 @@
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/collection/collection_goods_model.dart';
import 'package:aku_community/models/search/search_goods_model.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/market/search/goods_list_card.dart';
import 'package:aku_community/utils/hive_store.dart';
import 'package:aku_community/widget/bee_back_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'collection_func.dart';
import 'collection_list_card.dart';
class MyCollectionPage extends StatefulWidget {
MyCollectionPage({Key? key}) : super(key: key);
@override
MyCollectionPageState createState() => MyCollectionPageState();
}
class MyCollectionPageState extends State<MyCollectionPage> {
// TextEditingController _editingController = TextEditingController();
EasyRefreshController _refreshController = EasyRefreshController();
// List<String> _searchHistory = [];
String _searchText = "";
late List<CollectionGoodsModel> _models;
bool _onload = true;
@override
void initState() {
super.initState();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
return BeeScaffold(
titleSpacing: 0,
bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9),
title: '收藏的商品',
body:Container(
color: Color(0xFFF2F3F4),
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _refreshController,
onRefresh: () async {
_models = await CollectionFunc.getCollectionList();
_onload = false;
setState(() {});
},
child: _onload
? Container()
: ListView(
children: [..._models.map((e) => CollectionListCard( model: e,)).toList()],
),
),
// BeeListView(
// path: API.market.collectionList,
// controller: _refreshController,
// extraParams: {
// "keyword":_searchText,
// },
// convert: (model) => model.tableList!
// .map((e) => CollectionGoodsModel.fromJson(e))
// .toList(),
// builder: (items) {
// return ListView.separated(
// padding: EdgeInsets.only(top: 10.w,
// left: 20.w, right: 20.w, bottom: 32.w),
// // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// // crossAxisCount: 2,
// // mainAxisSpacing: 20.w,
// // crossAxisSpacing: 20.w,
// // ),
// itemBuilder: (context, index) {
// final item = items[index];
// return Container(width: 100.w,height: 100.w,color: Colors.red,);
// CollectionListCard(
// model: item,); //GoodsCard(item: item);
// },
// separatorBuilder: (_, __) {
// return 32.w.heightBox;
// },
// itemCount: items.length,
// );
// },
// ),
)
);
}
}

@ -42,7 +42,7 @@ class GoodsCard extends StatelessWidget {
children: [ children: [
FadeInImage.assetNetwork( FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(item.imgList)), image: ImgModel.first(item.imgList),
fit: BoxFit.fill, fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) { imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP); return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP);
@ -70,13 +70,13 @@ class GoodsCard extends StatelessWidget {
], ],
), ),
), ),
Padding( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 16.w,right: 16.w, left: 16.w,right: 16.w,
top: 10.w, top: 10.w,
), ),
child: Text( child: Text(
item.title+'98-034789reuyguiuioprguioptuiop348907r789-0re8097grt789rge978-ge', item.title,
maxLines: 2, maxLines: 2,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -96,7 +96,7 @@ class GoodsCard extends StatelessWidget {
) )
), ),
10.hb,
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16.w, horizontal: 16.w,

@ -62,13 +62,16 @@ class _MarketPageState extends State<MarketPage>
double MessageHeight = 76.w; double MessageHeight = 76.w;
double bannerHeight = 354.w; double bannerHeight = 354.w;
double buttonsHeight = 334.w; double buttonsHeight = 334.w;
double searchHeight = 74.w.w; double searchHeight = 74.w;
double tabBarHeight = 60.w; double tabBarHeight = 60.w;
late TabController _tabController; late TabController _tabController;
List<SwiperModel> _swiperModels = []; List<SwiperModel> _swiperModels = [];
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
Future updateMarketInfo() async { Future updateMarketInfo() async {
BaseListModel baseListModel = BaseListModel baseListModel =
await NetUtil().getList(API.market.hotTop, params: { await NetUtil().getList(API.market.hotTop, params: {
@ -755,10 +758,12 @@ class _MarketPageState extends State<MarketPage>
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: Container( child:
Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 60.w, height: 60.w,
child: TabBar( child:
TabBar(
onTap: (index) { onTap: (index) {
// _presenter.fetchList(_category.id, 0, _sortType); // _presenter.fetchList(_category.id, 0, _sortType);
setState(() {}); setState(() {});
@ -777,15 +782,21 @@ class _MarketPageState extends State<MarketPage>
); );
} }
List<Widget> _tabItems() { List<Widget> _tabItems() {
return [_tabItem(0,'综合推荐'),_tabItem(1,'销量'),_tabItem(2,'价格')]; return [_tabItemComprehensive(0,'综合推荐'),_tabItemSalesVolume(1,'销量'),_tabItemPrice(2,'价格')];
} }
_tabItem(int index,String text) { _tabItemComprehensive(int index,String text) {
bool isChoose = index == _tabController.index; bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index // Color textColor = index == _tabController.index
// ? getCurrentThemeColor() // ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9); // : Colors.black.withOpacity(0.9);
return Tab( return Tab(
child: GestureDetector(
onTap: (){
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Container( child: Container(
alignment: Alignment.center, alignment: Alignment.center,
width: 150.w, width: 150.w,
@ -805,9 +816,103 @@ class _MarketPageState extends State<MarketPage>
], ],
), ),
), ),
),
); );
} }
_tabItemSalesVolume(int index,String text) {
bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index
// ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9);
return Tab(
child: GestureDetector(
onTap: (){
_orderType = OrderType.SALES;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Container(
alignment: Alignment.center,
width: 150.w,
// color: Colors.white,
color: Color(0xFFF9F9F9),
padding: EdgeInsets.only(left: 10.w, right: 10.w),
child: Row(
children: [
Text(
text,
style: TextStyle(
fontWeight: isChoose?FontWeight.bold:FontWeight.normal,
fontSize: isChoose?32.sp:28.sp,
color: isChoose?Color(0xFF000000):Color(0xFF666666)),
),
Icon(
priceIcon,
size: 32.w,
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
],
),
),
),
);
}
_tabItemPrice(int index,String text) {
bool isChoose = index == _tabController.index;
// Color textColor = index == _tabController.index
// ? getCurrentThemeColor()
// : Colors.black.withOpacity(0.9);
return Tab(
child: GestureDetector(
onTap: (){
switch (_orderType) {
case OrderType.NORMAL:
case OrderType.SALES:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
case OrderType.PRICE_HIGH:
_orderType = OrderType.PRICE_LOW;
priceIcon = CupertinoIcons.chevron_down;
break;
case OrderType.PRICE_LOW:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
}
setState(() {});
},
child: Container(
alignment: Alignment.center,
width: 150.w,
// color: Colors.white,
color: Color(0xFFF9F9F9),
padding: EdgeInsets.only(left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
text,
style: TextStyle(
fontWeight: isChoose?FontWeight.bold:FontWeight.normal,
fontSize: isChoose?32.sp:28.sp,
color: isChoose?Color(0xFF000000):Color(0xFF666666)),
),
],
),
),
),
);
}
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

@ -0,0 +1,240 @@
import 'package:flutter/material.dart';
import 'package:get/get.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/models/market/goods_item.dart';
import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsCard extends StatelessWidget {
final GoodsItem item;
final bool? border;
const GoodsCard({Key? key, required this.item, this.border})
: super(key: key);
@override
Widget build(BuildContext context) {
return MaterialButton(
color: Colors.white,
elevation: 0,
shape: !(border ?? false)
? null
: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w),
side: BorderSide(color: Color(0xFFC4C4C4))),
padding: EdgeInsets.zero,
onPressed: () => Get.to(
() => GoodsDetailPage(id: item.id),
preventDuplicates: false,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(12.w)),
),
child: Stack(
children: [
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(item.imgList)),
fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP);
},
),
Positioned(
left: 0,
right: 0,
bottom: 0,
child: Container(
height: 38.w,
color: Colors.black54,
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: Text(
item.recommend,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.white,
fontSize: 18.sp,
),
),
),
),
],
),
),
Container(
padding: EdgeInsets.only(
left: 16.w,right: 16.w,
top: 10.w,
),
child: Text(
item.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 28.sp,
color: ktextPrimary
),
),
),
Padding(
padding: EdgeInsets.only(
left: 16.w,right: 16.w,
top: 10.w,
),
child: Container(
child: _getIcon(1),
)
),
10.hb,
Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w,
),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: '¥',
style: TextStyle(
color: Colors.red,
fontSize: 28.sp,
),
),
TextSpan(
text: '${item.sellingPrice} ',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 40.sp,
),
),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w,
),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: '原价:¥',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: '${item.markingPrice}',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
decoration: TextDecoration.lineThrough,
),
),
],
),
),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w,
),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: '折扣:',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: '9折',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
],
),
),
),
],
),
);
}
Widget _getIcon(int type){
if(type==1){
return Container(
width: 86.w,
height: 26.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4.w), ),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFEC5329), Color(0xFFF58123)],
),
),
child: Text(
'京东自营',
style: TextStyle(
fontSize: 18.sp,
color: kForeGroundColor
),
),
);
}
else if(type==2){
return Container(
alignment: Alignment.center,
width: 86.w,
height: 30.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4.w), ),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFF59B1C), Color(0xFFF5AF16)],
),
),
child: Text(
'京东POP',
style: TextStyle(
fontSize: 18.sp,
color: kForeGroundColor
),
),
);
}
else
return SizedBox();
}
}

@ -0,0 +1,245 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/models/search/search_goods_model.dart';
import 'package:aku_community/ui/market/collection/collection_func.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsListCard extends StatefulWidget {
final SearchGoodsModel model;
final EasyRefreshController? refreshController;
GoodsListCard({Key? key, required this.model, this.refreshController})
: super(key: key);
@override
GoodsListCardState createState() => GoodsListCardState();
}
class GoodsListCardState extends State<GoodsListCard> {
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
height: 280.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(16.w),
),
color: Colors.white),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(16.w),
),
child: FadeInImage.assetNetwork(
image: widget.model.mainPhoto ?? '',
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 280.w,
width: 280.w,
fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
height: 280.w,
width: 280.w,
);
},
),
),
16.wb,
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
8.hb,
SizedBox(
width: 400.w,
child: Text(
widget.model.skuName ?? '',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 28.sp,
color: ktextPrimary,
),
),
),
5.hb,
_getIcon(2),
//_getIcon(model.kind??0),
Spacer(),
20.hb,
RichText(
text: TextSpan(
children: [
TextSpan(
text: '¥',
style: TextStyle(
color: Colors.red,
fontSize: 28.sp,
),
),
TextSpan(
text: '${widget.model.sellPrice ?? 0} ',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
fontSize: 40.sp,
),
),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
text: TextSpan(
children: [
TextSpan(
text: '官方指导价:¥',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: '${widget.model.sellPrice ?? 0}',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
decoration: TextDecoration.lineThrough,
),
),
],
),
),
RichText(
text: TextSpan(
children: [
TextSpan(
text: '折扣:',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
TextSpan(
text: ((widget.model.discountPrice ??
1 / (widget.model.sellPrice ?? 1)) *
10) <
1
? _getDiscount(widget.model.sellPrice ?? -1,
widget.model.discountPrice ?? -1)
: '暂无折扣',
style: TextStyle(
color: ktextSubColor,
fontSize: 20.sp,
),
),
],
),
),
],
),
Spacer(),
GestureDetector(
onTap: () async {
await CollectionFunc.collection(widget.model.id!);
if (widget.refreshController != null) {
widget.refreshController!.callRefresh();
}
},
child: (widget.model.isCollection ?? 0) != 0
? Image.asset(
R.ASSETS_ICONS_SHOP_FAVORFILL_PNG,
width: 42.w,
height: 42.w,
)
: Image.asset(
R.ASSETS_ICONS_ICON_FAVOR_CHOOSE_PNG,
width: 42.w,
height: 42.w,
),
),
24.wb,
],
),
16.hb,
],
).expand(),
],
),
),
);
}
_getDiscount(double sellPrice, double discountPrice) {
String count = '';
count = ((discountPrice / sellPrice) * 10).toStringAsFixed(1);
return count + '';
}
Widget _getIcon(int type) {
if (type == 1) {
return Container(
width: 86.w,
height: 26.w,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4.w),
),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFEC5329), Color(0xFFF58123)],
),
),
child: Text(
'京东自营',
style: TextStyle(fontSize: 18.sp, color: kForeGroundColor),
),
);
} else if (type == 2) {
return Container(
alignment: Alignment.center,
width: 86.w,
height: 30.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(4.w),
),
gradient: LinearGradient(
begin: FractionalOffset.centerLeft,
end: FractionalOffset.centerRight,
colors: <Color>[Color(0xFFF59B1C), Color(0xFFF5AF16)],
),
),
child: Text(
'京东POP',
style: TextStyle(fontSize: 18.sp, color: kForeGroundColor),
),
);
} else
return SizedBox();
}
}

@ -0,0 +1,467 @@
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/utils/hive_store.dart';
import 'package:aku_community/widget/bee_back_button.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
enum OrderType {
NORMAL,
SALES,
PRICE_HIGH,
PRICE_LOW,
}
class SearchDetailPage extends StatefulWidget {
SearchDetailPage({Key? key}) : super(key: key);
@override
SearchDetailPageState createState() => SearchDetailPageState();
}
class SearchDetailPageState extends State<SearchDetailPage> {
TextEditingController _editingController = TextEditingController();
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
EasyRefreshController _refreshController = EasyRefreshController();
List<String> _searchHistory = [];
String _searchText = "";
FocusNode _contentFocusNode = FocusNode();
bool _showList = true;
@override
void initState() {
super.initState();
getSearchListFromSharedPreferences();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
final normalTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.NORMAL;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Text(
'综合',
style: TextStyle(
color:
_orderType == OrderType.NORMAL ? kDarkPrimaryColor : ktextPrimary,
),
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
final salesTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.SALES;
priceIcon = CupertinoIcons.chevron_up_chevron_down;
setState(() {});
},
child: Text(
'销量',
style: TextStyle(
color:
_orderType == OrderType.SALES ? kDarkPrimaryColor : ktextPrimary,
),
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
final priceButton = MaterialButton(
onPressed: () {
switch (_orderType) {
case OrderType.NORMAL:
case OrderType.SALES:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
case OrderType.PRICE_HIGH:
_orderType = OrderType.PRICE_LOW;
priceIcon = CupertinoIcons.chevron_down;
break;
case OrderType.PRICE_LOW:
_orderType = OrderType.PRICE_HIGH;
priceIcon = CupertinoIcons.chevron_up;
break;
}
setState(() {});
},
child: Row(
children: [
Text(
'价格',
style: TextStyle(
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
),
Icon(
priceIcon,
size: 32.w,
color: _orderType == OrderType.PRICE_HIGH ||
_orderType == OrderType.PRICE_LOW
? kDarkPrimaryColor
: ktextPrimary,
),
],
),
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
return BeeScaffold(
titleSpacing: 0,
bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9),
title: Row(
children: [
Container(
width: 520.w,
height: 68.w,
child: TextField(
keyboardType: TextInputType.text,
onEditingComplete: () {
setState(() {});
// _refreshController.callRefresh();
},
focusNode: _contentFocusNode,
onChanged: (text) {
_searchText = text;
setState(() {});
},
onSubmitted: (_submitted) async {
_contentFocusNode.unfocus();
if (_searchHistory.contains(_searchText)) {
_searchHistory.remove(_searchText);
List<String> list = [_searchText];
list.addAll(_searchHistory);
_searchHistory = list;
} else {
List<String> list = [_searchText];
list.addAll(_searchHistory);
_searchHistory = list;
while (_searchHistory.length > 15) {
_searchHistory.removeLast();
}
}
saveSearchListToSharedPreferences(_searchHistory);
setState(() {});
},
style: TextStyle(
textBaseline: TextBaseline.ideographic,
fontSize: 32.sp,
color: Colors.black,
),
controller: _editingController,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 20.w),
//filled: true,
fillColor: Color(0xFFF3F3F3),
hintText: "请输入想要搜索的内容...",
hintStyle: TextStyle(
color: Colors.grey.shade500,
fontSize: 14,
fontWeight: FontWeight.w300),
//isDense: true,
// prefixIcon: Icon(CupertinoIcons.search),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: ktextPrimary),
borderRadius: BorderRadius.circular(40),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFE52E2E)),
borderRadius: BorderRadius.circular(40),
),
),
),
),
20.wb,
Image.asset(R.ASSETS_ICONS_ICON_CHANGE_LIST_PNG,width: 48.w,height: 48.w,),
Text(
'搜索',
style: TextStyle(color: ktextPrimary, fontSize: 28.sp),
),
],
),
body: Column(
children: [
Row(
children: [
normalTypeButton,
salesTypeButton,
priceButton,
],
),
10.hb,
10.hb,
_showList
? Container(
color: Color(0xFFF2F3F4),
child: BeeListView(
path: API.market.search,
controller: _refreshController,
extraParams: {'searchName': ''},
convert: (model) => model.tableList!
.map((e) => GoodsItem.fromJson(e))
.toList(),
builder: (items) {
return ListView.separated(
padding: EdgeInsets.only(top: 10.w,
left: 20.w, right: 20.w, bottom: 32.w),
// gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// mainAxisSpacing: 20.w,
// crossAxisSpacing: 20.w,
// ),
itemBuilder: (context, index) {
final item = items[index];
return _hotGoodsCard(
item, index); //GoodsCard(item: item);
},
separatorBuilder: (_, __) {
return 32.w.heightBox;
},
itemCount: items.length,
);
},
),
).expand()
: SizedBox(),
],
),
);
}
_hotGoodsCard(GoodsItem goodsItem, int index) {
return Row(
children: [
Stack(
children: [
Material(
color: Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(16.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(goodsItem.imgList)),
fit: BoxFit.fill,
width: 124.w,
height: 124.w,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 124.w,
height: 124.w,
);
},
),
),
// Image.asset(
// R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
// fit: BoxFit.fill,
// width: 124.w,
// height: 124.w,
// ),
Positioned(
left: 0,
top: 0,
child: Container(
alignment: Alignment.center,
width: 32.w,
height: 32.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.w),
topRight: Radius.circular(16.w),
bottomLeft: Radius.circular(16.w)),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomCenter,
colors: index == 0
? <Color>[
Color(0xFFE52E2E),
Color(0xFFF58123),
]
: index == 1
? <Color>[
Color(0xFFF58123),
Color(0xFFF5AF16),
]
: index == 2
? <Color>[
Color(0xFFF5AF16),
Color(0xFFF5AF16),
]
: <Color>[
Color(0xFFBBBBBB),
Color(0xFFBBBBBB),
],
),
),
child: Text(
'${index + 1}',
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
),
),
)),
],
),
32.wb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 500.w,
child: Text(
goodsItem.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: ktextPrimary, fontSize: 28.sp),
),
),
8.hb,
Row(
children: [
Text(
'人气值',
style: TextStyle(color: ktextSubColor, fontSize: 24.sp),
),
10.wb,
Text(
'99251',
style: TextStyle(color: Color(0xFFBBBBBB), fontSize: 24.sp),
),
],
)
],
)
],
);
}
_searchHistoryWidget() {
List<Widget> choiceChipList = [];
if (_searchHistory != null && _searchHistory.length > 0) {
for (var text in _searchHistory) {
choiceChipList.add(Padding(
padding: EdgeInsets.only(right: 10, bottom: 5),
child: ChoiceChip(
backgroundColor: Colors.white,
// disabledColor: Colors.blue,
labelStyle: TextStyle(fontSize: 15 * 2.sp, color: Colors.black),
labelPadding: EdgeInsets.only(left: 20, right: 20),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onSelected: (bool value) {
_editingController.text = text;
_searchText = text;
FocusManager.instance.primaryFocus!.unfocus();
setState(() {});
},
label: Text(text),
selected: false,
),
));
}
}
return _searchHistory.length == 0
? SizedBox()
: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
36.hb,
Container(
child: Container(
margin: EdgeInsets.only(left: 15, bottom: 5),
child: Row(
children: <Widget>[
Text(
'历史搜索',
style: TextStyle(
color: Colors.black,
fontSize: 16,
),
),
Spacer(),
(_searchHistory != null && _searchHistory.length > 0)
? GestureDetector(
onTap: () {
_searchHistory = [];
saveSearchListToSharedPreferences(
_searchHistory);
setState(() {});
},
child: Image.asset(
R.ASSETS_ICONS_DELETE_PNG,
width: 40.w,
height: 40.w,
),
)
: Container(),
36.wb,
],
)),
),
Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(left: 10, right: 10),
child: Wrap(
children: choiceChipList,
),
),
// Spacer()
24.hb,
],
),
);
}
getSearchListFromSharedPreferences() async {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
_searchHistory = HiveStore.appBox!.get(
userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory")!;
if (_searchHistory == null) {
_searchHistory = [];
}
setState(() {});
}
saveSearchListToSharedPreferences(List<String> value) async {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
HiveStore.appBox!.put(
userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory",
value);
}
}

@ -0,0 +1,97 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/order/order_detail_model.dart';
import 'package:aku_community/models/search/search_goods_model.dart';
import 'package:aku_community/utils/network/base_list_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/text_utils.dart';
class SearchFunc {
///
static Future<List<SearchGoodsModel>> getGoodsList(int pageNum,int size
,int orderBySalesVolume,int orderByPrice,String keyword, int brandId,double minPrice,double maxPrice) async {
//orderBySalesVolume 1 2
Map<String, dynamic> params = {
"pageNum": pageNum,
"size":size,
};
if(orderBySalesVolume!=-1){
params.putIfAbsent("orderBySalesVolume", () => orderBySalesVolume);
}
if(orderByPrice!=-1){
params.putIfAbsent("orderByPrice", () => orderByPrice);
}
if (!TextUtils.isEmpty(keyword)) {
params.putIfAbsent("keyword", () => keyword);
}
if(brandId!=-1){
params.putIfAbsent("brandId", () => brandId);
}
if(minPrice!=-1){
params.putIfAbsent("minPrice", () => minPrice);
}
if(maxPrice!=-1){
params.putIfAbsent("maxPrice", () => maxPrice);
}
BaseListModel model = await NetUtil().getList(
API.market.findGoodsList,
params: params,
);
if (model.tableList!.length == 0) return [];
return model.tableList!.map((e) => SearchGoodsModel.fromJson(e)).toList();
}
///
static Future confirmReceive(int goodsAppointmentId) async {
await NetUtil().get(API.market.confirmReceive,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
}
///退
static Future refundOrder(
int goodsAppointmentId, String reson, int type) async {
BaseModel baseModel = await NetUtil().get(API.market.refundOrder,
params: {
"goodsAppointmentId": goodsAppointmentId,
"backReason": reson,
"backType": type
},
showMessage: true);
return baseModel;
}
///
static Future cancelOrder(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.cancleOrder,
params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true);
return baseModel;
}
///
static Future goodsEvalution(
int goodsAppointmentId, int rating, String evaluationReason) async {
BaseModel baseModel = await NetUtil().get(API.market.goodsEvaluation,
params: {
"goodsAppointmentId": goodsAppointmentId,
"score": rating,
"evaluationReason": evaluationReason
},
showMessage: true);
return baseModel;
}
///
static Future getOrderDetail(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
params: {"goodsAppointmentId": goodsAppointmentId});
if (baseModel.status! && baseModel.data != null) {
return OrderDetailModel.fromJson(baseModel.data);
}
}
}

@ -1,7 +1,23 @@
import 'dart:math';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/search/search_goods_model.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/market/collection/collection_list_card.dart';
import 'package:aku_community/ui/market/collection/my_collection.dart';
import 'package:aku_community/ui/market/search/search_detail_page.dart';
import 'package:aku_community/ui/market/search/search_func.dart';
import 'package:aku_community/utils/hive_store.dart';
import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/utils/text_utils.dart';
import 'package:aku_community/widget/bee_back_button.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:waterfall_flow/waterfall_flow.dart'; import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
@ -12,6 +28,8 @@ import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'goods_list_card.dart';
enum OrderType { enum OrderType {
NORMAL, NORMAL,
SALES, SALES,
@ -31,15 +49,38 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
OrderType _orderType = OrderType.NORMAL; OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down; IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
EasyRefreshController _refreshController1 = EasyRefreshController();
List<String> _searchHistory = [];
String _searchText = "";
FocusNode _contentFocusNode = FocusNode();
bool _showList = true;
bool _startSearch = false;
int? orderBySalesVolume;
int? orderByPrice;
int? brandId;
double? minPrice;
double? maxPrice;
late List<SearchGoodsModel> _models;
ScrollController _scrollController= new ScrollController();
@override
void initState() {
super.initState();
getSearchListFromSharedPreferences();
}
@override @override
void dispose() { void dispose() {
_refreshController.dispose(); _refreshController.dispose();
_refreshController1.dispose();
_scrollController.dispose();
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
final normalTypeButton = MaterialButton( final normalTypeButton = MaterialButton(
onPressed: () { onPressed: () {
_orderType = OrderType.NORMAL; _orderType = OrderType.NORMAL;
@ -116,59 +157,485 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
height: 80.w, height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
); );
return BeeScaffold( return
title: Padding( BeeScaffold(
padding: EdgeInsets.symmetric(vertical: 12.w), // fab: FloatingActionButton(
// backgroundColor: Colors.transparent,
// foregroundColor: Colors.transparent,
// elevation: 0,
// highlightElevation: 0,
// shape: new ,
// onPressed: () {
// },
// child: Column(
// children: [
// Image.asset(R.ASSETS_ICONS_COLLECT_PNG,width: 84.w,height: 84.w,),
// 24.hb,
// Image.asset(R.ASSETS_ICONS_ICON_TOTOP_PNG,width: 84.w,height: 84.w,),
// ],
// ),
// ),
titleSpacing: 0,
bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9),
title: Row(
children: [
Container(
width: 520.w,
height: 68.w,
child: TextField( child: TextField(
keyboardType: TextInputType.text,
onEditingComplete: () { onEditingComplete: () {
setState(() {}); setState(() {});
_refreshController.callRefresh(); // _refreshController.callRefresh();
},
focusNode: _contentFocusNode,
onChanged: (text) {
_startSearch = false;
_searchText = text;
setState(() {});
},
onSubmitted: (_submitted) async {
if (TextUtils.isEmpty(_searchText)) return;
_startSearch = true;
_contentFocusNode.unfocus();
_searchText = _searchText.trimLeft();
_searchText = _searchText.trimRight();
remember();
saveSearchListToSharedPreferences(_searchHistory);
_refreshController1.callRefresh();
setState(() {});
}, },
style: TextStyle(
textBaseline: TextBaseline.ideographic,
fontSize: 32.sp,
color: Colors.black,
),
controller: _editingController, controller: _editingController,
decoration: InputDecoration( decoration: InputDecoration(
border: OutlineInputBorder( contentPadding: EdgeInsets.only(left: 20.w),
//filled: true,
fillColor: Color(0xFFF3F3F3),
hintText: "请输入想要搜索的内容...",
hintStyle: TextStyle(
color: Colors.grey.shade500,
fontSize: 14,
fontWeight: FontWeight.w300),
//isDense: true,
// prefixIcon: Icon(CupertinoIcons.search),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: ktextPrimary),
borderRadius: BorderRadius.circular(40), borderRadius: BorderRadius.circular(40),
), ),
filled: true, focusedBorder: OutlineInputBorder(
fillColor: Color(0xFFF3F3F3), borderSide: BorderSide(color: Color(0xFFE52E2E)),
isDense: true, borderRadius: BorderRadius.circular(40),
prefixIcon: Icon(CupertinoIcons.search),
), ),
), ),
), ),
//TODO ),
// appBarBottom: PreferredSize( 20.wb,
// child: Row( GestureDetector(
// children: [ onTap: (){
// normalTypeButton, if (TextUtils.isEmpty(_searchText)) return;
// salesTypeButton, _startSearch = true;
// priceButton, _contentFocusNode.unfocus();
// ], _searchText = _searchText.trimLeft();
// ), _searchText = _searchText.trimRight();
// preferredSize: Size.fromHeight(80.w), remember();
// ), saveSearchListToSharedPreferences(_searchHistory);
body: BeeListView( _refreshController1.callRefresh();
setState(() {});
},
child: Text(
'搜索',
style: TextStyle(color: ktextPrimary, fontSize: 28.sp),
),
),
],
),
body:Stack(
children: [
!(!TextUtils.isEmpty(_editingController.text) &&
_startSearch)
? Column(
children: [
_searchHistoryWidget(),
10.hb,
Row(
children: [
20.wb,
Text(
'热搜榜',
style: TextStyle(
color: ktextSubColor,
fontSize: 32.sp,
),
),
Spacer(),
GestureDetector(
child: Image.asset(
_showList
? R.ASSETS_ICONS_XIANSHI_PNG
: R.ASSETS_ICONS_EYE_CLOSE_PNG,
width: 40.w,
height: 40.w,
),
onTap: () {
_showList = !_showList;
setState(() {});
},
),
32.wb,
],
),
10.hb,
_showList
? Container(
color: Color(0xFFF2F3F4),
child: BeeListView(
path: API.market.search, path: API.market.search,
controller: _refreshController, controller: _refreshController,
extraParams: {'searchName': _editingController.text}, extraParams: {'searchName': ''},
convert: (model) => convert: (model) => model.tableList!
model.tableList!.map((e) => GoodsItem.fromJson(e)).toList(), .map((e) => GoodsItem.fromJson(e))
.toList(),
builder: (items) { builder: (items) {
return WaterfallFlow.builder( return ListView.separated(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.only(top: 10.w,
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount( left: 20.w, right: 20.w, bottom: 32.w),
crossAxisCount: 2,
mainAxisSpacing: 20.w, // gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 20.w, // crossAxisCount: 2,
// mainAxisSpacing: 20.w,
// crossAxisSpacing: 20.w,
// ),
itemBuilder: (context, index) {
final item = items[index];
return _hotGoodsCard(
item, index); //GoodsCard(item: item);
},
separatorBuilder: (_, __) {
return 32.w.heightBox;
},
itemCount: items.length,
);
},
),
).expand()
: SizedBox(),
],
):Column(
children: [
Row(
children: [
normalTypeButton,
salesTypeButton,
priceButton,
],
), ),
10.hb,
Container(
color: Color(0xFFF2F3F4),
child: BeeListView(
path: API.market.findGoodsList,
controller: _refreshController1,
refreshExtra:( model) => _models = model as List<SearchGoodsModel>,
extraParams: {"orderBySalesVolume":orderBySalesVolume,"orderByPrice":orderByPrice,
"keyword":_searchText,
"brandId":brandId,"minPrice":minPrice,"maxPrice":maxPrice,},
convert: (model) => model.tableList!
.map((e) => SearchGoodsModel.fromJson(e))
.toList(),
builder: (items) {
return ListView.separated(
controller: _scrollController,
padding: EdgeInsets.only(top: 10.w,
left: 20.w, right: 20.w, bottom: 32.w),
// gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2,
// mainAxisSpacing: 20.w,
// crossAxisSpacing: 20.w,
// ),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final item = items[index]; final item = items[index];
return GoodsCard(item: item); return GoodsListCard(
model: item,); //GoodsCard(item: item);
},
separatorBuilder: (_, __) {
return 32.w.heightBox;
}, },
itemCount: items.length, itemCount: items.length,
); );
}, },
), ),
).expand(),
],
),
Positioned(
right: 26.w,
bottom: 92.w,
child: Column(
children: [
GestureDetector(
child: Image.asset(R.ASSETS_ICONS_COLLECT_PNG,width: 84.w,height: 84.w,),
onTap: (){
Get.to(() => MyCollectionPage());
},
),
24.hb,
GestureDetector(
child: Image.asset(R.ASSETS_ICONS_ICON_TOTOP_PNG,width: 84.w,height: 84.w,),
onTap: (){
_scrollController.jumpToTop();
},
),
],
),
),
],
)
);
}
///
remember() {
if (_searchHistory.contains(_searchText)) {
_searchHistory.remove(_searchText);
List<String> list = [_searchText];
list.addAll(_searchHistory);
_searchHistory = list;
} else {
List<String> list = [_searchText];
list.addAll(_searchHistory);
_searchHistory = list;
while (_searchHistory.length > 15) {
_searchHistory.removeLast();
}
}
saveSearchListToSharedPreferences(_searchHistory);
setState(() {});
}
_hotGoodsCard(GoodsItem goodsItem, int index) {
return Row(
children: [
Stack(
children: [
Material(
color: Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(16.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(goodsItem.imgList)),
fit: BoxFit.fill,
width: 124.w,
height: 124.w,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 124.w,
height: 124.w,
);
},
),
),
Positioned(
left: 0,
top: 0,
child: Container(
alignment: Alignment.center,
width: 32.w,
height: 32.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16.w),
topRight: Radius.circular(16.w),
bottomLeft: Radius.circular(16.w)),
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomCenter,
colors: index == 0
? <Color>[
Color(0xFFE52E2E),
Color(0xFFF58123),
]
: index == 1
? <Color>[
Color(0xFFF58123),
Color(0xFFF5AF16),
]
: index == 2
? <Color>[
Color(0xFFF5AF16),
Color(0xFFF5AF16),
]
: <Color>[
Color(0xFFBBBBBB),
Color(0xFFBBBBBB),
],
),
),
child: Text(
'${index + 1}',
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
),
),
)),
],
),
32.wb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 500.w,
child: Text(
goodsItem.title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: ktextPrimary, fontSize: 28.sp),
),
),
8.hb,
Row(
children: [
Text(
'人气值',
style: TextStyle(color: ktextSubColor, fontSize: 24.sp),
),
10.wb,
Text(
'99251',
style: TextStyle(color: Color(0xFFBBBBBB), fontSize: 24.sp),
),
],
)
],
)
],
);
}
///
_searchHistoryWidget() {
List<Widget> choiceChipList = [];
if (_searchHistory != null && _searchHistory.length > 0) {
for (var text in _searchHistory) {
choiceChipList.add(Padding(
padding: EdgeInsets.only(right: 10, bottom: 5),
child: ChoiceChip(
backgroundColor: Colors.white,
// disabledColor: Colors.blue,
labelStyle: TextStyle(fontSize: 15 * 2.sp, color: Colors.black),
labelPadding: EdgeInsets.only(left: 20, right: 20),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onSelected: (bool value) {
_startSearch = true;
_editingController.text = text;
_searchText = text;
setState(() {});
FocusManager.instance.primaryFocus!.unfocus();
_refreshController1.callRefresh();
},
label: Text(text),
selected: false,
),
));
}
}
return _searchHistory.length == 0
? SizedBox()
: Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
36.hb,
Container(
child: Container(
margin: EdgeInsets.only(left: 15, bottom: 5),
child: Row(
children: <Widget>[
Text(
'历史搜索',
style: TextStyle(
color: Colors.black,
fontSize: 16,
),
),
Spacer(),
(_searchHistory != null && _searchHistory.length > 0)
? GestureDetector(
onTap: () {
_searchHistory = [];
saveSearchListToSharedPreferences(
_searchHistory);
setState(() {});
},
child: Image.asset(
R.ASSETS_ICONS_DELETE_PNG,
width: 40.w,
height: 40.w,
),
)
: Container(),
36.wb,
],
)),
),
Container(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.only(left: 10, right: 10),
child: Wrap(
children: choiceChipList,
),
),
// Spacer()
24.hb,
],
),
); );
} }
///
getSearchListFromSharedPreferences() async {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
_searchHistory = HiveStore.appBox!.get(
userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory")??'';
if (_searchHistory == null) {
_searchHistory = [];
}
setState(() {});
}
///
saveSearchListToSharedPreferences(List<String> value) async {
final userProvider = Provider.of<UserProvider>(Get.context!, listen: false);
HiveStore.appBox!.put(
userProvider.userInfoModel?.id.toString() ?? '' + "userSearhHistory",
value);
}
} }

@ -28,4 +28,17 @@ class BeeDateUtil {
else else
return DateUtil.formatDate(date, format: 'yyyy-MM-dd'); return DateUtil.formatDate(date, format: 'yyyy-MM-dd');
} }
String get timeAgoWithHm {
Duration duration = _now.difference(date!);
if (duration.inSeconds <= 60) return '${duration.inSeconds}秒前';
if (duration.inMinutes <= 60) return '${duration.inMinutes}分钟前';
if (duration.inHours <= 12) return '${duration.inHours}小时前';
if (isYesterday) return '昨天';
if (isDoubleYesterday) return '前天';
if (duration.inDays <= 30)
return '${duration.inDays}天前';
else
return DateUtil.formatDate(date, format: 'yyyy-MM-dd HH-mm');
}
} }

@ -19,6 +19,8 @@ class BeeScaffold extends StatelessWidget {
final Widget? bottomNavi; final Widget? bottomNavi;
final PreferredSizeWidget? appBarBottom; final PreferredSizeWidget? appBarBottom;
final FloatingActionButton? fab; final FloatingActionButton? fab;
final double? titleSpacing;
final SystemUiOverlayStyle systemStyle; final SystemUiOverlayStyle systemStyle;
BeeScaffold({ BeeScaffold({
@ -32,7 +34,9 @@ class BeeScaffold extends StatelessWidget {
this.bottomNavi, this.bottomNavi,
this.appBarBottom, this.appBarBottom,
this.fab, this.fab,
this.titleSpacing,
this.systemStyle = SystemStyle.initial, this.systemStyle = SystemStyle.initial,
}) : super(key: key); }) : super(key: key);
BeeScaffold.white({ BeeScaffold.white({
@ -45,6 +49,7 @@ class BeeScaffold extends StatelessWidget {
this.bottomNavi, this.bottomNavi,
this.appBarBottom, this.appBarBottom,
this.fab, this.fab,
this.titleSpacing,
this.systemStyle = SystemStyle.initial, this.systemStyle = SystemStyle.initial,
}) : this.bodyColor = Colors.white, }) : this.bodyColor = Colors.white,
super(key: key); super(key: key);
@ -66,6 +71,7 @@ class BeeScaffold extends StatelessWidget {
leading: leading ?? BeeBackButton(), leading: leading ?? BeeBackButton(),
actions: actions, actions: actions,
bottom: appBarBottom, bottom: appBarBottom,
titleSpacing: titleSpacing,
); );
return AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(
@ -76,6 +82,7 @@ class BeeScaffold extends StatelessWidget {
body: body, body: body,
bottomNavigationBar: bottomNavi, bottomNavigationBar: bottomNavi,
floatingActionButton: fab, floatingActionButton: fab,
), ),
); );
} }

@ -113,6 +113,7 @@ dependencies:
#划动组件 #划动组件
carousel_slider: ^4.0.0-nullsafety.0 carousel_slider: ^4.0.0-nullsafety.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter

Loading…
Cancel
Save