Merge branch 'master' of https://git.oa00.com/bee/aku_community
# Conflicts: # lib/pages/express_packages/express_package_card.darthmxc
commit
a04c47bd36
@ -0,0 +1,20 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'facility_type_detail_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class FacilityTypeDetailModel extends Equatable {
|
||||
final int id;
|
||||
final String name;
|
||||
FacilityTypeDetailModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
factory FacilityTypeDetailModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$FacilityTypeDetailModelFromJson(json);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id];
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'facility_type_detail_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
FacilityTypeDetailModel _$FacilityTypeDetailModelFromJson(
|
||||
Map<String, dynamic> json) {
|
||||
return FacilityTypeDetailModel(
|
||||
id: json['id'] as int,
|
||||
name: json['name'] as String,
|
||||
);
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
|
||||
class DisplayCategoryModel {
|
||||
final MarketCategoryModel model;
|
||||
final List<MarketCategoryModel> children;
|
||||
DisplayCategoryModel({
|
||||
required this.model,
|
||||
required this.children,
|
||||
});
|
||||
|
||||
static Future<List<MarketCategoryModel>> get top8 async {
|
||||
List<MarketCategoryModel> models = await fetchCategory(0);
|
||||
if (models.length >= 8)
|
||||
return models.getRange(0, 8).toList();
|
||||
else
|
||||
return models;
|
||||
}
|
||||
|
||||
///获取分类列表
|
||||
static Future<List<MarketCategoryModel>> fetchCategory(int parentId) async {
|
||||
BaseModel model = await NetUtil().get(
|
||||
API.market.category,
|
||||
params: {'parentId': parentId},
|
||||
);
|
||||
if (model.data == null) return [];
|
||||
return (model.data as List)
|
||||
.map((e) => MarketCategoryModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'market_category_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class MarketCategoryModel extends Equatable {
|
||||
final int id;
|
||||
final String name;
|
||||
final List<ImgModel> imgList;
|
||||
MarketCategoryModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.imgList,
|
||||
});
|
||||
@override
|
||||
List<Object?> get props => [id];
|
||||
|
||||
factory MarketCategoryModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$MarketCategoryModelFromJson(json);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'market_category_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
MarketCategoryModel _$MarketCategoryModelFromJson(Map<String, dynamic> json) {
|
||||
return MarketCategoryModel(
|
||||
id: json['id'] as int,
|
||||
name: json['name'] as String,
|
||||
imgList: (json['imgList'] as List<dynamic>)
|
||||
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/models/facility/facility_type_detail_model.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:aku_community/widget/bee_divider.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
|
||||
class FacilityTypeDetailPage extends StatefulWidget {
|
||||
final int id;
|
||||
final FacilityTypeDetailModel? model;
|
||||
FacilityTypeDetailPage({
|
||||
Key? key,
|
||||
required this.model,
|
||||
required this.id,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_FacilityTypeDetailPageState createState() => _FacilityTypeDetailPageState();
|
||||
}
|
||||
|
||||
class _FacilityTypeDetailPageState extends State<FacilityTypeDetailPage> {
|
||||
List<FacilityTypeDetailModel> _models = [];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '选择设施',
|
||||
body: EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
onRefresh: () async {
|
||||
BaseModel model = await NetUtil().get(
|
||||
API.manager.facility.detailType,
|
||||
params: {'categoryId': widget.id},
|
||||
);
|
||||
_models = (model.data as List)
|
||||
.map((e) => FacilityTypeDetailModel.fromJson(e))
|
||||
.toList();
|
||||
setState(() {});
|
||||
},
|
||||
child: ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
final item = _models[index];
|
||||
return ListTile(
|
||||
onTap: () => selectModel(item),
|
||||
leading: Radio(
|
||||
value: item,
|
||||
groupValue: widget.model,
|
||||
onChanged: (_) {
|
||||
selectModel(item);
|
||||
},
|
||||
),
|
||||
title: Text(item.name),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) => BeeDivider.horizontal(),
|
||||
itemCount: _models.length,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void selectModel(FacilityTypeDetailModel model) {
|
||||
Get.back(result: model);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
class PublicInfomationCard extends StatelessWidget {
|
||||
const PublicInfomationCard({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
color: Colors.white,
|
||||
elevation: 0,
|
||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
onPressed: () {},
|
||||
padding: EdgeInsets.zero,
|
||||
child: Container(
|
||||
height: 248.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text('今日快讯|日本决定将核污水拍入海中,中方对此强势喊话日本考虑需谨慎'),
|
||||
Spacer(),
|
||||
DefaultTextStyle(
|
||||
style: TextStyle(
|
||||
color: ktextSubColor,
|
||||
fontSize: 20.sp,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('测试'),
|
||||
Spacer(),
|
||||
Text('发布于 4-11 10:11'),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
32.wb,
|
||||
SizedBox(
|
||||
width: 240.w,
|
||||
height: 200.w,
|
||||
child: Placeholder(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:aku_community/ui/home/public_infomation/public_infomation_card.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
class PublicInfomationView extends StatefulWidget {
|
||||
PublicInfomationView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PublicInfomationViewState createState() => _PublicInfomationViewState();
|
||||
}
|
||||
|
||||
class _PublicInfomationViewState extends State<PublicInfomationView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w),
|
||||
itemBuilder: (context, index) {
|
||||
return PublicInfomationCard();
|
||||
},
|
||||
separatorBuilder: (_, __) => 24.hb,
|
||||
itemCount: 100,
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/goods/goods_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
class CategoryCard extends StatelessWidget {
|
||||
final MarketCategoryModel model;
|
||||
const CategoryCard({Key? key, required this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
child: Column(
|
||||
children: [
|
||||
Spacer(),
|
||||
FadeInImage.assetNetwork(
|
||||
image: API.image(ImgModel.first(model.imgList)),
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
height: 75.w,
|
||||
width: 75.w,
|
||||
),
|
||||
12.hb,
|
||||
Text(
|
||||
model.name,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xFF4A4B51),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
() => GoodsListView(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/goods/goods_list_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
class CategorySubCard extends StatelessWidget {
|
||||
final MarketCategoryModel model;
|
||||
const CategorySubCard({Key? key, required this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
child: Column(
|
||||
children: [
|
||||
Spacer(),
|
||||
FadeInImage.assetNetwork(
|
||||
image: API.image(ImgModel.first(model.imgList)),
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
height: 75.w,
|
||||
width: 75.w,
|
||||
),
|
||||
12.hb,
|
||||
Text(
|
||||
model.name,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xFF4A4B51),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
() => GoodsListView(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import 'package:aku_community/models/market/display_category_model.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/category/category_sub_card.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
|
||||
class CategorySubView extends StatefulWidget {
|
||||
final int id;
|
||||
CategorySubView({Key? key, required this.id}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CategorySubViewState createState() => _CategorySubViewState();
|
||||
}
|
||||
|
||||
class _CategorySubViewState extends State<CategorySubView> {
|
||||
List<MarketCategoryModel> _models = [];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyRefresh(
|
||||
header: MaterialHeader(),
|
||||
firstRefresh: true,
|
||||
onRefresh: () async {
|
||||
_models = await DisplayCategoryModel.fetchCategory(widget.id);
|
||||
setState(() {});
|
||||
},
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final model = _models[index];
|
||||
return CategorySubCard(model: model);
|
||||
},
|
||||
itemCount: _models.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
|
||||
class GoodsDetailPage extends StatefulWidget {
|
||||
GoodsDetailPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_GoodsDetailPageState createState() => _GoodsDetailPageState();
|
||||
}
|
||||
|
||||
class _GoodsDetailPageState extends State<GoodsDetailPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold();
|
||||
}
|
||||
}
|
@ -0,0 +1,148 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||
|
||||
import 'package:aku_community/base/base_style.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 SearchGoodsPage extends StatefulWidget {
|
||||
SearchGoodsPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
SearchGoodsPageState createState() => SearchGoodsPageState();
|
||||
}
|
||||
|
||||
class SearchGoodsPageState extends State<SearchGoodsPage> {
|
||||
TextEditingController _editingController = TextEditingController();
|
||||
OrderType _orderType = OrderType.NORMAL;
|
||||
IconData priceIcon = CupertinoIcons.chevron_up_chevron_down;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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(
|
||||
title: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12.w),
|
||||
child: TextField(
|
||||
controller: _editingController,
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Color(0xFFF3F3F3),
|
||||
isDense: true,
|
||||
prefixIcon: Icon(CupertinoIcons.search),
|
||||
),
|
||||
),
|
||||
),
|
||||
//TODO 列表排序
|
||||
// appBarBottom: PreferredSize(
|
||||
// child: Row(
|
||||
// children: [
|
||||
// normalTypeButton,
|
||||
// salesTypeButton,
|
||||
// priceButton,
|
||||
// ],
|
||||
// ),
|
||||
// preferredSize: Size.fromHeight(80.w),
|
||||
// ),
|
||||
body: WaterfallFlow.builder(
|
||||
padding: EdgeInsets.all(32.w),
|
||||
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 20.w,
|
||||
crossAxisSpacing: 20.w,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return GoodsCard();
|
||||
},
|
||||
itemCount: 10,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue