From 7f0c1e2c2e1a266941a326ccd4a6789aedd2a8aa Mon Sep 17 00:00:00 2001 From: laiiihz Date: Thu, 4 Feb 2021 16:11:56 +0800 Subject: [PATCH] =?UTF-8?q?chat=20card=20=E6=B7=BB=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community_views/widgets/chat_card.dart | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index d252d119..b1387436 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -4,6 +4,8 @@ import 'package:akuCommunity/model/common/img_model.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/bee_date_util.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:akuCommunity/widget/picker/bee_image_preview.dart'; +import 'package:akuCommunity/widget/views/bee_grid_image_view.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -54,16 +56,36 @@ class _ChatCardState extends State { _renderImage() { if (widget.contentImg.isEmpty) return SizedBox(); if (widget.contentImg.length == 1) - return ConstrainedBox( - constraints: BoxConstraints( - maxHeight: 300.w, - minWidth: 300.w, + return MaterialButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + padding: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.w), ), - child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: API.image(widget.contentImg.first.url), + onPressed: () { + Get.to( + BeeImagePreview.path(path: widget.contentImg.first.url), + opaque: false, + ); + }, + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: 300.w, + maxWidth: 300.w, + ), + child: Hero( + tag: widget.contentImg.first.url, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: API.image(widget.contentImg.first.url), + ), + ), ), ); + else + return BeeGridImageView( + urls: widget.contentImg.map((e) => e.url).toList()); } _buildMoreButton() { @@ -209,7 +231,12 @@ class _ChatCardState extends State { _renderImage(), Row( children: [ - BeeDateUtil(widget.date).timeAgo.text.make(), + BeeDateUtil(widget.date) + .timeAgo + .text + .size(28.sp) + .color(Color(0xFF999999)) + .make(), _isMyself ? FlatButton( materialTapTargetSize: