修复时间字段显示,动态卡片时间显示修复

hmxc
小赖 4 years ago
parent 332c12cfae
commit 1d32e80891

@ -187,6 +187,9 @@ class _Community {
///
String get myEvent => '/user/gambit/myTidings';
///
String get deleteMyEvent => '/user/gambit/falseDelete';
}
class _Upload {

@ -49,6 +49,9 @@ class _NewCommunityViewState extends State<NewCommunityView>
headImg: item.headSculptureImgUrl,
themeId: item.id,
initLike: item.isLike == 1,
onDelete: () {
_refreshController.callRefresh();
},
);
},
itemCount: items.length,

@ -73,6 +73,9 @@ class _TopicDetailPageState extends State<TopicDetailPage> {
contentImg: item.imgUrls,
date: item.date,
id: item.createId,
onDelete: () {
_refreshController.callRefresh();
},
);
},
childCount: items.length,

@ -33,6 +33,8 @@ class ChatCard extends StatefulWidget {
final int themeId;
final VoidCallback onDelete;
ChatCard({
Key key,
@required this.name,
@ -44,6 +46,7 @@ class ChatCard extends StatefulWidget {
@required this.id,
@required this.content,
@required this.themeId,
this.onDelete,
}) : super(key: key);
@override
@ -136,7 +139,7 @@ class _ChatCardState extends State<ChatCard> {
cancel();
await NetUtil().get(
API.community.like,
params: {'themeId': widget.id},
params: {'themeId': widget.themeId},
showMessage: true,
);
setState(() {
@ -291,7 +294,12 @@ class _ChatCardState extends State<ChatCard> {
));
if (result == true) {
//TODO delete operation
await NetUtil().get(
API.community.deleteMyEvent,
params: {'themeId': widget.themeId},
showMessage: true,
);
if (widget.onDelete != null) widget.onDelete();
}
},
child: '删除'.text.black.size(28.sp).make(),

@ -65,19 +65,22 @@ class MyEventCard extends StatelessWidget {
width: 200.w,
padding: EdgeInsets.only(left: 32.w),
alignment: Alignment.topLeft,
child: beeDate.sameDay ? SizedBox() : title(),
child: beeDate.sameDay ? title() : SizedBox(),
),
model.imgUrl.length == 0
? SizedBox(height: 152.w)
: GestureDetector(
onTap: () {
Get.to(
BeeImagePreview.path(path: model.imgUrl.first.url),
BeeImagePreview.path(
path: model.imgUrl.first.url,
tag: API.image(model.imgUrl.first.url),
),
opaque: false,
);
},
child: Hero(
tag: model.imgUrl.first.url,
tag: API.image(model.imgUrl.first.url),
child: Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(

@ -81,7 +81,7 @@ class NoticeCard extends StatelessWidget {
width: 200.w,
padding: EdgeInsets.only(left: 32.w),
alignment: Alignment.topLeft,
child: sameDay ? SizedBox() : title(),
child: sameDay ? title() : SizedBox(),
),
model.imgUrls.length == 0
? SizedBox(height: 152.w)

@ -8,11 +8,13 @@ class BeeDateUtil {
bool get sameYear => _now.year == this.date.year;
bool get sameMonth => sameYear && _now.month == this.date.month;
bool get sameDay => sameMonth && _now.day == this.date.day;
bool get isYesterday => (DateTime(_now.year, _now.month, _now.day - 1)
.compareTo(DateTime(this.date.year)) ==
bool get isYesterday =>
(DateTime(_now.year, _now.month, _now.day - 1).compareTo(
DateTime(this.date.year, this.date.month, this.date.day)) ==
0);
bool get isDoubleYesterday => (DateTime(_now.year, _now.month, _now.day - 2)
.compareTo(DateTime(this.date.year)) ==
bool get isDoubleYesterday =>
(DateTime(_now.year, _now.month, _now.day - 2).compareTo(
DateTime(this.date.year, this.date.month, this.date.day)) ==
0);
String get timeAgo {

@ -15,11 +15,12 @@ import 'package:akuCommunity/constants/api.dart';
class BeeImagePreview extends StatefulWidget {
final File file;
final String path;
BeeImagePreview.file({Key key, @required this.file})
final String tag;
BeeImagePreview.file({Key key, @required this.file, this.tag})
: path = null,
super(key: key);
BeeImagePreview.path({Key key, @required this.path})
BeeImagePreview.path({Key key, @required this.path, this.tag})
: file = null,
super(key: key);
@ -31,7 +32,7 @@ class _BeeImagePreviewState extends State<BeeImagePreview> {
Widget get image {
if (widget.file == null)
return Hero(
tag: widget.path,
tag: widget.tag ?? widget.path,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(widget.path),
@ -39,7 +40,7 @@ class _BeeImagePreviewState extends State<BeeImagePreview> {
);
else
return Hero(
tag: widget.file.hashCode,
tag: widget.tag ?? widget.file.hashCode,
child: Image.file(widget.file),
);
}

Loading…
Cancel
Save