# Conflicts:
#	lib/pages/express_packages/express_package_card.dart
hmxc
张萌 4 years ago
commit a04c47bd36

@ -18,6 +18,7 @@ class API {
static _Upload upload = _Upload();
static _Community community = _Community();
static _Message message = _Message();
static _Market market = _Market();
}
class _Login {
@ -255,6 +256,10 @@ class _Community {
String get signUpActivity => '/user/activity/signUp';
}
class _Market {
String get category => '/user/shop/findAllCategory';
}
class _Upload {
///
String get uploadAdvice => '/user/upload/uploadAdvice';
@ -308,4 +313,8 @@ class _Facility {
///使
String get stop => '/user/facilitiesAppointment/useStop';
///id
String get detailType =>
'/user/facilitiesAppointment/findFacilitiesByCategoryId';
}

@ -1,11 +1,11 @@
// import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/pages/express_packages/express_package_page.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/pages/convenient_phone/convenient_phone_page.dart';
import 'package:aku_community/pages/event_activity/event_voting_page.dart';
import 'package:aku_community/pages/express_packages/express_package_page.dart';
import 'package:aku_community/pages/goods_deto_page/goods_deto_page.dart';
import 'package:aku_community/pages/goods_manage_page/select_borrow_return_page.dart';
import 'package:aku_community/pages/industry_committee/industry_committee_page.dart';

@ -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(),
);
}

@ -1,10 +1,12 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
import 'package:aku_community/widget/bee_divider.dart';
class ExpressPackageCard extends StatefulWidget {
final int index;
@ -94,7 +96,27 @@ class _ExpressPackageCardState extends State<ExpressPackageCard> {
)
],
),
]
],
40.w.heightBox,
Row(
children: [
Spacer(),
MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(74.w)),
padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w),
height: 50.w,
color: kPrimaryColor,
elevation: 0,
focusElevation: 0,
hoverElevation: 0,
disabledElevation: 0,
highlightElevation: 0,
onPressed: () {},
child: '确认领取'.text.size(24.sp).bold.color(ktextPrimary).make(),
)
],
),
],
),
);

@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:aku_community/pages/express_packages/express_package_view.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
import 'package:flutter/material.dart';
class ExpressPackagePage extends StatefulWidget {
ExpressPackagePage({Key? key}) : super(key: key);
@ -26,10 +27,9 @@ class _ExpressPackagePageState extends State<ExpressPackagePage>
title: '快递包裹',
appBarBottom: BeeTabBar(controller: _tabController, tabs: _tabs),
body: TabBarView(
controller: _tabController,
children:List.generate(_tabs.length, (index) => ExpressPackageView(index:index)) ),
controller: _tabController,
children: List.generate(
_tabs.length, (index) => ExpressPackageView(index: index))),
);
}
}

@ -1,7 +1,9 @@
import 'package:aku_community/pages/express_packages/express_package_card.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community/pages/express_packages/express_package_card.dart';
class ExpressPackageView extends StatefulWidget {
final int index;
ExpressPackageView({Key? key, required this.index}) : super(key: key);
@ -14,7 +16,7 @@ class _ExpressPackageViewState extends State<ExpressPackageView> {
@override
Widget build(BuildContext context) {
return ListView(
padding: EdgeInsets.symmetric(vertical: 16.w,horizontal: 32.w),
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
children: [ExpressPackageCard(index: widget.index)],
);
}

@ -389,8 +389,6 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
bool _canSubmit(int? weight, int approach, DateTime? dateTime, String? item) {
if (weight == null) {
return false;
} else if (approach == null) {
return false;
} else if (dateTime == null) {
return false;
} else if (item.isEmptyOrNull) {

@ -19,9 +19,9 @@ import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/activity/activity_card.dart';
import 'package:aku_community/ui/community/activity/activity_list_page.dart';
import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/community/public_infomation_page.dart';
import 'package:aku_community/ui/home/home_notification.dart';
import 'package:aku_community/ui/home/home_title.dart';
import 'package:aku_community/ui/home/public_infomation/public_infomation_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/login_util.dart';
import 'package:aku_community/widget/buttons/column_action_button.dart';

@ -2,14 +2,12 @@ import 'package:flutter/material.dart';
import 'package:flustars/flustars.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/pages/sign/sign_func.dart';
import 'package:aku_community/pages/sign/sign_up/sign_up_common_widget.dart';
import 'package:aku_community/pages/tab_navigator.dart';
import 'package:aku_community/provider/sign_up_provider.dart';
import 'package:aku_community/utils/headers.dart';
class SignUpVerifyPage extends StatefulWidget {
@ -79,9 +77,6 @@ class _SignUpVerifyPageState extends State<SignUpVerifyPage> {
disabledColor: kPrimaryColor.withOpacity(0.3),
child: '登录'.text.bold.make(),
onPressed: () async {
final signUpProvider =
Provider.of<SignUpProvider>(context, listen: false);
if (_formKey.currentState!.validate()) {
bool result = await SignFunc.signUp();
if (result) Get.offAll(() => TabNavigator());

@ -37,21 +37,19 @@ class ActivityCard extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ImgModel.first(model!.imgUrls) == null
? SizedBox()
: Hero(
tag: ImgModel.first(model!.imgUrls),
child: Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(model!.imgUrls)),
height: 210.w,
width: double.infinity,
fit: BoxFit.cover,
),
),
),
Hero(
tag: ImgModel.first(model!.imgUrls),
child: Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(model!.imgUrls)),
height: 210.w,
width: double.infinity,
fit: BoxFit.cover,
),
),
),
model!.title!.text
.size(28.sp)
.black

@ -41,7 +41,7 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
heroTag: 'event_add',
onPressed: () async {
if (LoginUtil.isNotLogin) return;
bool? result = await Get.to(() => AddNewEventPage.topic(
await Get.to(() => AddNewEventPage.topic(
topicName: widget.model!.summary,
initTopic: widget.model!.id,
));

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:aku_community/ui/community/facility/facility_appointment_view.dart';
import 'package:aku_community/ui/community/facility/facility_preview_page.dart';
import 'package:aku_community/ui/community/facility/pick_facility_page.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
@ -38,7 +38,7 @@ class _FacilityAppointmentPageState extends State<FacilityAppointmentPage>
actions: [
IconButton(
icon: Icon(CupertinoIcons.add_circled),
onPressed: () => Get.to(() => FacilityPreorderPage()),
onPressed: () => Get.to(() => PickFacilityPage()),
),
],
appBarBottom: BeeTabBar(

@ -9,9 +9,9 @@ import 'package:provider/provider.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/models/facility/facility_type_model.dart';
import 'package:aku_community/models/facility/facility_type_detail_model.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/facility/pick_facility_page.dart';
import 'package:aku_community/ui/community/facility/facility_type_detail_page.dart';
import 'package:aku_community/ui/profile/house/pick_my_house_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/network/net_util.dart';
@ -21,14 +21,15 @@ import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:aku_community/widget/picker/bee_date_picker.dart';
class FacilityPreorderPage extends StatefulWidget {
FacilityPreorderPage({Key? key}) : super(key: key);
final int id;
FacilityPreorderPage({Key? key, required this.id}) : super(key: key);
@override
_FacilityPreorderPageState createState() => _FacilityPreorderPageState();
}
class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
FacilityTypeModel? typeModel;
FacilityTypeDetailModel? typeModel;
DateTime? startDate;
DateTime? endDate;
@ -68,7 +69,8 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
width: 60.w,
),
onTap: () async {
FacilityTypeModel? model = await Get.to(() => PickFacilityPage());
FacilityTypeDetailModel? model = await Get.to(() =>
FacilityTypeDetailPage(model: typeModel, id: widget.id));
if (model != null) typeModel = model;
setState(() {});
},

@ -6,6 +6,7 @@ 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/facility/facility_type_model.dart';
import 'package:aku_community/ui/community/facility/facility_preorder_page.dart';
import 'package:aku_community/utils/headers.dart';
class FacilityTypeCard extends StatelessWidget {
@ -74,7 +75,9 @@ class FacilityTypeCard extends StatelessWidget {
24.hb,
],
),
onPressed: () => Get.back(result: model),
onPressed: () {
Get.off(() => FacilityPreorderPage(id: model.id));
},
);
}
}

@ -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(),
),
],
),
),
);
}
}

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:aku_community/ui/home/public_infomation/public_infomation_view.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
@ -25,6 +26,7 @@ class _PublicInfomationPageState extends State<PublicInfomationPage>
return BeeScaffold(
title: '公共资讯',
appBarBottom: BeeTabBar(controller: _tabController, tabs: pubTabs),
body: PublicInfomationView(),
);
}
}

@ -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,
);
}
}

@ -41,24 +41,18 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
switch (widget.type) {
case AdviceType.SUGGESTION:
return '建议咨询';
break;
case AdviceType.COMPLAIN:
return '投诉表扬';
break;
}
return '';
}
List<String> get tabs {
switch (widget.type) {
case AdviceType.SUGGESTION:
return ['您的建议', '您的咨询'];
break;
case AdviceType.COMPLAIN:
return ['您的投诉', '您的表扬'];
break;
}
return [];
}
_buildType(int index, String asset, String title) {

@ -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(),
);
},
);
}
}

@ -1,18 +1,37 @@
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/ui/market/category/category_sub_view.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:get/get.dart';
class CategoryPage extends StatefulWidget {
CategoryPage({Key? key}) : super(key: key);
final List<MarketCategoryModel> models;
CategoryPage({Key? key, required this.models}) : super(key: key);
@override
_CategoryPageState createState() => _CategoryPageState();
}
class _CategoryPageState extends State<CategoryPage> {
class _CategoryPageState extends State<CategoryPage>
with TickerProviderStateMixin {
int _index = 0;
late TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: widget.models.length, vsync: this);
}
@override
void dispose() {
_tabController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
@ -21,7 +40,9 @@ class _CategoryPageState extends State<CategoryPage> {
actions: [
IconButton(
icon: Icon(CupertinoIcons.search),
onPressed: () {},
onPressed: () {
Get.to(() => SearchGoodsPage());
},
),
],
bgColor: Colors.white,
@ -34,8 +55,10 @@ class _CategoryPageState extends State<CategoryPage> {
SizedBox(
width: 203.w,
child: ListView.builder(
physics: ClampingScrollPhysics(),
itemBuilder: (context, index) {
bool sameIndex = index == _index;
final item = widget.models[index];
return Stack(
children: [
MaterialButton(
@ -43,18 +66,32 @@ class _CategoryPageState extends State<CategoryPage> {
minWidth: double.infinity,
onPressed: () {
_index = index;
_tabController.animateTo(index);
setState(() {});
},
child: Text(
'TEST',
style: TextStyle(),
item.name,
style: TextStyle(
color: sameIndex ? kPrimaryColor : ktextPrimary,
),
),
),
AnimatedPositioned(
left: sameIndex ? 0 : -8.w,
top: sameIndex ? 20.w : 30.w,
bottom: sameIndex ? 20.w : 30.w,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
child: Container(
color: kPrimaryColor,
width: 8.w,
height: 40.w,
),
),
],
);
},
itemCount: 10,
itemCount: widget.models.length,
),
),
VerticalDivider(
@ -62,6 +99,12 @@ class _CategoryPageState extends State<CategoryPage> {
width: 1,
thickness: 1,
),
TabBarView(
controller: _tabController,
physics: NeverScrollableScrollPhysics(),
children:
widget.models.map((e) => CategorySubView(id: e.id)).toList(),
).expand(),
],
),
);

@ -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,
),
);
}
}

