对接活动、公告模块

pull/1/head
张萌 3 years ago
parent 5e9db879a5
commit b013c55984

@ -28,6 +28,10 @@ class SARSAPI {
static _Message message = _Message();
static _Community community = _Community();
static _Task task = _Task();
static _HomeCarouse homeCarouse = _HomeCarouse();
static _Activity activity = _Activity();
static _Announce announce = _Announce();
static _Information information = _Information();
///
static _ProfileApi profile = _ProfileApi();
@ -169,3 +173,38 @@ class _Task {
///
String get list => '/app/user/taskRelease/list';
}
class _HomeCarouse {
///
String get list => '/app/user/homepageCarousel/list';
}
class _Activity {
///
String get detail => '/app/user/activity/findById';
///
String get registration => '/app/user/activity/registration';
///
String get list => '/app/user/activity/list';
}
class _Announce {
///
String get list => '/app/user/announcement/list';
///
String get detail => '/app/user/announcement/detail';
}
class _Information {
///app
String get recommendList => '/app/user/information/recommendList';
///app
String get list => '/app/user/information/list';
///app
String get categoryList => '/app/user/information/categoryList';
}

@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
@Deprecated('弃用')
class ActivityItemModel {
int? id;
String? title;

@ -1,5 +1,6 @@
import 'package:aku_new_community/model/common/img_model.dart';
@Deprecated('弃用')
class SwiperModel {
int? newsId;
String? title;

@ -0,0 +1,75 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
part 'activity_detail_model.g.dart';
@JsonSerializable()
class ActivityDetailModel {
final int id;
final List<ImgModel> imgList;
final String title;
final int status;
final String registrationStartTime;
final String registrationEndTime;
final String activityStartTime;
final String activityEndTime;
final String activityAddress;
final List<Registration> registrationList;
final int registrationNum;
final int registrationNumMax;
final double registrationCost;
final String activityContact;
final String activityTel;
final String content;
final String unit;
final String contact;
final String tel;
final List<ImgModel> organizerImgList;
factory ActivityDetailModel.fromJson(Map<String, dynamic> json) =>
_$ActivityDetailModelFromJson(json);
DateTime? get regisStartTime => DateUtil.getDateTime(registrationStartTime);
DateTime? get regisEndTime => DateUtil.getDateTime(registrationEndTime);
DateTime? get activeTime => DateUtil.getDateTime(activityStartTime);
DateTime? get activeEndTime => DateUtil.getDateTime(activityEndTime);
const ActivityDetailModel({
required this.id,
required this.imgList,
required this.title,
required this.status,
required this.registrationStartTime,
required this.registrationEndTime,
required this.activityStartTime,
required this.activityEndTime,
required this.activityAddress,
required this.registrationList,
required this.registrationNum,
required this.registrationNumMax,
required this.registrationCost,
required this.activityContact,
required this.activityTel,
required this.content,
required this.unit,
required this.contact,
required this.tel,
required this.organizerImgList,
});
}
@JsonSerializable()
class Registration {
final int id;
final String name;
final List<ImgModel> avatarImgList;
factory Registration.fromJson(Map<String, dynamic> json) =>
_$RegistrationFromJson(json);
const Registration({
required this.id,
required this.name,
required this.avatarImgList,
});
}

@ -0,0 +1,45 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'activity_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ActivityDetailModel _$ActivityDetailModelFromJson(Map<String, dynamic> json) =>
ActivityDetailModel(
id: json['id'] as int,
imgList: (json['imgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
title: json['title'] as String,
status: json['status'] as int,
registrationStartTime: json['registrationStartTime'] as String,
registrationEndTime: json['registrationEndTime'] as String,
activityStartTime: json['activityStartTime'] as String,
activityEndTime: json['activityEndTime'] as String,
activityAddress: json['activityAddress'] as String,
registrationList: (json['registrationList'] as List<dynamic>)
.map((e) => Registration.fromJson(e as Map<String, dynamic>))
.toList(),
registrationNum: json['registrationNum'] as int,
registrationNumMax: json['registrationNumMax'] as int,
registrationCost: (json['registrationCost'] as num).toDouble(),
activityContact: json['activityContact'] as String,
activityTel: json['activityTel'] as String,
content: json['content'] as String,
unit: json['unit'] as String,
contact: json['contact'] as String,
tel: json['tel'] as String,
organizerImgList: (json['organizerImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);
Registration _$RegistrationFromJson(Map<String, dynamic> json) => Registration(
id: json['id'] as int,
name: json['name'] as String,
avatarImgList: (json['avatarImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -0,0 +1,34 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'announce_detail_model.g.dart';
@JsonSerializable()
class AnnounceDetailModel {
final int id;
final String title;
final int object;
final int status;
final String content;
final int readingVolume;
final int downloadNum;
final String modifyDate;
final List<ImgModel> coverImgList;
final List<ImgModel> annexImgList;
factory AnnounceDetailModel.fromJson(Map<String, dynamic> json) =>
_$AnnounceDetailModelFromJson(json);
const AnnounceDetailModel({
required this.id,
required this.title,
required this.object,
required this.status,
required this.content,
required this.readingVolume,
required this.downloadNum,
required this.modifyDate,
required this.coverImgList,
required this.annexImgList,
});
}

@ -0,0 +1,25 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'announce_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
AnnounceDetailModel _$AnnounceDetailModelFromJson(Map<String, dynamic> json) =>
AnnounceDetailModel(
id: json['id'] as int,
title: json['title'] as String,
object: json['object'] as int,
status: json['status'] as int,
content: json['content'] as String,
readingVolume: json['readingVolume'] as int,
downloadNum: json['downloadNum'] as int,
modifyDate: json['modifyDate'] as String,
coverImgList: (json['coverImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
annexImgList: (json['annexImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -0,0 +1,67 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
part 'home_activity_model.g.dart';
@JsonSerializable()
class HomeActivityModel {
final int id;
final String title;
final int status;
final String registrationStartTime;
final String registrationEndTime;
final String activityStartTime;
final String activityEndTime;
final List<ImgModel>? imgList;
final int? registrationNum;
factory HomeActivityModel.fromJson(Map<String, dynamic> json) =>
_$HomeActivityModelFromJson(json);
DateTime? get begin => DateUtil.getDateTime(registrationStartTime);
DateTime? get end => DateUtil.getDateTime(registrationEndTime);
String get statusString {
switch (this.status) {
case 1:
return '未开始';
case 2:
return '进行中';
case 3:
return '已结束';
case 4:
return '已投票';
default:
return '未知';
}
}
Color get statusColor {
switch (this.status) {
case 1:
return kPrimaryColor;
case 2:
return Colors.black;
case 3:
return ktextSubColor;
case 4:
return ktextSubColor;
default:
return Colors.red;
}
}
const HomeActivityModel({
required this.id,
required this.title,
required this.status,
required this.registrationStartTime,
required this.registrationEndTime,
required this.activityStartTime,
required this.activityEndTime,
this.imgList,
this.registrationNum,
});
}

@ -0,0 +1,22 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'home_activity_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
HomeActivityModel _$HomeActivityModelFromJson(Map<String, dynamic> json) =>
HomeActivityModel(
id: json['id'] as int,
title: json['title'] as String,
status: json['status'] as int,
registrationStartTime: json['registrationStartTime'] as String,
registrationEndTime: json['registrationEndTime'] as String,
activityStartTime: json['activityStartTime'] as String,
activityEndTime: json['activityEndTime'] as String,
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
registrationNum: json['registrationNum'] as int?,
);

@ -0,0 +1,24 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
import 'package:json_annotation/json_annotation.dart';
part 'home_announce_model.g.dart';
@JsonSerializable()
class HomeAnnounceModel {
final int id;
final String title;
final String content;
final List<ImgModel> imgList;
final String createDate;
factory HomeAnnounceModel.fromJson(Map<String, dynamic> json) =>
_$HomeAnnounceModelFromJson(json);
DateTime? get createDateString => DateUtil.getDateTime(createDate);
const HomeAnnounceModel({
required this.id,
required this.title,
required this.content,
required this.imgList,
required this.createDate,
});
}

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

@ -0,0 +1,23 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:json_annotation/json_annotation.dart';
part 'home_swiper_model.g.dart';
@JsonSerializable()
class HomeSwiperModel {
final int id;
final int type;
final String? customizeUrl;
final int? associationId;
final List<ImgModel>? imgList;
factory HomeSwiperModel.fromJson(Map<String, dynamic> json) =>
_$HomeSwiperModelFromJson(json);
const HomeSwiperModel({
required this.id,
required this.type,
this.customizeUrl,
this.associationId,
this.imgList,
});
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'home_swiper_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
HomeSwiperModel _$HomeSwiperModelFromJson(Map<String, dynamic> json) =>
HomeSwiperModel(
id: json['id'] as int,
type: json['type'] as int,
customizeUrl: json['customizeUrl'] as String?,
associationId: json['associationId'] as int?,
imgList: (json['imgList'] as List<dynamic>?)
?.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
);

@ -1,26 +1,12 @@
// Dart imports:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:badges/badges.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:palette_generator/palette_generator.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:aku_new_community/constants/application_objects.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/extensions/color_ext.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/model/community/swiper_model.dart';
import 'package:aku_new_community/models/home/home_activity_model.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/models/home/home_swiper_model.dart';
import 'package:aku_new_community/pages/message_center_page/message_center_page.dart';
import 'package:aku_new_community/pages/one_alarm/widget/alarm_page.dart';
import 'package:aku_new_community/pages/visitor_access_page/visitor_access_page.dart';
@ -30,14 +16,28 @@ import 'package:aku_new_community/ui/community/activity/activity_list_page.dart'
import 'package:aku_new_community/ui/community/community_func.dart';
import 'package:aku_new_community/ui/home/home_notification.dart';
import 'package:aku_new_community/ui/home/home_title.dart';
import 'package:aku_new_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_new_community/ui/manager/advice/advice_page.dart';
import 'package:aku_new_community/ui/market/search/good_detail_page.dart';
import 'package:aku_new_community/ui/search/bee_search.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/login_util.dart';
import 'package:aku_new_community/widget/animated/OverlayWidget.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/others/rectIndicator.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:badges/badges.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:palette_generator/palette_generator.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key);
@ -64,9 +64,9 @@ class _HomePageState extends State<HomePage>
int _currentSwiperIndex = 0;
// ActivityItemModel? _activityItemModel;
List<ActivityItemModel> _activityItemModels = [];
List<BoardItemModel> _boardItemModels = [];
List<SwiperModel> _swiperModels = [];
List<HomeActivityModel> _activityItemModels = [];
List<HomeAnnounceModel> _boardItemModels = [];
List<HomeSwiperModel> _swiperModels = [];
SwiperController _swiperController = SwiperController();
ValueNotifier<Color> _barColor = ValueNotifier(Colors.transparent);
@ -200,7 +200,6 @@ class _HomePageState extends State<HomePage>
header: BeeBallPauseHeader(bgColor: _barColor),
firstRefresh: true,
onRefresh: () async {
//_activityItemModel = await CommunityFunc.activity();
_activityItemModels = await CommunityFunc.activityList();
_boardItemModels = await CommunityFunc.board();
_swiperModels = await CommunityFunc.swiper();
@ -214,6 +213,7 @@ class _HomePageState extends State<HomePage>
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
head,
HomeSwiper(), //
// SizedBox(height: 100.w),
Container(
@ -434,7 +434,7 @@ class _HomePageState extends State<HomePage>
_activityItemModels == []
? SizedBox()
: Container(
height: 400.w,
height: 480.w,
padding: EdgeInsets.only(left: 32.w),
child: ListView.separated(
padding: EdgeInsets.zero,
@ -513,8 +513,7 @@ class _HomePageState extends State<HomePage>
// control: new SwiperControl(),
autoplay: true,
onTap: (index) {
Get.to(() =>
PublicInformationDetailPage(id: _swiperModels[index].newsId!));
swiperNavigate(_swiperModels[index]);
},
itemCount: _swiperModels.length,
),
@ -522,11 +521,31 @@ class _HomePageState extends State<HomePage>
);
}
void swiperNavigate(HomeSwiperModel model) {
switch (model.type) {
case 1:
launch(model.customizeUrl ?? '');
break;
case 2:
Get.to(GoodDetailPage(goodId: model.id));
break;
case 3:
// Get.to(page)
break;
case 4:
break;
case 5:
break;
default:
BotToast.showText(text: '类型错误');
}
}
Future _swiperBarColor(int index) async {
if (_swiperModels.isNotEmpty) {
var color =
await PaletteGenerator.fromImageProvider(CachedNetworkImageProvider(
SARSAPI.image(ImgModel.first(_swiperModels[index].voResourcesImgList)),
SARSAPI.image(ImgModel.first(_swiperModels[index].imgList)),
));
_barColor.value = color.dominantColor?.color ?? Colors.transparent;
} else {
@ -534,18 +553,10 @@ class _HomePageState extends State<HomePage>
}
}
Widget getSwiperImage(SwiperModel swiperModel) {
Widget getSwiperImage(HomeSwiperModel swiperModel) {
return Container(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(swiperModel.voResourcesImgList)),
fit: BoxFit.fill,
imageErrorBuilder: (context, error, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
fit: BoxFit.fill,
);
},
child: BeeImageNetwork(
imgs: swiperModel.imgList ?? [],
),
);
}

@ -1,126 +0,0 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/application_objects.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/ui/community/notice/notice_card.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_list_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/views/application_box.dart';
import 'package:aku_new_community/widget/views/application_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'widget/property_card.dart';
//TODO CLEAN BOTTOM CODES.
@Deprecated("sh*t property_index need to be cleaned.")
class PropertyIndex extends StatefulWidget {
PropertyIndex({Key? key}) : super(key: key);
@override
_PropertyIndexState createState() => _PropertyIndexState();
}
//TODO CLEAN BOTTOM CODES.
@Deprecated("sh*t property_index need to be cleaned.")
class _PropertyIndexState extends State<PropertyIndex>
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
@override
bool get wantKeepAlive => true;
EasyRefreshController _refreshController = EasyRefreshController();
int _page = 1;
int? _pageCount = 0;
List<BoardItemModel> _models = [];
Future<List<BoardItemModel>> _getItems() async {
BaseListModel model = await NetUtil().getList(
API.community.boardList,
params: {
'pageNum': _page,
'size': 10,
},
);
_pageCount = model.total;
return model.rows.map((e) => BoardItemModel.fromJson(e)).toList();
}
@override
void dispose() {
super.dispose();
_refreshController.dispose();
}
@override
Widget build(BuildContext context) {
super.build(context);
return BeeScaffold(
title: '物业',
body: EasyRefresh(
controller: _refreshController,
firstRefresh: true,
header: MaterialHeader(),
footer: MaterialFooter(),
onRefresh: () async {
_page = 1;
_models = await _getItems();
setState(() {});
},
onLoad: () async {
_page++;
_models.addAll(await _getItems());
if (_page >= _pageCount!) _refreshController.finishLoad(noMore: true);
setState(() {});
},
child: CustomScrollView(
slivers: [
SliverToBoxAdapter(
child: ApplicationBox(
child: ApplicationView.custom(items: smartManagerApp),
),
),
SliverToBoxAdapter(
child: PropertyCard(),
),
// PropertyBar(
// title: '社区活动',
// subtitle: '精彩往期',
// more: '更多活动',
// fun: activityRouter,
// ),
// SliverToBoxAdapter(
// child: PropertyActivityCard(fun: activityDetailsRouter),
// ),
// PropertyBar(
// title: '社区公告',
// subtitle: '看看小区最近发生什么?',
// ),
SliverToBoxAdapter(
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) => SizedBox(),
itemCount: 3,
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
final BoardItemModel model = _models[index];
BoardItemModel? preModel;
if (index >= 1) preModel = _models[index - 1];
return Padding(
padding: EdgeInsets.only(bottom: 8.w),
child: NoticeCard(model: model, preModel: preModel),
);
},
childCount: _models.length,
)),
],
),
),
);
}
}

@ -1,180 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:aku_new_community/utils/headers.dart';
class PropertyCard extends StatelessWidget {
PropertyCard({Key? key}) : super(key: key);
final List<Map<String, dynamic>> _listCard = [
{
'title': '电话物业',
'subtitle': '24小时在线',
'image': R.ASSETS_ICONS_PROPERTY_PNG,
'coloList': [Color(0xff42ceff), Color(0xff198cfb)],
'shapeColoList': [Color(0xff42ceff), Color(0xff0b69c4)]
}
];
Future<void> _phoneCall(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
void _showDialog(BuildContext context, String url) {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text(
url,
style: TextStyle(
fontSize: 34.sp,
color: Color(0xff030303),
),
),
actions: <Widget>[
CupertinoDialogAction(
child: Text(
'取消',
style: TextStyle(
fontSize: 34.sp,
color: Color(0xff333333),
),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text(
'呼叫',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 34.sp,
color: Color(0xffff8200),
),
),
onPressed: () {
_phoneCall('tel:$url');
Get.back();
},
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 32.w,
vertical: 20.w,
),
child: GridView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: _listCard.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
switch (_listCard[index]['title']) {
case '电话物业':
_showDialog(context, '0574-87760023');
break;
case '语音管家':
break;
default:
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 19.w,
vertical: 36.w,
),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: _listCard[index]['coloList'],
),
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1.1, 1.1),
blurRadius: 10.0),
],
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
alignment: Alignment.center,
height: 88.w,
width: 88.w,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: _listCard[index]['shapeColoList'],
),
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.grey.withOpacity(0.2),
offset: Offset(1.1, 1.1),
blurRadius: 10.0),
],
),
child: Image.asset(
_listCard[index]['image'],
fit: BoxFit.fill,
height: 64.w,
width: 77.w,
),
),
SizedBox(width: 24.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 5.w),
Text(
_listCard[index]['title'],
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 32.sp,
color: Color(0xffffffff),
),
),
SizedBox(height: 4.w),
Text(
_listCard[index]['subtitle'],
style: TextStyle(
fontSize: 20.sp,
color: Color(0xffffffff),
),
),
],
),
],
),
),
);
},
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
crossAxisSpacing: 40.w,
childAspectRatio: 600.w / 160.w),
),
);
}
}

@ -1,25 +1,18 @@
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:provider/provider.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/user/province_model.dart';
import 'package:aku_new_community/pages/property/property_page.dart';
import 'package:aku_new_community/pages/sign/login/login_page.dart';
import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/ui/community/community_views/community_page.dart';
import 'package:aku_new_community/ui/market/market_page.dart';
import 'package:aku_new_community/utils/hive_store.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'home/home_page.dart';
import 'personal/personal_page.dart';
@ -50,25 +43,11 @@ class _TabNavigatorState extends State<TabNavigator>
final appProvider = Provider.of<AppProvider>(Get.context!);
Future.delayed(Duration(milliseconds: 0), () async {
await appProvider.getMyAddress(); //
List<ProvinceModel> _province = [];
var agreement = await HiveStore.appBox?.get('cityList') ?? null;
if (agreement == null) {
///
BaseModel baseModel = await NetUtil().get(
API.user.findAllCityInfo,
);
if (baseModel.data != null) {
_province = (baseModel.data as List)
.map((e) => ProvinceModel.fromJson(e))
.toList();
HiveStore.appBox!.put('cityList', _province);
}
}
});
_pages = [
HomePage(),
MarketPage(),
PropertyPage(), //PropertyIndex(),
PropertyPage(),
CommunityPage(),
PersonalIndex()
];

@ -1,154 +1,129 @@
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/home/home_activity_model.dart';
import 'package:aku_new_community/ui/community/activity/activity_func.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'activity_detail_page_old.dart';
import 'activity_detail_page.dart';
class ActivityCard extends StatelessWidget {
final ActivityItemModel? model;
final bool? home;
final HomeActivityModel? model;
const ActivityCard({
Key? key,
required this.model,
this.home = false,
}) : super(key: key);
bool get outdate => model!.end!.compareTo(DateTime.now()) == -1;
Widget build(BuildContext context) {
return MaterialButton(
clipBehavior: Clip.antiAlias,
color: Colors.white,
padding: EdgeInsets.zero,
onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.w),
// side: BorderSide(
// color: Colors.grey,
// ),
),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Hero(
tag: ImgModel.first(model!.imgUrls),
child: Material(
color: Colors.grey,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(model!.imgUrls)),
height: 197.w,
width: double.infinity,
fit: BoxFit.cover,
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: home! ? 480.w : 540.w),
child: MaterialButton(
clipBehavior: Clip.antiAlias,
color: Colors.white,
padding: EdgeInsets.zero,
onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.w),
),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Hero(
tag: ImgModel.first(model!.imgList),
child: Material(
color: Colors.grey,
child: BeeImageNetwork(
imgs: model!.imgList ?? [],
width: double.infinity,
height: home! ? 240.w : 340.w,
),
),
),
),
Padding(
padding: EdgeInsets.only(left: 24.w, top: 24.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
constraints: BoxConstraints(maxWidth: 340.w),
child: Text(
model == null ? '' : model!.title!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xD9000000),
fontSize: 28.sp,
fontWeight: FontWeight.bold),
Padding(
padding: EdgeInsets.only(left: 24.w, top: 24.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
constraints: BoxConstraints(maxWidth: 340.w),
child: Text(
model == null ? '' : model!.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xD9000000),
fontSize: 28.sp,
fontWeight: FontWeight.bold),
),
),
),
Spacer(),
GestureDetector(
child: Container(
//color: Color(0x80FEBF76),
Spacer(),
GestureDetector(
child: Container(
//color: Color(0x80FEBF76),
// shape: StadiumBorder(),
alignment: Alignment.center,
height: 39.w,
width: 98.w,
decoration: BoxDecoration(
color: outdate
? Colors.black.withOpacity(0.06)
: Color(0x80FEBF76),
borderRadius: BorderRadius.all(Radius.circular(4)),
),
// shape: StadiumBorder(),
alignment: Alignment.center,
height: 39.w,
width: 98.w,
decoration: BoxDecoration(
color: outdate
? Colors.black.withOpacity(0.06)
: Color(0x80FEBF76),
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child: outdate
? '已结束'
.text
.size(22.sp)
.color(Colors.black.withOpacity(0.25))
.make()
: '报名中'
.text
.size(22.sp)
.color(Color(0xFFF48117))
.make(),
child: outdate
? '已结束'
.text
.size(22.sp)
.color(Colors.black.withOpacity(0.25))
.make()
: '报名中'
.text
.size(22.sp)
.color(Color(0xFFF48117))
.make(),
),
onTap: () {
outdate
? null
: () {
Get.to(() => ActivityDetailPage(id: model!.id));
};
},
),
onTap: () {
outdate
? null
: () {
Get.to(() => ActivityDetailPage(id: model!.id));
};
},
),
24.wb
],
24.wb
],
),
),
),
// [
// '地 点:'.text.size(24.sp).color(Color(0xFF999999)).make(),
// model!.location!.text.size(24.sp).make(),
// ].row().pSymmetric(h: 24.w),
20.hb,
[
'报名截止:'.text.size(22.sp).color(Color(0x73000000)).make(),
'${DateUtil.formatDate(
model!.end,
format: 'yyyy年MM月dd日 HH:mm',
)}'
.text
.size(22.sp)
.color(Color(0x73000000))
.make(),
].row().pSymmetric(h: 24.w),
// [
// // StackAvatar(
// // avatars: model!.headImgURls!.map((e) => e.url).toList()),
// Spacer(),
// MaterialButton(
// elevation: 0,
// materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// color: Color(0xFFFFC40C),
// shape: StadiumBorder(),
// height: 44.w,
// minWidth: 120.w,
// disabledColor: Color(0xFFABABAB),
// onPressed: outdate
// ? null
// : () {
// Get.to(() => ActivityDetailPage(id: model!.id));
// },
// child: outdate
// ? '已结束'.text.size(20.sp).bold.make()
// : '去看看'.text.size(20.sp).bold.make(),
// ),
// ].row().p(24.w),
],
Spacer(),
[
Flexible(
child: AvatarsParticipate(
avatars: (model?.imgList?.map((e) => e.url).toList() ?? []),
pNum: model?.registrationNum ?? 0,
hasIcon: false,
),
),
// Spacer(),
ActivityFunc.dateCheck(model!.end)
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
].row().pSymmetric(h: 24.w),
20.hb,
],
),
),
);
}

@ -1,36 +1,58 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/gen/assets.gen.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/home/activity_detail_model.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/bee_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/buttons/bottom_button.dart';
import 'package:aku_new_community/widget/others/stack_avatar.dart';
import 'package:common_utils/common_utils.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:url_launcher/url_launcher.dart';
import 'activity_func.dart';
class ActivityDetailPage extends StatefulWidget {
const ActivityDetailPage({Key? key}) : super(key: key);
final int id;
const ActivityDetailPage({Key? key, required this.id}) : super(key: key);
@override
_ActivityDetailPageState createState() => _ActivityDetailPageState();
}
class _ActivityDetailPageState extends State<ActivityDetailPage> {
final EasyRefreshController _refreshController = EasyRefreshController();
ActivityDetailModel? _model;
@override
void initState() {
_refreshController.dispose();
super.initState();
}
@override
Widget build(BuildContext context) {
var content = Container(
width: double.infinity,
padding: EdgeInsets.all(32.w),
color: Colors.white,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'活动详情'.text.size(32.sp).color(Colors.black).bold.make(),
32.w.heightBox,
''.text.size(28.sp).color(Colors.black.withOpacity(0.45)).make(),
'${_model?.content}'
.text
.size(28.sp)
.color(Colors.black.withOpacity(0.45))
.make(),
32.w.heightBox,
...List.generate(
0,
@ -40,9 +62,8 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w),
),
child: Image.network(
'',
fit: BoxFit.fill,
child: BeeImageNetwork(
urls: [ImgModel.first(_model?.imgList)],
),
)),
],
@ -50,57 +71,89 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
);
return BeeScaffold(
title: '活动详情',
body: ListView(
children: [
_headWidget(),
24.w.heightBox,
content,
24.w.heightBox,
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),
height: 132.w,
child: Row(
children: [
CircleAvatar(
child: FadeInImage.assetNetwork(
placeholder: Assets.images.placeholder.path,
image: '',
body: EasyRefresh(
header: MaterialHeader(),
controller: _refreshController,
firstRefresh: true,
onRefresh: () async {
BaseModel baseModel = await NetUtil().get(
SARSAPI.activity.detail,
params: {'activityId': widget.id},
);
_model = ActivityDetailModel.fromJson(baseModel.data);
setState(() {});
},
child: _model == null
? SizedBox()
: ListView(
children: [
_headWidget(),
24.w.heightBox,
content,
24.w.heightBox,
Container(
width: double.infinity,
color: Colors.white,
padding:
EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),
height: 132.w,
child: Row(
children: [
CircleAvatar(
child: BeeImageNetwork(
width: 100.w,
height: 100.w,
imgs: _model!.organizerImgList,
),
radius: 50.w,
),
20.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'${_model!.unit}'
.text
.size(28.sp)
.color(Colors.black)
.make(),
8.w.heightBox,
'${S.of(context)!.tempPlotName}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.25))
.make()
],
),
Spacer(),
MaterialButton(
minWidth: 120.w,
height: 60.w,
onPressed: () {
launch('tel:${_model!.tel}');
},
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.blueAccent,
),
borderRadius: BorderRadius.circular(30.w)),
child: '联系物业'
.text
.size(24.sp)
.color(Colors.blueAccent)
.make(),
),
],
),
),
),
20.w.widthBox,
Column(
children: [
'印象物业'.text.size(28.sp).color(Colors.black).make(),
8.w.heightBox,
'${S.of(context)!.tempPlotName}'
.text
.size(24.sp)
.color(Colors.black.withOpacity(0.25))
.make()
],
),
Spacer(),
MaterialButton(
minWidth: 120.w,
height: 60.w,
onPressed: () {},
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.blueAccent,
),
borderRadius: BorderRadius.circular(30.w)),
child:
'联系物业'.text.size(24.sp).color(Colors.blueAccent).make(),
),
],
),
),
],
],
),
),
bottomNavi: BottomButton(
child: '立即报名'.text.size(32.sp).color(Colors.black).bold.make(),
onPressed: () {},
onPressed: () async {
await NetUtil().post(SARSAPI.activity.registration,
params: {'activityId': _model!.id}, showMessage: true);
},
),
);
}
@ -110,16 +163,21 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
color: Colors.white,
child: Column(
children: [
Image.asset(
Assets.images.logo.path,
Container(
width: double.infinity,
height: 280.w,
child: BeeImageNetwork(
imgs: _model!.imgList,
fit: BoxFit.fitWidth,
),
),
Padding(
padding: EdgeInsets.all(32.w),
padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'人才公寓党政建设讲座系列活动——庆祝中国共产党建党71周年活动'
'${_model!.title}'
.text
.size(32.sp)
.color(Colors.black.withOpacity(0.85))
@ -127,121 +185,110 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
.bold
.make(),
32.w.heightBox,
Container(
width: 104.w,
height: 42.w,
decoration: BoxDecoration(
color: Color(0xFFFEC076).withOpacity(0.5),
borderRadius: BorderRadius.circular(10.w)),
alignment: Alignment.center,
child:
'报名中'.text.size(24.sp).color(Color(0xFFF481170)).make(),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: 104.w,
height: 42.w,
decoration: BoxDecoration(
color: Color(0xFFFEC076).withOpacity(0.5),
borderRadius: BorderRadius.circular(10.w)),
alignment: Alignment.center,
child: '${ActivityFunc.dateCheck(_model!.regisEndTime)}'
.text
.size(24.sp)
.color(Color(0xFFF481170))
.make(),
),
],
),
32.w.heightBox,
_buildTile(
'报名时间',
'${DateUtil.formatDate(
DateTime.now(),
_model!.regisStartTime,
format: 'yyyy.MM.dd HH:mm',
)}-${DateUtil.formatDate(
DateTime.now(),
_model!.regisEndTime,
format: 'yyyy.MM.dd HH:mm',
)}',
),
16.hb,
_buildTile(
'活动时间',
'${DateUtil.formatDate(
DateTime.now(),
_model!.activeTime,
format: 'yyyy.MM.dd HH:mm',
)}-${DateUtil.formatDate(
DateTime.now(),
_model!.activeEndTime,
format: 'yyyy.MM.dd HH:mm',
)}',
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
'活动方式'.text.size(28.sp).make().box.width(136.w).make(),
'本次活动介绍'
.richText
.tap(() {
var bottomSheet = Container(
width: double.infinity,
padding: EdgeInsets.all(32.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w)),
child: Column(
children: [
'活动介绍'.text.size(32.sp).black.bold.make(),
32.w.heightBox,
],
),
);
Get.bottomSheet(
bottomSheet,
);
})
.size(28.sp)
.make(),
Spacer(),
],
),
16.hb,
Row(
children: [
'活动方式'.text.size(28.sp).make().box.width(136.w).make(),
'本次活动介绍'
.richText
.tap(() {
var bottomSheet = Container(
width: double.infinity,
padding: EdgeInsets.all(32.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16.w)),
child: Column(
children: [
'活动介绍'.text.size(32.sp).black.bold.make(),
32.w.heightBox,
_model!.content.text
.size(28.sp)
.color(Colors.black.withOpacity(0.65))
.make(),
],
),
);
Get.bottomSheet(
bottomSheet,
);
})
.size(28.sp)
.color(Colors.blue)
.make(),
Spacer(),
],
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
'活动费用'.text.size(28.sp).make().box.width(136.w).make(),
'免费'.richText.size(28.sp).make(),
Spacer(),
],
),
16.hb,
Row(
children: [
'活动费用'.text.size(28.sp).make().box.width(136.w).make(),
'免费'.richText.size(28.sp).make(),
Spacer(),
],
),
32.w.heightBox,
Padding(
padding: EdgeInsets.symmetric(horizontal: 32.w),
child: Row(
children: [
'活动地点'.text.size(28.sp).make().box.width(136.w).make(),
'永恒智慧大厦'.richText.tap(() {}).size(28.sp).make(),
Spacer(),
],
),
16.w.heightBox,
Row(
children: [
'活动地点'.text.size(28.sp).make().box.width(136.w).make(),
'${_model!.activityAddress}'
.richText
.tap(() {})
.size(28.sp)
.color(Colors.blue)
.make(),
Spacer(),
],
),
32.w.heightBox,
BeeDivider.horizontal(
indent: 32.w,
endIndent: 32.w,
),
InkWell(
onTap: () {},
child: Container(
padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 16.w, bottom: 24.w),
child: Row(
children: [
StackAvatar(
avatars: [],
),
16.w.heightBox,
'200'
.richText
.withTextSpanChildren(
['/1000人参与'.textSpan.size(24.sp).black.make()])
.color(Colors.blueAccent)
.size(24.sp)
.make(),
Spacer(),
Icon(
CupertinoIcons.chevron_right,
size: 40.w,
),
],
),
),
),
BeeDivider.horizontal(),
16.hb,
AvatarsParticipate(
avatars: _model!.registrationList
.map((e) => ImgModel.first(e.avatarImgList))
.toList(),
pNum: _model!.registrationNum,
tNum: _model!.registrationNumMax),
],
),
),
@ -256,6 +303,62 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
title.text.size(28.sp).make().box.width(136.w).make(),
subTitle.text.size(28.sp).make().expand(),
],
).pSymmetric(h: 32.w);
);
}
}
class AvatarsParticipate extends StatelessWidget {
final List<String?> avatars;
//
final int pNum;
//
final int? tNum;
final bool? hasIcon;
const AvatarsParticipate({
Key? key,
required this.avatars,
required this.pNum,
this.tNum,
this.hasIcon = true,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {},
child: Container(
child: Row(
children: [
StackAvatar(
avatars: avatars,
),
16.w.heightBox,
'${pNum}'
.richText
.withTextSpanChildren([
'${tNum == null ? '' : '/${tNum}'}'
.textSpan
.size(24.sp)
.black
.make()
])
.color(Colors.blueAccent)
.size(24.sp)
.make(),
Spacer(),
!hasIcon!
? SizedBox()
: Icon(
CupertinoIcons.chevron_right,
size: 40.w,
),
],
),
),
);
}
}

@ -0,0 +1,24 @@
class ActivityFunc {
static String dateCheck(DateTime? date) {
if (date == null) {
return '';
}
var nowDate = DateTime.now();
if (date.isBefore(nowDate)) {
return '已结束';
} else {
var days = date.difference(nowDate).inDays;
if (days > 0) {
return '${days}天后结束';
} else {
var hours = date.difference(nowDate).inHours;
if (hours > 0) {
return '${hours}小时后结束';
} else {
var mins = date.difference(nowDate).inMinutes;
return '$mins分钟后结束';
}
}
}
}
}

@ -1,16 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/models/home/home_activity_model.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/community/activity/activity_card.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'activity_detail_page_old.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class ActivityListPage extends StatefulWidget {
ActivityListPage({Key? key}) : super(key: key);
@ -31,24 +26,24 @@ class _ActivityListPageState extends State<ActivityListPage> {
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '往期精彩',
title: '社区活动',
actions: [
IconButton(
onPressed: () {
Get.to(() => ActivityDetailPage(id: 0));
},
icon: Icon(Icons.delete))
// IconButton(
// onPressed: () {
// Get.to(() => ActivityDetailPage(id: 0));
// },
// icon: Icon(Icons.delete))
],
body: BeeListView<ActivityItemModel>(
body: BeeListView<HomeActivityModel>(
controller: _refreshController,
path: API.community.activityList,
path: SARSAPI.activity.list,
convert: (model) =>
model.rows.map((e) => ActivityItemModel.fromJson(e)).toList(),
model.rows.map((e) => HomeActivityModel.fromJson(e)).toList(),
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
itemBuilder: (context, index) {
final ActivityItemModel model = items[index];
final HomeActivityModel model = items[index];
return ActivityCard(model: model);
},
separatorBuilder: (_, __) => 20.hb,

@ -1,12 +1,12 @@
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/community/activity_item_model.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/model/community/hot_news_model.dart';
import 'package:aku_new_community/model/community/swiper_model.dart';
import 'package:aku_new_community/model/good/market_swiper_model.dart';
import 'package:aku_new_community/models/community/dynamic_my_list_body.dart';
import 'package:aku_new_community/models/community/topic_model.dart';
import 'package:aku_new_community/models/home/home_activity_model.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/models/home/home_swiper_model.dart';
import 'package:aku_new_community/models/market/goods_popular_model.dart';
import 'package:aku_new_community/models/market/market_all_category_model.dart';
import 'package:aku_new_community/models/market/market_category_model.dart';
@ -120,38 +120,31 @@ class CommunityFunc {
.toList();
}
static Future<ActivityItemModel?> activity() async {
static Future<List<HomeActivityModel>> activityList() async {
BaseListModel model = await NetUtil().getList(
API.community.activityList,
params: {'pageNum': 1, 'size': 5},
);
if (model.rows.length == 0) return null;
return ActivityItemModel.fromJson(model.rows.first);
}
static Future<List<ActivityItemModel>> activityList() async {
BaseListModel model = await NetUtil().getList(
API.community.activityList,
SARSAPI.activity.list,
params: {'pageNum': 1, 'size': 5},
);
if (model.rows.length == 0) return [];
return model.rows.map((e) => ActivityItemModel.fromJson(e)).toList();
return model.rows.map((e) => HomeActivityModel.fromJson(e)).toList();
}
static Future<List<BoardItemModel>> board() async {
static Future<List<HomeAnnounceModel>> board() async {
BaseListModel model = await NetUtil().getList(
API.community.boardList,
SARSAPI.announce.list,
params: {'pageNum': 1, 'size': 5},
);
if (model.rows.length == 0) return [];
return model.rows.map((e) => BoardItemModel.fromJson(e)).toList();
return model.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList();
}
static Future<List<SwiperModel>> swiper() async {
static Future<List<HomeSwiperModel>> swiper() async {
BaseModel model = await NetUtil().get(
API.community.getSwiper,
SARSAPI.homeCarouse.list,
);
if (model.data!.length == 0) return [];
return (model.data as List).map((e) => SwiperModel.fromJson(e)).toList();
return (model.data as List)
.map((e) => HomeSwiperModel.fromJson(e))
.toList();
}
}

@ -119,7 +119,7 @@ class TopicCommunityViewState extends State<TopicCommunityView> {
),
child: Stack(
children: [
BeeImageNetwork(urls: model.imgList),
BeeImageNetwork(imgs: model.imgList),
],
),
),

@ -1,21 +1,18 @@
import 'package:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/ui/community/notice/notice_detail_page.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
@Deprecated('旧设计,暂时弃用')
class NoticeCard extends StatelessWidget {
final BoardItemModel model;
final BoardItemModel? preModel;
final HomeAnnounceModel model;
final HomeAnnounceModel? preModel;
const NoticeCard({
Key? key,
@ -24,25 +21,26 @@ class NoticeCard extends StatelessWidget {
}) : super(key: key);
bool get sameDay =>
model.releaseDate!.year == (preModel?.releaseDate?.year ?? 0) &&
model.releaseDate!.month == (preModel?.releaseDate?.month ?? 0) &&
model.releaseDate!.day == (preModel?.releaseDate?.day ?? 0);
model.createDateString?.year == (preModel?.createDateString?.year ?? 0) &&
model.createDateString?.month ==
(preModel?.createDateString?.month ?? 0) &&
model.createDateString?.day == (preModel?.createDateString?.day ?? 0);
bool get isYesterday {
DateTime now = DateTime.now();
DateTime yestoday = DateTime(now.year, now.month, now.day - 1);
return yestoday.year == model.releaseDate!.year &&
yestoday.month == model.releaseDate!.month &&
yestoday.day == model.releaseDate!.day;
DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
return yesterday.year == model.createDateString?.year &&
yesterday.month == model.createDateString?.month &&
yesterday.day == model.createDateString?.day;
}
bool get isFirst => preModel == null;
bool get notSameYear =>
model.releaseDate!.year != (preModel?.releaseDate?.year ?? 0);
model.createDateString?.year != (preModel?.createDateString?.year ?? 0);
Widget title() {
if (DateUtil.isToday(model.releaseDate!.millisecond))
if (DateUtil.isToday(model.createDateString?.millisecond))
return '今天'.text.size(52.sp).bold.make();
if (isYesterday)
return '昨天'.text.size(52.sp).bold.make();
@ -50,8 +48,12 @@ class NoticeCard extends StatelessWidget {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
model.releaseDate!.day.toString().text.size(52.sp).bold.make(),
'${model.releaseDate!.month}'.text.size(36.sp).make(),
(model.createDateString?.day.toString() ?? '')
.text
.size(52.sp)
.bold
.make(),
'${model.createDateString?.month}'.text.size(36.sp).make(),
],
);
}
@ -62,8 +64,8 @@ class NoticeCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
(notSameYear && model.releaseDate!.year != DateTime.now().year)
? '${model.releaseDate!.year}'
(notSameYear && model.createDateString?.year != DateTime.now().year)
? '${model.createDateString?.year}'
.text
.bold
.size(52.sp)
@ -83,14 +85,14 @@ class NoticeCard extends StatelessWidget {
alignment: Alignment.topLeft,
child: sameDay ? SizedBox() : title(),
),
model.imgUrls!.length == 0
model.imgList.length == 0
? SizedBox(height: 152.w)
: GestureDetector(
onTap: () {
BeeImagePreview.toPath(
path: ImgModel.first(model.imgUrls),
path: ImgModel.first(model.imgList),
tag:
'${ImgModel.first(model.imgUrls)}${model.hashCode}',
'${ImgModel.first(model.imgList)}${model.hashCode}',
);
},
child: Container(
@ -101,19 +103,15 @@ class NoticeCard extends StatelessWidget {
),
child: Hero(
tag:
'${ImgModel.first(model.imgUrls)}${model.hashCode}',
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(model.imgUrls)),
width: 152.w,
height: 152.w,
fit: BoxFit.cover,
'${ImgModel.first(model.imgList)}${model.hashCode}',
child: BeeImageNetwork(
imgs: model.imgList,
),
),
),
),
10.wb,
model.title!.text.make().expand(),
model.title.text.make().expand(),
],
),
),

@ -1,20 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/community/board_detail_model.dart';
import 'package:aku_new_community/models/home/announce_detail_model.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.dart';
import 'package:aku_new_community/widget/views/bee_download_view.dart';
import 'package:aku_new_community/widget/views/doc_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:open_file/open_file.dart';
class NoticeDetailPage extends StatefulWidget {
final int? id;
@ -27,7 +24,7 @@ class NoticeDetailPage extends StatefulWidget {
class _NoticeDetailPageState extends State<NoticeDetailPage> {
EasyRefreshController _refreshController = EasyRefreshController();
BoardDetailModel? model;
AnnounceDetailModel? model;
Widget get emptyWidget => Column(
children: [],
@ -42,11 +39,11 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
header: MaterialHeader(),
onRefresh: () async {
BaseModel baseModel = await NetUtil().get(
API.community.boardDetail,
SARSAPI.announce.detail,
params: {'announcementId': widget.id},
);
if (baseModel.data != null) {
model = BoardDetailModel.fromJson(baseModel.data);
model = AnnounceDetailModel.fromJson(baseModel.data);
}
setState(() {});
},
@ -57,9 +54,9 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
: ListView(
padding: EdgeInsets.all(32.w),
children: [
model!.title!.text.size(32.sp).bold.make(),
model!.title.text.size(32.sp).bold.make(),
50.hb,
...model!.imgUrls!
...model!.annexImgList
.map(
(e) => GestureDetector(
onTap: () {
@ -76,10 +73,9 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
borderRadius: BorderRadius.circular(8.w),
color: Colors.black12,
),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(e.url),
fit: BoxFit.cover,
child: BeeImageNetwork(
urls: [e.url ?? ''],
fit: BoxFit.fill,
),
),
),
@ -87,17 +83,19 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
)
.toList(),
44.hb,
model!.content!.text.size(28.sp).make(),
model!.content.text.size(28.sp).make(),
43.hb,
DocViw(
title: model?.fileDocName ?? '',
onPressed: () async {
String? result = await Get.dialog(BeeDownloadView(
file: model!.fileDocUrl,
));
if (result != null) OpenFile.open(result);
},
),
...model!.annexImgList
.map((e) => DocViw(
title: e.url ?? '',
onPressed: () async {
String? result = await Get.dialog(BeeDownloadView(
file: SARSAPI.image(e.url),
));
if (result != null) OpenFile.open(result);
},
))
.toList(),
],
),
).material(color: Colors.white),

@ -1,15 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/community/notice/notice_card.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
@Deprecated('暂时弃用')
class NoticePage extends StatefulWidget {
NoticePage({Key? key}) : super(key: key);
@ -24,17 +22,17 @@ class _NoticePageState extends State<NoticePage> {
Widget build(BuildContext context) {
return BeeScaffold(
title: '社区公告',
body: BeeListView<BoardItemModel>(
body: BeeListView<HomeAnnounceModel>(
controller: _refreshController,
path: API.community.boardList,
path: SARSAPI.announce.list,
convert: (model) =>
model.rows.map((e) => BoardItemModel.fromJson(e)).toList(),
model.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList(),
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 32.w),
itemBuilder: (context, index) {
final BoardItemModel model = items[index];
BoardItemModel? preModel;
final HomeAnnounceModel model = items[index];
HomeAnnounceModel? preModel;
if (index >= 1) preModel = items[index - 1];
return NoticeCard(
model: model,

@ -1,19 +1,15 @@
import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/ui/community/notice/notice_detail_page.dart';
import 'package:aku_new_community/utils/bee_date_util.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/model/community/board_model.dart';
import 'package:aku_new_community/ui/community/notice/notice_page.dart';
import 'package:aku_new_community/utils/bee_date_util.dart';
import 'package:aku_new_community/utils/headers.dart';
class HomeNotification extends StatefulWidget {
final List<BoardItemModel> items;
final List<HomeAnnounceModel> items;
HomeNotification({Key? key, required this.items}) : super(key: key);
@ -22,17 +18,15 @@ class HomeNotification extends StatefulWidget {
}
class _HomeNotificationState extends State<HomeNotification> {
late BoardItemModel boardItemModel;
late HomeAnnounceModel boardItemModel;
bool isDate = true;
@override
void initState() {
super.initState();
if (widget.items != null) {
if (widget.items.length > 0) {
boardItemModel = widget.items[0];
}
if (widget.items.length > 0) {
boardItemModel = widget.items[0];
}
}
@ -69,10 +63,10 @@ class _HomeNotificationState extends State<HomeNotification> {
);
}
Widget getText(BoardItemModel e) {
Widget getText(HomeAnnounceModel e) {
return GestureDetector(
onTap: () {
Get.to(() => NoticePage());
Get.to(() => NoticeDetailPage(id: e.id));
},
child: Container(
color: Colors.transparent,
@ -81,7 +75,7 @@ class _HomeNotificationState extends State<HomeNotification> {
Container(
constraints: BoxConstraints(maxWidth: 190),
child: Text(
e.title ?? '',
e.title,
style: TextStyle(
color: Color(0xA6000000),
fontSize: 22.sp,
@ -93,7 +87,7 @@ class _HomeNotificationState extends State<HomeNotification> {
Spacer(),
Container(
child: Text(
e.releaseDate != null ? BeeDateUtil(e.releaseDate).timeAgo : '',
BeeDateUtil(DateUtil.getDateTime(e.createDate)).timeAgo,
style: TextStyle(
color: Color(0x73000000),
fontSize: 20.sp,

@ -5,28 +5,38 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeImageNetwork extends StatelessWidget {
final List<ImgModel> urls;
final List<ImgModel>? imgs;
final List<String>? urls;
final double? width;
final double? height;
final BoxFit? fit;
const BeeImageNetwork({Key? key, required this.urls, this.width, this.height})
: super(key: key);
const BeeImageNetwork(
{Key? key,
this.imgs,
this.width,
this.height,
this.urls,
this.fit = BoxFit.cover})
: assert(imgs != null || urls != null),
super(key: key);
@override
Widget build(BuildContext context) {
return FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(urls)),
image: SARSAPI.image(ImgModel.first(imgs)),
imageErrorBuilder: (context, obj, stackTrace) {
return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: width ?? 160.w,
height: 160.w,
height: height ?? 160.w,
fit: BoxFit.fill,
);
},
height: height ?? 160.w,
width: width ?? 160.w,
fit: BoxFit.cover,
fit: fit,
);
}
}

@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:flutter/material.dart';
class StackAvatar extends StatelessWidget {
final List<String?> avatars;
@ -32,12 +29,10 @@ class StackAvatar extends StatelessWidget {
border: Border.all(color: Color(0xFF999999)),
),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
height: 44.w,
child: BeeImageNetwork(
width: 44.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(avatars[index]),
fit: BoxFit.cover,
height: 44.w,
urls: [avatars[index] ?? ''],
),
),
);

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save