Improvements

- InkWell effect on avatar and image messages
This commit is contained in:
Linloir 2022-10-20 14:12:57 +08:00
parent a5d5fe5eef
commit 01f39f0ca8
No known key found for this signature in database
GPG Key ID: 58EEB209A0F2C366
5 changed files with 49 additions and 21 deletions

View File

@ -1,7 +1,7 @@
/* /*
* @Author : Linloir * @Author : Linloir
* @Date : 2022-10-14 17:04:20 * @Date : 2022-10-14 17:04:20
* @LastEditTime : 2022-10-20 11:05:37 * @LastEditTime : 2022-10-20 13:47:29
* @Description : * @Description :
*/ */
@ -20,11 +20,23 @@ class ImageBox extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return IntrinsicWidth(
onTap: (){}, child: IntrinsicHeight(
child: Container( child: Stack(
constraints: const BoxConstraints(maxWidth: 500, maxHeight: 250), children: [
child: history.preCachedImage ?? Image.memory(base64Decode(history.message.contentDecoded)), Container(
constraints: const BoxConstraints(maxWidth: 500, maxHeight: 200),
child: history.preCachedImage ?? Image.memory(base64Decode(history.message.contentDecoded)),
),
Material(
color: Colors.transparent,
child: InkWell(
splashColor: Colors.white.withOpacity(0.1),
onTap: (){},
)
),
]
),
), ),
); );
} }

View File

@ -1,7 +1,7 @@
/* /*
* @Author : Linloir * @Author : Linloir
* @Date : 2022-10-14 13:49:47 * @Date : 2022-10-14 13:49:47
* @LastEditTime : 2022-10-19 23:45:16 * @LastEditTime : 2022-10-20 13:56:20
* @Description : * @Description :
*/ */
@ -75,13 +75,16 @@ class InMessageBox extends StatelessWidget {
) )
), ),
if(history.message.type == MessageType.image) if(history.message.type == MessageType.image)
Text( ...[
_getTimeStamp(history.message.timeStamp), const SizedBox(height: 4.0,),
style: TextStyle( Text(
fontSize: 12, _getTimeStamp(history.message.timeStamp),
color: Colors.grey[400], style: TextStyle(
fontSize: 12,
color: Colors.grey[600],
),
), ),
) ]
] ]
); );
} }

View File

@ -1,7 +1,7 @@
/* /*
* @Author : Linloir * @Author : Linloir
* @Date : 2022-10-13 21:49:53 * @Date : 2022-10-13 21:49:53
* @LastEditTime : 2022-10-20 11:52:12 * @LastEditTime : 2022-10-20 13:46:16
* @Description : * @Description :
*/ */
@ -75,18 +75,23 @@ class UserAvatar extends StatelessWidget {
), ),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(5.0), borderRadius: BorderRadius.circular(5.0),
child: Material( child: Stack(
color: Colors.transparent, fit: StackFit.passthrough,
child: InkWell( children: [
onTap: onTap, OverflowBox(
child: OverflowBox(
alignment: Alignment.center, alignment: Alignment.center,
child: FittedBox( child: FittedBox(
fit: BoxFit.cover, fit: BoxFit.cover,
child: Image.memory(base64.decode(state.userInfo.avatarEncoded!)), child: Image.memory(base64.decode(state.userInfo.avatarEncoded!)),
), ),
) ),
), Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
),
),
],
), ),
), ),
); );

View File

@ -78,6 +78,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2+1" version: "2.0.2+1"
easy_image_viewer:
dependency: "direct main"
description:
name: easy_image_viewer
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
equatable: equatable:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -57,6 +57,7 @@ dependencies:
easy_debounce: ^2.0.2+1 easy_debounce: ^2.0.2+1
path: ^1.8.2 path: ^1.8.2
window_manager: ^0.2.7 window_manager: ^0.2.7
easy_image_viewer: ^1.1.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.