对接活动、公告模块

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

@ -28,6 +28,10 @@ class SARSAPI {
static _Message message = _Message(); static _Message message = _Message();
static _Community community = _Community(); static _Community community = _Community();
static _Task task = _Task(); static _Task task = _Task();
static _HomeCarouse homeCarouse = _HomeCarouse();
static _Activity activity = _Activity();
static _Announce announce = _Announce();
static _Information information = _Information();
/// ///
static _ProfileApi profile = _ProfileApi(); static _ProfileApi profile = _ProfileApi();
@ -169,3 +173,38 @@ class _Task {
/// ///
String get list => '/app/user/taskRelease/list'; 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/base/base_style.dart';
import 'package:aku_new_community/model/common/img_model.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 { class ActivityItemModel {
int? id; int? id;
String? title; String? title;

@ -1,5 +1,6 @@
import 'package:aku_new_community/model/common/img_model.dart'; import 'package:aku_new_community/model/common/img_model.dart';
@Deprecated('弃用')
class SwiperModel { class SwiperModel {
int? newsId; int? newsId;
String? title; 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: // 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/application_objects.dart';
import 'package:aku_new_community/constants/sars_api.dart'; import 'package:aku_new_community/constants/sars_api.dart';
import 'package:aku_new_community/extensions/color_ext.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/common/img_model.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/model/community/board_model.dart'; import 'package:aku_new_community/models/home/home_announce_model.dart';
import 'package:aku_new_community/model/community/swiper_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/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/one_alarm/widget/alarm_page.dart';
import 'package:aku_new_community/pages/visitor_access_page/visitor_access_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/community/community_func.dart';
import 'package:aku_new_community/ui/home/home_notification.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/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/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/ui/search/bee_search.dart';
import 'package:aku_new_community/utils/headers.dart'; import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/login_util.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/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/rectIndicator.dart';
import 'package:aku_new_community/widget/others/user_tool.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 { class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key); HomePage({Key? key}) : super(key: key);
@ -64,9 +64,9 @@ class _HomePageState extends State<HomePage>
int _currentSwiperIndex = 0; int _currentSwiperIndex = 0;
// ActivityItemModel? _activityItemModel; // ActivityItemModel? _activityItemModel;
List<ActivityItemModel> _activityItemModels = []; List<HomeActivityModel> _activityItemModels = [];
List<BoardItemModel> _boardItemModels = []; List<HomeAnnounceModel> _boardItemModels = [];
List<SwiperModel> _swiperModels = []; List<HomeSwiperModel> _swiperModels = [];
SwiperController _swiperController = SwiperController(); SwiperController _swiperController = SwiperController();
ValueNotifier<Color> _barColor = ValueNotifier(Colors.transparent); ValueNotifier<Color> _barColor = ValueNotifier(Colors.transparent);
@ -200,7 +200,6 @@ class _HomePageState extends State<HomePage>
header: BeeBallPauseHeader(bgColor: _barColor), header: BeeBallPauseHeader(bgColor: _barColor),
firstRefresh: true, firstRefresh: true,
onRefresh: () async { onRefresh: () async {
//_activityItemModel = await CommunityFunc.activity();
_activityItemModels = await CommunityFunc.activityList(); _activityItemModels = await CommunityFunc.activityList();
_boardItemModels = await CommunityFunc.board(); _boardItemModels = await CommunityFunc.board();
_swiperModels = await CommunityFunc.swiper(); _swiperModels = await CommunityFunc.swiper();
@ -214,6 +213,7 @@ class _HomePageState extends State<HomePage>
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
head,
HomeSwiper(), // HomeSwiper(), //
// SizedBox(height: 100.w), // SizedBox(height: 100.w),
Container( Container(
@ -434,7 +434,7 @@ class _HomePageState extends State<HomePage>
_activityItemModels == [] _activityItemModels == []
? SizedBox() ? SizedBox()
: Container( : Container(
height: 400.w, height: 480.w,
padding: EdgeInsets.only(left: 32.w), padding: EdgeInsets.only(left: 32.w),
child: ListView.separated( child: ListView.separated(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -513,8 +513,7 @@ class _HomePageState extends State<HomePage>
// control: new SwiperControl(), // control: new SwiperControl(),
autoplay: true, autoplay: true,
onTap: (index) { onTap: (index) {
Get.to(() => swiperNavigate(_swiperModels[index]);
PublicInformationDetailPage(id: _swiperModels[index].newsId!));
}, },
itemCount: _swiperModels.length, 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 { Future _swiperBarColor(int index) async {
if (_swiperModels.isNotEmpty) { if (_swiperModels.isNotEmpty) {
var color = var color =
await PaletteGenerator.fromImageProvider(CachedNetworkImageProvider( 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; _barColor.value = color.dominantColor?.color ?? Colors.transparent;
} else { } else {
@ -534,18 +553,10 @@ class _HomePageState extends State<HomePage>
} }
} }
Widget getSwiperImage(SwiperModel swiperModel) { Widget getSwiperImage(HomeSwiperModel swiperModel) {
return Container( return Container(
child: FadeInImage.assetNetwork( child: BeeImageNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, imgs: swiperModel.imgList ?? [],
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,
);
},
), ),
); );
} }

@ -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/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/property/property_page.dart';
import 'package:aku_new_community/pages/sign/login/login_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/provider/app_provider.dart';
import 'package:aku_new_community/ui/community/community_views/community_page.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/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/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.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 'home/home_page.dart';
import 'personal/personal_page.dart'; import 'personal/personal_page.dart';
@ -50,25 +43,11 @@ class _TabNavigatorState extends State<TabNavigator>
final appProvider = Provider.of<AppProvider>(Get.context!); final appProvider = Provider.of<AppProvider>(Get.context!);
Future.delayed(Duration(milliseconds: 0), () async { Future.delayed(Duration(milliseconds: 0), () async {
await appProvider.getMyAddress(); // 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 = [ _pages = [
HomePage(), HomePage(),
MarketPage(), MarketPage(),
PropertyPage(), //PropertyIndex(), PropertyPage(),
CommunityPage(), CommunityPage(),
PersonalIndex() 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:flutter/material.dart';
import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_new_community/const/resource.dart'; import 'activity_detail_page.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';
class ActivityCard extends StatelessWidget { class ActivityCard extends StatelessWidget {
final ActivityItemModel? model; final bool? home;
final HomeActivityModel? model;
const ActivityCard({ const ActivityCard({
Key? key, Key? key,
required this.model, required this.model,
this.home = false,
}) : super(key: key); }) : super(key: key);
bool get outdate => model!.end!.compareTo(DateTime.now()) == -1; bool get outdate => model!.end!.compareTo(DateTime.now()) == -1;
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialButton( return ConstrainedBox(
clipBehavior: Clip.antiAlias, constraints: BoxConstraints(maxHeight: home! ? 480.w : 540.w),
color: Colors.white, child: MaterialButton(
padding: EdgeInsets.zero, clipBehavior: Clip.antiAlias,
onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)), color: Colors.white,
elevation: 0, padding: EdgeInsets.zero,
shape: RoundedRectangleBorder( onPressed: () => Get.to(() => ActivityDetailPage(id: model!.id)),
borderRadius: BorderRadius.circular(24.w), elevation: 0,
// side: BorderSide( shape: RoundedRectangleBorder(
// color: Colors.grey, borderRadius: BorderRadius.circular(24.w),
// ), ),
), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, child: Column(
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min,
children: [ children: [
Hero( Hero(
tag: ImgModel.first(model!.imgUrls), tag: ImgModel.first(model!.imgList),
child: Material( child: Material(
color: Colors.grey, color: Colors.grey,
child: FadeInImage.assetNetwork( child: BeeImageNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, imgs: model!.imgList ?? [],
image: SARSAPI.image(ImgModel.first(model!.imgUrls)), width: double.infinity,
height: 197.w, height: home! ? 240.w : 340.w,
width: double.infinity, ),
fit: BoxFit.cover,
), ),
), ),
), Padding(
padding: EdgeInsets.only(left: 24.w, top: 24.w),
Padding( child: Row(
padding: EdgeInsets.only(left: 24.w, top: 24.w), crossAxisAlignment: CrossAxisAlignment.start,
child: Row( children: [
crossAxisAlignment: CrossAxisAlignment.start, Container(
children: [ constraints: BoxConstraints(maxWidth: 340.w),
Container( child: Text(
constraints: BoxConstraints(maxWidth: 340.w), model == null ? '' : model!.title,
child: Text( maxLines: 2,
model == null ? '' : model!.title!, overflow: TextOverflow.ellipsis,
maxLines: 2, style: TextStyle(
overflow: TextOverflow.ellipsis, color: Color(0xD9000000),
style: TextStyle( fontSize: 28.sp,
color: Color(0xD9000000), fontWeight: FontWeight.bold),
fontSize: 28.sp, ),
fontWeight: FontWeight.bold),
), ),
), Spacer(),
Spacer(), GestureDetector(
GestureDetector( child: Container(
child: Container( //color: Color(0x80FEBF76),
//color: Color(0x80FEBF76),
// shape: StadiumBorder(), // shape: StadiumBorder(),
alignment: Alignment.center, alignment: Alignment.center,
height: 39.w, height: 39.w,
width: 98.w, width: 98.w,
decoration: BoxDecoration( decoration: BoxDecoration(
color: outdate color: outdate
? Colors.black.withOpacity(0.06) ? Colors.black.withOpacity(0.06)
: Color(0x80FEBF76), : Color(0x80FEBF76),
borderRadius: BorderRadius.all(Radius.circular(4)), borderRadius: BorderRadius.all(Radius.circular(4)),
), ),
child: outdate child: outdate
? '已结束' ? '已结束'
.text .text
.size(22.sp) .size(22.sp)
.color(Colors.black.withOpacity(0.25)) .color(Colors.black.withOpacity(0.25))
.make() .make()
: '报名中' : '报名中'
.text .text
.size(22.sp) .size(22.sp)
.color(Color(0xFFF48117)) .color(Color(0xFFF48117))
.make(), .make(),
),
onTap: () {
outdate
? null
: () {
Get.to(() => ActivityDetailPage(id: model!.id));
};
},
), ),
onTap: () { 24.wb
outdate ],
? null ),
: () {
Get.to(() => ActivityDetailPage(id: model!.id));
};
},
),
24.wb
],
), ),
), Spacer(),
// [ [
// '地 点:'.text.size(24.sp).color(Color(0xFF999999)).make(), Flexible(
// model!.location!.text.size(24.sp).make(), child: AvatarsParticipate(
// ].row().pSymmetric(h: 24.w), avatars: (model?.imgList?.map((e) => e.url).toList() ?? []),
20.hb, pNum: model?.registrationNum ?? 0,
[ hasIcon: false,
'报名截止:'.text.size(22.sp).color(Color(0x73000000)).make(), ),
'${DateUtil.formatDate( ),
model!.end, // Spacer(),
format: 'yyyy年MM月dd日 HH:mm', ActivityFunc.dateCheck(model!.end)
)}' .text
.text .size(28.sp)
.size(22.sp) .color(Colors.black.withOpacity(0.45))
.color(Color(0x73000000)) .make(),
.make(), ].row().pSymmetric(h: 24.w),
].row().pSymmetric(h: 24.w), 20.hb,
// [ ],
// // 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),
],
), ),
); );
} }

@ -1,36 +1,58 @@
import 'package:flutter/cupertino.dart'; import 'package:aku_new_community/constants/sars_api.dart';
import 'package:flutter/material.dart'; import 'package:aku_new_community/model/common/img_model.dart';
import 'package:aku_new_community/models/home/activity_detail_model.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/utils/headers.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_divider.dart';
import 'package:aku_new_community/widget/bee_scaffold.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/buttons/bottom_button.dart';
import 'package:aku_new_community/widget/others/stack_avatar.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 { 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 @override
_ActivityDetailPageState createState() => _ActivityDetailPageState(); _ActivityDetailPageState createState() => _ActivityDetailPageState();
} }
class _ActivityDetailPageState extends State<ActivityDetailPage> { class _ActivityDetailPageState extends State<ActivityDetailPage> {
final EasyRefreshController _refreshController = EasyRefreshController();
ActivityDetailModel? _model;
@override
void initState() {
_refreshController.dispose();
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var content = Container( var content = Container(
width: double.infinity, width: double.infinity,
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'活动详情'.text.size(32.sp).color(Colors.black).bold.make(), '活动详情'.text.size(32.sp).color(Colors.black).bold.make(),
32.w.heightBox, 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, 32.w.heightBox,
...List.generate( ...List.generate(
0, 0,
@ -40,9 +62,8 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
), ),
child: Image.network( child: BeeImageNetwork(
'', urls: [ImgModel.first(_model?.imgList)],
fit: BoxFit.fill,
), ),
)), )),
], ],
@ -50,57 +71,89 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
); );
return BeeScaffold( return BeeScaffold(
title: '活动详情', title: '活动详情',
body: ListView( body: EasyRefresh(
children: [ header: MaterialHeader(),
_headWidget(), controller: _refreshController,
24.w.heightBox, firstRefresh: true,
content, onRefresh: () async {
24.w.heightBox, BaseModel baseModel = await NetUtil().get(
Container( SARSAPI.activity.detail,
width: double.infinity, params: {'activityId': widget.id},
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w), );
height: 132.w, _model = ActivityDetailModel.fromJson(baseModel.data);
child: Row( setState(() {});
children: [ },
CircleAvatar( child: _model == null
child: FadeInImage.assetNetwork( ? SizedBox()
placeholder: Assets.images.placeholder.path, : ListView(
image: '', 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( bottomNavi: BottomButton(
child: '立即报名'.text.size(32.sp).color(Colors.black).bold.make(), 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, color: Colors.white,
child: Column( child: Column(
children: [ children: [
Image.asset( Container(
Assets.images.logo.path,
width: double.infinity, width: double.infinity,
height: 280.w, height: 280.w,
child: BeeImageNetwork(
imgs: _model!.imgList,
fit: BoxFit.fitWidth,
),
), ),
Padding( Padding(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.only(
left: 32.w, right: 32.w, top: 16.w, bottom: 16.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'人才公寓党政建设讲座系列活动——庆祝中国共产党建党71周年活动' '${_model!.title}'
.text .text
.size(32.sp) .size(32.sp)
.color(Colors.black.withOpacity(0.85)) .color(Colors.black.withOpacity(0.85))
@ -127,121 +185,110 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
.bold .bold
.make(), .make(),
32.w.heightBox, 32.w.heightBox,
Container( Row(
width: 104.w, mainAxisAlignment: MainAxisAlignment.start,
height: 42.w, children: [
decoration: BoxDecoration( Container(
color: Color(0xFFFEC076).withOpacity(0.5), width: 104.w,
borderRadius: BorderRadius.circular(10.w)), height: 42.w,
alignment: Alignment.center, decoration: BoxDecoration(
child: color: Color(0xFFFEC076).withOpacity(0.5),
'报名中'.text.size(24.sp).color(Color(0xFFF481170)).make(), borderRadius: BorderRadius.circular(10.w)),
alignment: Alignment.center,
child: '${ActivityFunc.dateCheck(_model!.regisEndTime)}'
.text
.size(24.sp)
.color(Color(0xFFF481170))
.make(),
),
],
), ),
32.w.heightBox, 32.w.heightBox,
_buildTile( _buildTile(
'报名时间', '报名时间',
'${DateUtil.formatDate( '${DateUtil.formatDate(
DateTime.now(), _model!.regisStartTime,
format: 'yyyy.MM.dd HH:mm', format: 'yyyy.MM.dd HH:mm',
)}-${DateUtil.formatDate( )}-${DateUtil.formatDate(
DateTime.now(), _model!.regisEndTime,
format: 'yyyy.MM.dd HH:mm', format: 'yyyy.MM.dd HH:mm',
)}', )}',
), ),
16.hb,
_buildTile( _buildTile(
'活动时间', '活动时间',
'${DateUtil.formatDate( '${DateUtil.formatDate(
DateTime.now(), _model!.activeTime,
format: 'yyyy.MM.dd HH:mm', format: 'yyyy.MM.dd HH:mm',
)}-${DateUtil.formatDate( )}-${DateUtil.formatDate(
DateTime.now(), _model!.activeEndTime,
format: 'yyyy.MM.dd HH:mm', format: 'yyyy.MM.dd HH:mm',
)}', )}',
), ),
Padding( 16.hb,
padding: EdgeInsets.symmetric(horizontal: 32.w), Row(
child: Row( children: [
children: [ '活动方式'.text.size(28.sp).make().box.width(136.w).make(),
'活动方式'.text.size(28.sp).make().box.width(136.w).make(), '本次活动介绍'
'本次活动介绍' .richText
.richText .tap(() {
.tap(() { var bottomSheet = Container(
var bottomSheet = Container( width: double.infinity,
width: double.infinity, padding: EdgeInsets.all(32.w),
padding: EdgeInsets.all(32.w), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.white,
color: Colors.white, borderRadius: BorderRadius.circular(16.w)),
borderRadius: BorderRadius.circular(16.w)), child: Column(
child: Column( children: [
children: [ '活动介绍'.text.size(32.sp).black.bold.make(),
'活动介绍'.text.size(32.sp).black.bold.make(), 32.w.heightBox,
32.w.heightBox, _model!.content.text
], .size(28.sp)
), .color(Colors.black.withOpacity(0.65))
); .make(),
Get.bottomSheet( ],
bottomSheet, ),
); );
}) Get.bottomSheet(
.size(28.sp) bottomSheet,
.make(), );
Spacer(), })
], .size(28.sp)
), .color(Colors.blue)
.make(),
Spacer(),
],
), ),
Padding( 16.hb,
padding: EdgeInsets.symmetric(horizontal: 32.w), Row(
child: Row( children: [
children: [ '活动费用'.text.size(28.sp).make().box.width(136.w).make(),
'活动费用'.text.size(28.sp).make().box.width(136.w).make(), '免费'.richText.size(28.sp).make(),
'免费'.richText.size(28.sp).make(), Spacer(),
Spacer(), ],
],
),
), ),
32.w.heightBox, 16.w.heightBox,
Padding( Row(
padding: EdgeInsets.symmetric(horizontal: 32.w), children: [
child: Row( '活动地点'.text.size(28.sp).make().box.width(136.w).make(),
children: [ '${_model!.activityAddress}'
'活动地点'.text.size(28.sp).make().box.width(136.w).make(), .richText
'永恒智慧大厦'.richText.tap(() {}).size(28.sp).make(), .tap(() {})
Spacer(), .size(28.sp)
], .color(Colors.blue)
), .make(),
Spacer(),
],
), ),
32.w.heightBox, 32.w.heightBox,
BeeDivider.horizontal( BeeDivider.horizontal(),
indent: 32.w, 16.hb,
endIndent: 32.w, AvatarsParticipate(
), avatars: _model!.registrationList
InkWell( .map((e) => ImgModel.first(e.avatarImgList))
onTap: () {}, .toList(),
child: Container( pNum: _model!.registrationNum,
padding: EdgeInsets.only( tNum: _model!.registrationNumMax),
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,
),
],
),
),
),
], ],
), ),
), ),
@ -256,6 +303,62 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
title.text.size(28.sp).make().box.width(136.w).make(), title.text.size(28.sp).make().box.width(136.w).make(),
subTitle.text.size(28.sp).make().expand(), 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/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/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/community/activity/activity_card.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/utils/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.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 { class ActivityListPage extends StatefulWidget {
ActivityListPage({Key? key}) : super(key: key); ActivityListPage({Key? key}) : super(key: key);
@ -31,24 +26,24 @@ class _ActivityListPageState extends State<ActivityListPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '往期精彩', title: '社区活动',
actions: [ actions: [
IconButton( // IconButton(
onPressed: () { // onPressed: () {
Get.to(() => ActivityDetailPage(id: 0)); // Get.to(() => ActivityDetailPage(id: 0));
}, // },
icon: Icon(Icons.delete)) // icon: Icon(Icons.delete))
], ],
body: BeeListView<ActivityItemModel>( body: BeeListView<HomeActivityModel>(
controller: _refreshController, controller: _refreshController,
path: API.community.activityList, path: SARSAPI.activity.list,
convert: (model) => convert: (model) =>
model.rows.map((e) => ActivityItemModel.fromJson(e)).toList(), model.rows.map((e) => HomeActivityModel.fromJson(e)).toList(),
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final ActivityItemModel model = items[index]; final HomeActivityModel model = items[index];
return ActivityCard(model: model); return ActivityCard(model: model);
}, },
separatorBuilder: (_, __) => 20.hb, separatorBuilder: (_, __) => 20.hb,

@ -1,12 +1,12 @@
import 'package:aku_new_community/constants/api.dart'; import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/sars_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/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/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/dynamic_my_list_body.dart';
import 'package:aku_new_community/models/community/topic_model.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/goods_popular_model.dart';
import 'package:aku_new_community/models/market/market_all_category_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'; import 'package:aku_new_community/models/market/market_category_model.dart';
@ -120,38 +120,31 @@ class CommunityFunc {
.toList(); .toList();
} }
static Future<ActivityItemModel?> activity() async { static Future<List<HomeActivityModel>> activityList() async {
BaseListModel model = await NetUtil().getList( BaseListModel model = await NetUtil().getList(
API.community.activityList, SARSAPI.activity.list,
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,
params: {'pageNum': 1, 'size': 5}, params: {'pageNum': 1, 'size': 5},
); );
if (model.rows.length == 0) return []; 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( BaseListModel model = await NetUtil().getList(
API.community.boardList, SARSAPI.announce.list,
params: {'pageNum': 1, 'size': 5}, params: {'pageNum': 1, 'size': 5},
); );
if (model.rows.length == 0) return []; 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( BaseModel model = await NetUtil().get(
API.community.getSwiper, SARSAPI.homeCarouse.list,
); );
if (model.data!.length == 0) return []; 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( child: Stack(
children: [ 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/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/ui/community/notice/notice_detail_page.dart';
import 'package:aku_new_community/utils/headers.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: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 { class NoticeCard extends StatelessWidget {
final BoardItemModel model; final HomeAnnounceModel model;
final BoardItemModel? preModel; final HomeAnnounceModel? preModel;
const NoticeCard({ const NoticeCard({
Key? key, Key? key,
@ -24,25 +21,26 @@ class NoticeCard extends StatelessWidget {
}) : super(key: key); }) : super(key: key);
bool get sameDay => bool get sameDay =>
model.releaseDate!.year == (preModel?.releaseDate?.year ?? 0) && model.createDateString?.year == (preModel?.createDateString?.year ?? 0) &&
model.releaseDate!.month == (preModel?.releaseDate?.month ?? 0) && model.createDateString?.month ==
model.releaseDate!.day == (preModel?.releaseDate?.day ?? 0); (preModel?.createDateString?.month ?? 0) &&
model.createDateString?.day == (preModel?.createDateString?.day ?? 0);
bool get isYesterday { bool get isYesterday {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
DateTime yestoday = DateTime(now.year, now.month, now.day - 1); DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
return yestoday.year == model.releaseDate!.year && return yesterday.year == model.createDateString?.year &&
yestoday.month == model.releaseDate!.month && yesterday.month == model.createDateString?.month &&
yestoday.day == model.releaseDate!.day; yesterday.day == model.createDateString?.day;
} }
bool get isFirst => preModel == null; bool get isFirst => preModel == null;
bool get notSameYear => bool get notSameYear =>
model.releaseDate!.year != (preModel?.releaseDate?.year ?? 0); model.createDateString?.year != (preModel?.createDateString?.year ?? 0);
Widget title() { Widget title() {
if (DateUtil.isToday(model.releaseDate!.millisecond)) if (DateUtil.isToday(model.createDateString?.millisecond))
return '今天'.text.size(52.sp).bold.make(); return '今天'.text.size(52.sp).bold.make();
if (isYesterday) if (isYesterday)
return '昨天'.text.size(52.sp).bold.make(); return '昨天'.text.size(52.sp).bold.make();
@ -50,8 +48,12 @@ class NoticeCard extends StatelessWidget {
return Row( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
model.releaseDate!.day.toString().text.size(52.sp).bold.make(), (model.createDateString?.day.toString() ?? '')
'${model.releaseDate!.month}'.text.size(36.sp).make(), .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, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
(notSameYear && model.releaseDate!.year != DateTime.now().year) (notSameYear && model.createDateString?.year != DateTime.now().year)
? '${model.releaseDate!.year}' ? '${model.createDateString?.year}'
.text .text
.bold .bold
.size(52.sp) .size(52.sp)
@ -83,14 +85,14 @@ class NoticeCard extends StatelessWidget {
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: sameDay ? SizedBox() : title(), child: sameDay ? SizedBox() : title(),
), ),
model.imgUrls!.length == 0 model.imgList.length == 0
? SizedBox(height: 152.w) ? SizedBox(height: 152.w)
: GestureDetector( : GestureDetector(
onTap: () { onTap: () {
BeeImagePreview.toPath( BeeImagePreview.toPath(
path: ImgModel.first(model.imgUrls), path: ImgModel.first(model.imgList),
tag: tag:
'${ImgModel.first(model.imgUrls)}${model.hashCode}', '${ImgModel.first(model.imgList)}${model.hashCode}',
); );
}, },
child: Container( child: Container(
@ -101,19 +103,15 @@ class NoticeCard extends StatelessWidget {
), ),
child: Hero( child: Hero(
tag: tag:
'${ImgModel.first(model.imgUrls)}${model.hashCode}', '${ImgModel.first(model.imgList)}${model.hashCode}',
child: FadeInImage.assetNetwork( child: BeeImageNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, imgs: model.imgList,
image: SARSAPI.image(ImgModel.first(model.imgUrls)),
width: 152.w,
height: 152.w,
fit: BoxFit.cover,
), ),
), ),
), ),
), ),
10.wb, 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/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/headers.dart';
import 'package:aku_new_community/utils/network/base_model.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/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/bee_scaffold.dart';
import 'package:aku_new_community/widget/picker/bee_image_preview.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/bee_download_view.dart';
import 'package:aku_new_community/widget/views/doc_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 { class NoticeDetailPage extends StatefulWidget {
final int? id; final int? id;
@ -27,7 +24,7 @@ class NoticeDetailPage extends StatefulWidget {
class _NoticeDetailPageState extends State<NoticeDetailPage> { class _NoticeDetailPageState extends State<NoticeDetailPage> {
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
BoardDetailModel? model; AnnounceDetailModel? model;
Widget get emptyWidget => Column( Widget get emptyWidget => Column(
children: [], children: [],
@ -42,11 +39,11 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
BaseModel baseModel = await NetUtil().get( BaseModel baseModel = await NetUtil().get(
API.community.boardDetail, SARSAPI.announce.detail,
params: {'announcementId': widget.id}, params: {'announcementId': widget.id},
); );
if (baseModel.data != null) { if (baseModel.data != null) {
model = BoardDetailModel.fromJson(baseModel.data); model = AnnounceDetailModel.fromJson(baseModel.data);
} }
setState(() {}); setState(() {});
}, },
@ -57,9 +54,9 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
: ListView( : ListView(
padding: EdgeInsets.all(32.w), padding: EdgeInsets.all(32.w),
children: [ children: [
model!.title!.text.size(32.sp).bold.make(), model!.title.text.size(32.sp).bold.make(),
50.hb, 50.hb,
...model!.imgUrls! ...model!.annexImgList
.map( .map(
(e) => GestureDetector( (e) => GestureDetector(
onTap: () { onTap: () {
@ -76,10 +73,9 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
borderRadius: BorderRadius.circular(8.w), borderRadius: BorderRadius.circular(8.w),
color: Colors.black12, color: Colors.black12,
), ),
child: FadeInImage.assetNetwork( child: BeeImageNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, urls: [e.url ?? ''],
image: SARSAPI.image(e.url), fit: BoxFit.fill,
fit: BoxFit.cover,
), ),
), ),
), ),
@ -87,17 +83,19 @@ class _NoticeDetailPageState extends State<NoticeDetailPage> {
) )
.toList(), .toList(),
44.hb, 44.hb,
model!.content!.text.size(28.sp).make(), model!.content.text.size(28.sp).make(),
43.hb, 43.hb,
DocViw( ...model!.annexImgList
title: model?.fileDocName ?? '', .map((e) => DocViw(
onPressed: () async { title: e.url ?? '',
String? result = await Get.dialog(BeeDownloadView( onPressed: () async {
file: model!.fileDocUrl, String? result = await Get.dialog(BeeDownloadView(
)); file: SARSAPI.image(e.url),
if (result != null) OpenFile.open(result); ));
}, if (result != null) OpenFile.open(result);
), },
))
.toList(),
], ],
), ),
).material(color: Colors.white), ).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/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/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/ui/community/notice/notice_card.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/headers.dart';
import 'package:aku_new_community/widget/bee_scaffold.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 { class NoticePage extends StatefulWidget {
NoticePage({Key? key}) : super(key: key); NoticePage({Key? key}) : super(key: key);
@ -24,17 +22,17 @@ class _NoticePageState extends State<NoticePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '社区公告', title: '社区公告',
body: BeeListView<BoardItemModel>( body: BeeListView<HomeAnnounceModel>(
controller: _refreshController, controller: _refreshController,
path: API.community.boardList, path: SARSAPI.announce.list,
convert: (model) => convert: (model) =>
model.rows.map((e) => BoardItemModel.fromJson(e)).toList(), model.rows.map((e) => HomeAnnounceModel.fromJson(e)).toList(),
builder: (items) { builder: (items) {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 32.w), padding: EdgeInsets.symmetric(vertical: 32.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
final BoardItemModel model = items[index]; final HomeAnnounceModel model = items[index];
BoardItemModel? preModel; HomeAnnounceModel? preModel;
if (index >= 1) preModel = items[index - 1]; if (index >= 1) preModel = items[index - 1];
return NoticeCard( return NoticeCard(
model: model, 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/cupertino.dart';
import 'package:flutter/material.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: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 { class HomeNotification extends StatefulWidget {
final List<BoardItemModel> items; final List<HomeAnnounceModel> items;
HomeNotification({Key? key, required this.items}) : super(key: key); HomeNotification({Key? key, required this.items}) : super(key: key);
@ -22,17 +18,15 @@ class HomeNotification extends StatefulWidget {
} }
class _HomeNotificationState extends State<HomeNotification> { class _HomeNotificationState extends State<HomeNotification> {
late BoardItemModel boardItemModel; late HomeAnnounceModel boardItemModel;
bool isDate = true; bool isDate = true;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (widget.items != null) { if (widget.items.length > 0) {
if (widget.items.length > 0) { boardItemModel = widget.items[0];
boardItemModel = widget.items[0];
}
} }
} }
@ -69,10 +63,10 @@ class _HomeNotificationState extends State<HomeNotification> {
); );
} }
Widget getText(BoardItemModel e) { Widget getText(HomeAnnounceModel e) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.to(() => NoticePage()); Get.to(() => NoticeDetailPage(id: e.id));
}, },
child: Container( child: Container(
color: Colors.transparent, color: Colors.transparent,
@ -81,7 +75,7 @@ class _HomeNotificationState extends State<HomeNotification> {
Container( Container(
constraints: BoxConstraints(maxWidth: 190), constraints: BoxConstraints(maxWidth: 190),
child: Text( child: Text(
e.title ?? '', e.title,
style: TextStyle( style: TextStyle(
color: Color(0xA6000000), color: Color(0xA6000000),
fontSize: 22.sp, fontSize: 22.sp,
@ -93,7 +87,7 @@ class _HomeNotificationState extends State<HomeNotification> {
Spacer(), Spacer(),
Container( Container(
child: Text( child: Text(
e.releaseDate != null ? BeeDateUtil(e.releaseDate).timeAgo : '', BeeDateUtil(DateUtil.getDateTime(e.createDate)).timeAgo,
style: TextStyle( style: TextStyle(
color: Color(0x73000000), color: Color(0x73000000),
fontSize: 20.sp, fontSize: 20.sp,

@ -5,28 +5,38 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class BeeImageNetwork extends StatelessWidget { class BeeImageNetwork extends StatelessWidget {
final List<ImgModel> urls; final List<ImgModel>? imgs;
final List<String>? urls;
final double? width; final double? width;
final double? height; final double? height;
final BoxFit? fit;
const BeeImageNetwork({Key? key, required this.urls, this.width, this.height}) const BeeImageNetwork(
: super(key: key); {Key? key,
this.imgs,
this.width,
this.height,
this.urls,
this.fit = BoxFit.cover})
: assert(imgs != null || urls != null),
super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FadeInImage.assetNetwork( return FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SARSAPI.image(ImgModel.first(urls)), image: SARSAPI.image(ImgModel.first(imgs)),
imageErrorBuilder: (context, obj, stackTrace) { imageErrorBuilder: (context, obj, stackTrace) {
return Image.asset( return Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP, R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: width ?? 160.w, width: width ?? 160.w,
height: 160.w, height: height ?? 160.w,
fit: BoxFit.fill,
); );
}, },
height: height ?? 160.w, height: height ?? 160.w,
width: width ?? 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/utils/headers.dart';
import 'package:aku_new_community/widget/beeImageNetwork.dart';
import 'package:flutter/material.dart';
class StackAvatar extends StatelessWidget { class StackAvatar extends StatelessWidget {
final List<String?> avatars; final List<String?> avatars;
@ -32,12 +29,10 @@ class StackAvatar extends StatelessWidget {
border: Border.all(color: Color(0xFF999999)), border: Border.all(color: Color(0xFF999999)),
), ),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork( child: BeeImageNetwork(
height: 44.w,
width: 44.w, width: 44.w,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, height: 44.w,
image: SARSAPI.image(avatars[index]), urls: [avatars[index] ?? ''],
fit: BoxFit.cover,
), ),
), ),
); );

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