@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
import 'package:aku_community/utils/headers.dart';
class GoodsCard extends StatelessWidget {
@ -12,7 +15,7 @@ class GoodsCard extends StatelessWidget {
color: Colors.white,
elevation: 0,
padding: EdgeInsets.zero,
onPressed: () {},
onPressed: () => Get.to(() => GoodsDetailPage()),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [

@ -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();
}
}

@ -1,3 +1,8 @@
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_card.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -5,6 +10,7 @@ import 'package:get/get.dart';
import 'package:aku_community/ui/market/_market_data.dart';
import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
@ -19,10 +25,15 @@ class MarketPage extends StatefulWidget {
class _MarketPageState extends State<MarketPage>
with AutomaticKeepAliveClientMixin, TickerProviderStateMixin {
late TabController _tabController;
List<MarketCategoryModel> _marketModels = [];
@override
void initState() {
super.initState();
_tabController = TabController(length: 2, vsync: this);
DisplayCategoryModel.top8.then((value) {
_marketModels = value;
setState(() {});
});
}
@override
@ -30,12 +41,24 @@ class _MarketPageState extends State<MarketPage>
super.build(context);
final mediaWidth = MediaQuery.of(context).size.width;
return BeeScaffold(
leading: IconButton(
icon: Icon(CupertinoIcons.search),
onPressed: () {
Get.to(() => SearchGoodsPage());
},
),
title: '商城',
actions: [
MaterialButton(
minWidth: 108.w,
padding: EdgeInsets.zero,
onPressed: () => Get.to(() => CategoryPage()),
onPressed: () async {
final cancel = BotToast.showLoading();
List<MarketCategoryModel> models =
await DisplayCategoryModel.fetchCategory(0);
cancel();
Get.to(() => CategoryPage(models: models));
},
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
@ -80,8 +103,8 @@ class _MarketPageState extends State<MarketPage>
childAspectRatio: 1,
),
shrinkWrap: true,
children: mockableMarketData
.map((e) => MockableMarketWidget(data: e))
children: _marketModels
.map((e) => CategoryCard(model: e))
.toList(),
),
),

@ -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,
),
);
}
}

@ -22,7 +22,6 @@ class BeeParse {
switch (dif) {
case -1:
return '去年';
break;
case 0:
return '今年';
case 1:

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:aku_community/utils/developer_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:flustars/flustars.dart';
@ -139,7 +140,10 @@ class NetUtil {
_parseErr(DioError err) {
LoggerData.addData(err);
_makeToast(String message) {
BotToast.showText(text: '$message\_${err.response?.statusCode ?? ''}');
if (DeveloperUtil.dev)
BotToast.showText(text: '$message\_${err.response?.statusCode ?? ''}');
else
BotToast.showText(text: '网络出现问题');
}
switch (err.type) {

@ -5,7 +5,7 @@ import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/widget/bee_back_button.dart';
class BeeScaffold extends StatelessWidget {
final String? title;
final dynamic? title;
final Widget? body;
/// appbar background color

@ -18,8 +18,7 @@ class ApplicationView extends StatefulWidget {
ApplicationView.custom(
{Key? key, required List<AO> this.items, this.needAllApp = true})
: assert(items != null),
super(key: key);
: super(key: key);
@override
_ApplicationViewState createState() => _ApplicationViewState();

@ -302,6 +302,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
equatable:
dependency: "direct main"
description:
name: equatable
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
extended_list_library:
dependency: transitive
description:

@ -68,6 +68,7 @@ dependencies:
json_annotation: ^4.0.1
waterfall_flow: ^3.0.1
qr_code_scanner: ^0.4.0
equatable: ^2.0.0
dev_dependencies:
flutter_test:

@ -33,3 +33,11 @@ void gitPush() {
arguments: ['push'],
);
}
@Task('build runner')
void gen() async {
await Pub.runAsync(
'build_runner',
arguments: ['build'],
);
}

Loading…
Cancel
Save