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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save