搜索 收藏

hmxc
章文轩 3 years ago
parent c61b1bcfe3
commit dcbf791fad

@ -98,6 +98,7 @@ dependencies {
implementation 'com.amap.api:3dmap:latest.integration'
implementation 'com.amap.api:location:latest.integration'
implementation 'com.android.support:multidex:2.0.1'
}
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)
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)
static const String 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)
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)
static const String 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)
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)
static const String ASSETS_ICONS_FACILITY_PNG = 'assets/icons/facility.png';
/// ![preview](file:///Users/datang/aku_community/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)
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 =
'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)
static const String 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 =
'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)
static const String 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)
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 =
'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)
static const String ASSETS_IMAGES_APPLICATION_PNG =
'assets/images/application.png';

@ -416,6 +416,20 @@ class _Market {
///appid
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 {

@ -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> {
CommunityIontroduceModel _model = CommunityIontroduceModel.init();
bool _onload = false;
bool _onload = true;
@override
Widget build(BuildContext context) {

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

@ -53,8 +53,7 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
@override
bool get wantKeepAlive => true;
int _currentIndicator = 0;
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/application_objects.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/painters/user_bottom_bar_painter.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/utils/headers.dart';
import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/views/application_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -26,14 +31,14 @@ class PersonalIndex extends StatefulWidget {
}
class _PersonalIndexState extends State<PersonalIndex>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
SliverAppBar _sliverAppBar(double height) {
final userProvider = Provider.of<UserProvider>(context);
return SliverAppBar(
pinned: true,
pinned: false,
toolbarHeight: 0,
elevation: 0,
floating: true,
floating: false,
expandedHeight: 450.w - height,
backgroundColor: Colors.white,
@ -68,7 +73,7 @@ class _PersonalIndexState extends State<PersonalIndex>
child: Row(
children: [
Hero(
tag: 'AVATAR',
tag: 'AVATAR1',
child: ClipOval(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -148,66 +153,397 @@ class _PersonalIndexState extends State<PersonalIndex>
);
}
Container _containerBar(String title) {
return Container(
color: title == '我的物业' ? Colors.white : BaseStyle.colorf9f9f9,
padding: EdgeInsets.all(title == '我的物业' ? 0 : 32.w),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: BaseStyle.fontSize34,
color: ktextPrimary,
),
),
],
),
);
}
// Container _containerBar(String title) {
// return Container(
// color: title == '我的物业' ? Colors.white : BaseStyle.colorf9f9f9,
// padding: EdgeInsets.all(title == '我的物业' ? 0 : 32.w),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// title,
// style: TextStyle(
// fontWeight: FontWeight.w600,
// fontSize: BaseStyle.fontSize34,
// color: ktextPrimary,
// ),
// ),
// ],
// ),
// );
// }
Widget _orderButton({
required String name,
required String path,
required int index,
}) {
return MaterialButton(
return GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(path, height: 50.w, width: 50.w),
Image.asset(path, height: 64.w, width: 64.w),
10.hb,
Text(
name,
style: TextStyle(
color: Color(0xFF333333),
fontSize: 22.sp,
fontSize: 26.sp,
),
),
],
),
onPressed: () {
onTap: () {
Get.to(() => OrderPage(initIndex: index));
},
);
).expand();
}
@override
Widget build(BuildContext context) {
final double _statusHeight = MediaQuery.of(context).padding.top;
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(
mainAxisSize: MainAxisSize.min,
children: [
_containerBar('我的订单'),
GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
Container(
width: 686.w,
height: 282.w,
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: [
_orderButton(
name: '待付款',
@ -233,20 +569,8 @@ class _PersonalIndexState extends State<PersonalIndex>
),
],
),
);
return Scaffold(
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {
await userProvider.updateProfile();
await userProvider.updateUserDetail();
},
child: CustomScrollView(
slivers: <Widget>[
_sliverAppBar(_statusHeight),
// orderWidget,
SliverToBoxAdapter(
child: Container(
),
Container(
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8)),
@ -257,23 +581,202 @@ class _PersonalIndexState extends State<PersonalIndex>
),
],
),
margin: EdgeInsets.all(20.w),
padding: EdgeInsets.all(12.w),
margin: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_containerBar('我的物业'),
ApplicationView.custom(
items: userAppObjects,
needAllApp: false,
_function('我的房屋', R.ASSETS_ICONS_USER_ICON_WDFW_PNG, () => HouseOwnersPage(
identify: UserTool.userProvider.userDetailModel!.type ?? 4,
),userProvider.userDetailModel!.estateNames?[0]??'',),
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>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
int sum = 0;
int commentCount = 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(List<T?> model)? refreshExtra;
///
final Widget Function(dynamic items) builder;
@ -64,7 +65,7 @@ class BeeListView<T> extends StatefulWidget {
required this.convert,
required this.builder,
this.size = 10,
this.extraParams,
this.extraParams, this.refreshExtra ,
}) : super(key: key);
@override
@ -98,6 +99,9 @@ class _BeeListViewState<T> extends State<BeeListView> {
);
_models = widget.convert(_model) as List<T?>;
widget.controller?.resetLoadState();
if(widget.refreshExtra!=null){
widget.refreshExtra!(_models);
}
if (mounted) setState(() {});
},
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:badges/badges.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
@ -27,15 +39,25 @@ class CommunityPage extends StatefulWidget {
class _CommunityPageState extends State<CommunityPage>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
TabController? _tabController;
late EasyRefreshController _easyRefreshController;
List<String> _tabs = [];
GlobalKey<TopicCommunityViewState> topicKey =
GlobalKey<TopicCommunityViewState>();
GlobalKey<MyCommunityViewState> myKey = GlobalKey<MyCommunityViewState>();
GlobalKey<NewCommunityViewState> newKey = GlobalKey<NewCommunityViewState>();
List<EventItemModel> _newItems = [];
int _pageNum = 1;
int _size = 4;
int _pageCount = 0;
bool _onload = true;
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
final userProvider = Provider.of<UserProvider>(context, listen: false);
if (userProvider.isLogin) _tabs = ['最新', '话题', '我的'];
if (userProvider.isNotLogin) _tabs = ['最新', '话题'];
@ -48,6 +70,7 @@ class _CommunityPageState extends State<CommunityPage>
@override
void dispose() {
_tabController?.dispose();
_easyRefreshController.dispose();
super.dispose();
}
@ -56,8 +79,40 @@ class _CommunityPageState extends State<CommunityPage>
super.build(context);
final userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '社区',
return Scaffold(
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: [
Badge(
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 {
if (LoginUtil.isNotLogin) return;
bool? result = await Get.to(() => AddNewEventPage());
@ -98,31 +156,326 @@ class _CommunityPageState extends State<CommunityPage>
heroTag: 'event_add',
child: Icon(Icons.add),
),
appBarBottom: PreferredSize(
preferredSize: Size.fromHeight(48),
child: Align(
alignment: Alignment.centerLeft,
child: BeeTabBar(
controller: _tabController,
tabs: _tabs,
scrollable: true,
),
),
),
body: TabBarView(
children: userProvider.isLogin
? [
NewCommunityView(key: newKey),
TopicCommunityView(key: topicKey),
MyCommunityView(key: myKey),
]
: [
NewCommunityView(key: newKey),
TopicCommunityView(key: topicKey),
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _easyRefreshController,
onRefresh: () async {
await (getNewInfo());
_onload = false;
setState(() {});
},
child: _onload
? SizedBox()
: ListView(
children: [
2.hb,
_getInfo(),
16.hb,
_getNews(),
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(
decoration: BoxDecoration(
color: Colors.white,
border: Border(
bottom: BorderSide(
color: widget.hideLine
? Colors.transparent
: Color(0xFFE5E5E5).withOpacity(0.5),
),
),
// border: Border(
// bottom: BorderSide(
// color: widget.hideLine
// ? Colors.transparent
// : Color(0xFFE5E5E5).withOpacity(0.5),
// ),
// ),
),
child: MaterialButton(
padding: EdgeInsets.zero,
@ -294,36 +294,51 @@ class _ChatCardState extends State<ChatCard> {
Get.to(() => EventDetailPage(themeId: widget.model!.id));
}
: null,
child: Row(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
[
Material(
color: Color(0xFFF5F5F5),
borderRadius: BorderRadius.circular(6.w),
borderRadius: BorderRadius.circular(48.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API
.image(ImgModel.first(widget.model!.headSculptureImgUrl)),
height: 86.w,
width: 86.w,
height: 96.w,
width: 96.w,
fit: BoxFit.cover,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP,height: 86.w,
width: 86.w,);
},
),
),
24.wb,
).paddingOnly(left: 32.w),
20.wb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
[
widget.model!.createName!.text.black
.size(36.sp)
.make()
.expand(),
Text(
widget.model!.createName!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
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(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.w)),
@ -343,36 +358,52 @@ class _ChatCardState extends State<ChatCard> {
cancel();
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(),
6.hb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
32.hb,
widget.model!.content!.text.size(32.sp).black.make(),
20.hb,
32.hb,
_renderImage(),
widget.model!.gambitTitle?.isEmpty ?? true
? SizedBox()
: Chip(
label: '# ${widget.model!.gambitTitle}'
.text
.size(22.sp)
.color(Color(0xFF547fc0))
.size(28.sp)
.make(),
padding: EdgeInsets.symmetric(
horizontal: 16.w, vertical: 5.w),
labelPadding: EdgeInsets.zero,
backgroundColor: Colors.transparent,
shape: StadiumBorder(
side: BorderSide(),
),
).pOnly(top: 10.w),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// shape: StadiumBorder(
// side: BorderSide(),
// ),
).pOnly(top: 20.w),
20.hb,
],
).paddingOnly(right: 32.w,left: 32.w),
Divider(height: 1.w, thickness: 1.w),
10.hb,
Row(
children: [
64.hb,
BeeDateUtil(widget.model!.date)
.timeAgo
.text
.size(28.sp)
.color(Color(0xFF999999))
.make(),
_isMyself
? TextButton(
onPressed: () async {
@ -411,12 +442,13 @@ class _ChatCardState extends State<ChatCard> {
_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: [
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(item.imgList)),
image: ImgModel.first(item.imgList),
fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(R.ASSETS_IMAGES_PLACEHOLDER_WEBP);
@ -70,13 +70,13 @@ class GoodsCard extends StatelessWidget {
],
),
),
Padding(
Container(
padding: EdgeInsets.only(
left: 16.w,right: 16.w,
top: 10.w,
),
child: Text(
item.title+'98-034789reuyguiuioprguioptuiop348907r789-0re8097grt789rge978-ge',
item.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -96,7 +96,7 @@ class GoodsCard extends StatelessWidget {
)
),
10.hb,
Padding(
padding: EdgeInsets.symmetric(
horizontal: 16.w,

@ -62,13 +62,16 @@ class _MarketPageState extends State<MarketPage>
double MessageHeight = 76.w;
double bannerHeight = 354.w;
double buttonsHeight = 334.w;
double searchHeight = 74.w.w;
double searchHeight = 74.w;
double tabBarHeight = 60.w;
late TabController _tabController;
List<SwiperModel> _swiperModels = [];
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
Future updateMarketInfo() async {
BaseListModel baseListModel =
await NetUtil().getList(API.market.hotTop, params: {
@ -755,10 +758,12 @@ class _MarketPageState extends State<MarketPage>
alignment: Alignment.centerLeft,
color: Color(0xFFF9F9F9),
width: MediaQuery.of(context).size.width,
child: Container(
child:
Container(
alignment: Alignment.centerLeft,
height: 60.w,
child: TabBar(
child:
TabBar(
onTap: (index) {
// _presenter.fetchList(_category.id, 0, _sortType);
setState(() {});
@ -777,15 +782,111 @@ class _MarketPageState extends State<MarketPage>
);
}
List<Widget> _tabItems() {
return [_tabItem(0,'综合推荐'),_tabItem(1,'销量'),_tabItem(2,'价格')];
return [_tabItemComprehensive(0,'综合推荐'),_tabItemSalesVolume(1,'销量'),_tabItemPrice(2,'价格')];
}
_tabItemComprehensive(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.NORMAL;
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: 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)),
),
],
),
),
),
);
}
_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,
),
],
),
),
),
);
}
_tabItem(int index,String text) {
_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,
@ -805,9 +906,13 @@ class _MarketPageState extends State<MarketPage>
],
),
),
),
);
}
@override
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/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';
@ -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/widget/bee_scaffold.dart';
import 'goods_list_card.dart';
enum OrderType {
NORMAL,
SALES,
@ -31,15 +49,38 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
OrderType _orderType = OrderType.NORMAL;
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
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
void dispose() {
_refreshController.dispose();
_refreshController1.dispose();
_scrollController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
final normalTypeButton = MaterialButton(
onPressed: () {
_orderType = OrderType.NORMAL;
@ -116,59 +157,485 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
height: 80.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
);
return BeeScaffold(
title: Padding(
padding: EdgeInsets.symmetric(vertical: 12.w),
return
BeeScaffold(
// 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(
keyboardType: TextInputType.text,
onEditingComplete: () {
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,
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),
),
filled: true,
fillColor: Color(0xFFF3F3F3),
isDense: true,
prefixIcon: Icon(CupertinoIcons.search),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFE52E2E)),
borderRadius: BorderRadius.circular(40),
),
),
),
//TODO
// appBarBottom: PreferredSize(
// child: Row(
// children: [
// normalTypeButton,
// salesTypeButton,
// priceButton,
// ],
// ),
// preferredSize: Size.fromHeight(80.w),
// ),
body: BeeListView(
),
20.wb,
GestureDetector(
onTap: (){
if (TextUtils.isEmpty(_searchText)) return;
_startSearch = true;
_contentFocusNode.unfocus();
_searchText = _searchText.trimLeft();
_searchText = _searchText.trimRight();
remember();
saveSearchListToSharedPreferences(_searchHistory);
_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,
controller: _refreshController,
extraParams: {'searchName': _editingController.text},
convert: (model) =>
model.tableList!.map((e) => GoodsItem.fromJson(e)).toList(),
extraParams: {'searchName': ''},
convert: (model) => model.tableList!
.map((e) => GoodsItem.fromJson(e))
.toList(),
builder: (items) {
return WaterfallFlow.builder(
padding: EdgeInsets.all(32.w),
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 20.w,
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(),
],
):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) {
final item = items[index];
return GoodsCard(item: item);
return GoodsListCard(
model: item,); //GoodsCard(item: item);
},
separatorBuilder: (_, __) {
return 32.w.heightBox;
},
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
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 PreferredSizeWidget? appBarBottom;
final FloatingActionButton? fab;
final double? titleSpacing;
final SystemUiOverlayStyle systemStyle;
BeeScaffold({
@ -32,7 +34,9 @@ class BeeScaffold extends StatelessWidget {
this.bottomNavi,
this.appBarBottom,
this.fab,
this.titleSpacing,
this.systemStyle = SystemStyle.initial,
}) : super(key: key);
BeeScaffold.white({
@ -45,6 +49,7 @@ class BeeScaffold extends StatelessWidget {
this.bottomNavi,
this.appBarBottom,
this.fab,
this.titleSpacing,
this.systemStyle = SystemStyle.initial,
}) : this.bodyColor = Colors.white,
super(key: key);
@ -66,6 +71,7 @@ class BeeScaffold extends StatelessWidget {
leading: leading ?? BeeBackButton(),
actions: actions,
bottom: appBarBottom,
titleSpacing: titleSpacing,
);
return AnnotatedRegion<SystemUiOverlayStyle>(
@ -76,6 +82,7 @@ class BeeScaffold extends StatelessWidget {
body: body,
bottomNavigationBar: bottomNavi,
floatingActionButton: fab,
),
);
}

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

Loading…
Cancel
Save