添加公共资讯

hmxc
小赖 4 years ago
parent 43cf9c0282
commit 7f94576967

@ -19,6 +19,7 @@ class API {
static _Community community = _Community();
static _Message message = _Message();
static _Market market = _Market();
static _News news = _News();
}
class _Login {
@ -88,6 +89,14 @@ class _User {
String get carList => '/user/myCar/list';
}
class _News {
///app()
String get category => '/user/news/categoryList';
///appid
String get list => '/user/news/newsList';
}
class _Manager {
_Facility facility = _Facility();

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:aku_community/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -12,11 +11,12 @@ import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/constants/config.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/utils/message_parser.dart';
import 'package:provider/provider.dart';
class MainInitialize {
///firebase

@ -1,6 +1,8 @@
import 'package:aku_community/model/common/img_model.dart';
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart';
part 'goods_detail_model.g.dart';
@JsonSerializable()

@ -0,0 +1,16 @@
import 'package:json_annotation/json_annotation.dart';
part 'news_category_model.g.dart';
@JsonSerializable()
class NewsCategoryModel {
final int id;
final String name;
NewsCategoryModel({
required this.id,
required this.name,
});
factory NewsCategoryModel.fromJson(Map<String, dynamic> json) =>
_$NewsCategoryModelFromJson(json);
}

@ -0,0 +1,14 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'news_category_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
NewsCategoryModel _$NewsCategoryModelFromJson(Map<String, dynamic> json) {
return NewsCategoryModel(
id: json['id'] as int,
name: json['name'] as String,
);
}

@ -0,0 +1,24 @@
import 'package:flustars/flustars.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart';
part 'news_item_model.g.dart';
@JsonSerializable()
class NewsItemModel {
final int id;
final String title;
final String createDate;
final List<ImgModel> imgList;
DateTime? get create => DateUtil.getDateTime(createDate);
NewsItemModel({
required this.id,
required this.title,
required this.createDate,
required this.imgList,
});
factory NewsItemModel.fromJson(Map<String, dynamic> json) =>
_$NewsItemModelFromJson(json);
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'news_item_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
NewsItemModel _$NewsItemModelFromJson(Map<String, dynamic> json) {
return NewsItemModel(
id: json['id'] as int,
title: json['title'] as String,
createDate: json['createDate'] as String,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

@ -1,5 +1,10 @@
// Dart imports:
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/news/news_category_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -117,7 +122,19 @@ class _HomePageState extends State<HomePage>
HomeTitle(
title: '公共资讯',
suffixTitle: '更多资讯',
onTap: () => Get.to(() => PublicInfomationPage()),
onTap: () async {
final cancel = BotToast.showLoading();
BaseModel model = await NetUtil().get(API.news.category);
List<NewsCategoryModel>? category;
if (model.status == true && model.data != null) {
category = (model.data as List)
.map((e) => NewsCategoryModel.fromJson(e))
.toList();
}
cancel();
Get.to(
() => PublicInfomationPage(models: category ?? []));
},
),
HomeTitle(
title: '社区活动',

@ -306,9 +306,11 @@ class _FixedDetailPageState extends State<FixedDetailPage> {
height: double.infinity,
padding: EdgeInsets.zero,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: showProcessCard ? () async{
onPressed: showProcessCard
? () async {
await launch('tel:0574-87760023');
} : null,
}
: null,
disabledColor: kDarkSubColor.withOpacity(0.1),
disabledTextColor: ktextSubColor.withOpacity(0.3),
textColor: ktextPrimary,

@ -1,4 +1,3 @@
import 'package:aku_community/constants/api.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -9,6 +8,7 @@ import 'package:provider/provider.dart';
import 'package:share/share.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/pages/manager_func.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart';

@ -1,11 +1,11 @@
import 'package:aku_community/provider/app_provider.dart';
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:badges/badges.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:aku_community/pages/message_center_page/message_center_page.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/community/community_views/add_new_event_page.dart';
import 'package:aku_community/ui/community/community_views/my_community_view.dart';

@ -1,10 +1,15 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/news/news_item_model.dart';
import 'package:flustars/flustars.dart';
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);
final NewsItemModel model;
const PublicInfomationCard({Key? key, required this.model}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -22,7 +27,7 @@ class PublicInfomationCard extends StatelessWidget {
Expanded(
child: Column(
children: [
Text('今日快讯|日本决定将核污水拍入海中,中方对此强势喊话日本考虑需谨慎'),
Text(model.title),
Spacer(),
DefaultTextStyle(
style: TextStyle(
@ -31,9 +36,12 @@ class PublicInfomationCard extends StatelessWidget {
),
child: Row(
children: [
Text('测试'),
// Text('测试'),
Spacer(),
Text('发布于 4-11 10:11'),
Text('发布于 ${DateUtil.formatDate(
model.create,
format: 'yyyy-MM-dd HH:mm',
)}'),
],
),
),
@ -41,10 +49,12 @@ class PublicInfomationCard extends StatelessWidget {
),
),
32.wb,
SizedBox(
FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 240.w,
height: 200.w,
child: Placeholder(),
fit: BoxFit.cover,
image: API.image(ImgModel.first(model.imgList)),
),
],
),

@ -1,11 +1,16 @@
import 'package:flutter/material.dart';
import 'package:aku_community/models/news/news_category_model.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';
class PublicInfomationPage extends StatefulWidget {
PublicInfomationPage({Key? key}) : super(key: key);
final List<NewsCategoryModel> models;
PublicInfomationPage({
Key? key,
required this.models,
}) : super(key: key);
@override
_PublicInfomationPageState createState() => _PublicInfomationPageState();
@ -13,20 +18,27 @@ class PublicInfomationPage extends StatefulWidget {
class _PublicInfomationPageState extends State<PublicInfomationPage>
with TickerProviderStateMixin {
static const pubTabs = <String>['全部', '政务', '生活', '医疗', '教育'];
TabController? _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: pubTabs.length, vsync: this);
_tabController = TabController(length: widget.models.length, vsync: this);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '公共资讯',
appBarBottom: BeeTabBar(controller: _tabController, tabs: pubTabs),
body: PublicInfomationView(),
appBarBottom: BeeTabBar(
controller: _tabController,
tabs: widget.models.map((e) => e.name).toList(),
scrollable: true,
),
body: TabBarView(
children:
widget.models.map((e) => PublicInfomationView(model: e)).toList(),
controller: _tabController,
),
);
}
}

@ -1,25 +1,45 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/news/news_category_model.dart';
import 'package:aku_community/models/news/news_item_model.dart';
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/ui/home/public_infomation/public_infomation_card.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class PublicInfomationView extends StatefulWidget {
PublicInfomationView({Key? key}) : super(key: key);
final NewsCategoryModel model;
PublicInfomationView({Key? key, required this.model}) : super(key: key);
@override
_PublicInfomationViewState createState() => _PublicInfomationViewState();
}
class _PublicInfomationViewState extends State<PublicInfomationView> {
class _PublicInfomationViewState extends State<PublicInfomationView>
with AutomaticKeepAliveClientMixin {
EasyRefreshController _refreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
super.build(context);
return BeeListView(
path: API.news.list,
controller: _refreshController,
convert: (model) =>
model.tableList!.map((e) => NewsItemModel.fromJson(e)).toList(),
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 24.w),
itemBuilder: (context, index) {
return PublicInfomationCard();
return PublicInfomationCard(model: items[index]);
},
separatorBuilder: (_, __) => 24.hb,
itemCount: 100,
itemCount: items.length,
);
},
);
}
@override
bool get wantKeepAlive => true;
}

@ -1,9 +1,9 @@
import 'package:aku_community/models/market/goods_item.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:aku_community/base/base_style.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';

@ -1,4 +1,16 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/goods_detail_model.dart';
@ -9,18 +21,7 @@ import 'package:aku_community/ui/market/search/search_goods_page.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_back_button.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:aku_community/const/resource.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
///
class GoodsDetailPage extends StatefulWidget {

@ -1,4 +1,3 @@
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
@ -8,6 +7,7 @@ import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.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';
class GoodsTabListView extends StatefulWidget {

@ -1,25 +1,28 @@
// 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/ui/market/goods/goods_card.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.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:bot_toast/bot_toast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/display_category_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/market_category_model.dart';
import 'package:aku_community/ui/market/category/category_card.dart';
import 'package:aku_community/ui/market/category/category_page.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/utils/headers.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_scaffold.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
// import 'package:aku_community/ui/market/goods/goods_detail_page.dart';
// import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
class MarketPage extends StatefulWidget {

@ -1,13 +1,13 @@
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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/easy_refresh.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';

Loading…
Cancel
Save