diff --git a/lib/modules/chat/activity/message_activity_page.dart b/lib/modules/chat/activity/message_activity_page.dart index d83e9e8..64c45ed 100644 --- a/lib/modules/chat/activity/message_activity_page.dart +++ b/lib/modules/chat/activity/message_activity_page.dart @@ -125,7 +125,7 @@ class _MessageActivityPageState extends State { ], ), ) - : mainEmpty(), + : mainEmpty(msg: ''), ), ), ), @@ -261,7 +261,6 @@ class _MessageItem extends StatelessWidget { SizedBox(width: 5.w), ], ), - ], ), ), diff --git a/lib/modules/chat/noti/message_notifcation_page.dart b/lib/modules/chat/noti/message_notifcation_page.dart index d48cd75..63a6d02 100644 --- a/lib/modules/chat/noti/message_notifcation_page.dart +++ b/lib/modules/chat/noti/message_notifcation_page.dart @@ -127,7 +127,7 @@ class _MessageNotifcationPageState extends State { ], ), ) - : mainEmpty(), + : mainEmpty(msg: ''), ), ), ), diff --git a/lib/ui_kit/components/sc_compontent.dart b/lib/ui_kit/components/sc_compontent.dart index 2b70ba1..7fa13d6 100644 --- a/lib/ui_kit/components/sc_compontent.dart +++ b/lib/ui_kit/components/sc_compontent.dart @@ -259,19 +259,21 @@ mainEmpty({ fit: BoxFit.fitWidth, ), ); - list.add(SizedBox(height: height(10.w))); - list.add( - Text( - msg, - style: TextStyle( - fontSize: sp(12), - color: textColor, - fontWeight: FontWeight.w400, - decoration: TextDecoration.none, - height: 1, + if (msg.isNotEmpty) { + list.add(SizedBox(height: height(10.w))); + list.add( + Text( + msg, + style: TextStyle( + fontSize: sp(12), + color: textColor, + fontWeight: FontWeight.w400, + decoration: TextDecoration.none, + height: 1, + ), ), - ), - ); + ); + } return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/ui_kit/widgets/msg/message_conversation_list_page.dart b/lib/ui_kit/widgets/msg/message_conversation_list_page.dart index c79951b..280d7cc 100644 --- a/lib/ui_kit/widgets/msg/message_conversation_list_page.dart +++ b/lib/ui_kit/widgets/msg/message_conversation_list_page.dart @@ -230,8 +230,8 @@ class _MessageConversationListPageState if (chatList.isEmpty) { if (isTop) return Container(); return widget.isRoom - ? mainEmpty() - : mainEmpty(image: const SizedBox.shrink()); + ? mainEmpty(msg: '') + : mainEmpty(msg: '', image: const SizedBox.shrink()); } return Container( margin: margin ?? EdgeInsets.only(bottom: 56.w), diff --git a/lib/ui_kit/widgets/room/room_online_user_widget.dart b/lib/ui_kit/widgets/room/room_online_user_widget.dart index 17a7f88..3bb34c8 100644 --- a/lib/ui_kit/widgets/room/room_online_user_widget.dart +++ b/lib/ui_kit/widgets/room/room_online_user_widget.dart @@ -20,6 +20,15 @@ class RoomOnlineUserWidget extends StatefulWidget { } class _RoomOnlineUserWidgetState extends State { + double get _onlineUsersShellHeight => 27.w; + + double get _onlineUsersAvatarsWidth => 58.w; + + double get _onlineUsersCounterWidth => 18.w; + + double get _onlineUsersShellWidth => + _onlineUsersAvatarsWidth + _onlineUsersCounterWidth; + void _openRoomOnlinePage(RtcProvider ref) { showBottomInBottomDialog( context, @@ -35,96 +44,105 @@ class _RoomOnlineUserWidgetState extends State { children: [ _buildExperience(), SizedBox(width: 15.w), - ref.onlineUsers.isNotEmpty - ? Expanded( - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Spacer(), - GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () => _openRoomOnlinePage(ref), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - SizedBox( - height: 25.w, - child: Stack( - clipBehavior: Clip.none, - children: [ - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - mainAxisSize: MainAxisSize.min, - children: List.generate( - ref.onlineUsers.length, - (index) { - return Transform.translate( - offset: Offset(-3.w * index, 0), - child: Padding( - padding: EdgeInsets.only( - right: 0.w, - ), - child: netImage( - url: - ref - .onlineUsers[index] - .userAvatar ?? - "", - width: 23.w, - height: 23.w, - defaultImg: - SCGlobalConfig - .businessLogicStrategy - .getMePageDefaultAvatarImage(), - shape: BoxShape.circle, - border: Border.all( - color: Colors.white, - width: 1.w, - ), - ), - ), - ); - }, - ), - ), - ), - ], - ), - ), - Container( - padding: EdgeInsets.symmetric( - horizontal: 3.w, - vertical: 3.w, - ), - child: Column( - children: [ - Image.asset( - "sc_images/room/sc_icon_online_peple.png", - width: 12.w, - height: 12.sp, - ), - text( - "${ref.onlineUsers.length}", - fontSize: 9.sp, - ), - ], - ), - ), - ], - ), - ), - SizedBox(width: 5.w), - ], - ), - ) - : Container(), + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: + ref.onlineUsers.isNotEmpty + ? _buildOnlineUsers(ref) + : _buildOnlineUsersPlaceholder(), + ), + ), ], ); }, ); } + Widget _buildOnlineUsers(RtcProvider ref) { + return Padding( + padding: EdgeInsets.only(right: 5.w), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => _openRoomOnlinePage(ref), + child: SizedBox( + width: _onlineUsersShellWidth, + height: _onlineUsersShellHeight, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: _onlineUsersAvatarsWidth, + height: 25.w, + child: Align( + alignment: Alignment.centerRight, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + mainAxisSize: MainAxisSize.min, + children: List.generate(ref.onlineUsers.length, (index) { + return Transform.translate( + offset: Offset(-3.w * index, 0), + child: Padding( + padding: EdgeInsets.only(right: 0.w), + child: netImage( + url: ref.onlineUsers[index].userAvatar ?? "", + width: 23.w, + height: 23.w, + defaultImg: + SCGlobalConfig.businessLogicStrategy + .getMePageDefaultAvatarImage(), + shape: BoxShape.circle, + border: Border.all( + color: Colors.white, + width: 1.w, + ), + ), + ), + ); + }), + ), + ), + ), + ), + SizedBox( + width: _onlineUsersCounterWidth, + child: Container( + padding: EdgeInsets.symmetric(horizontal: 3.w, vertical: 1.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + "sc_images/room/sc_icon_online_peple.png", + width: 12.w, + height: 12.sp, + ), + text( + "${ref.onlineUsers.length}", + fontSize: 9, + lineHeight: 1, + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + } + + Widget _buildOnlineUsersPlaceholder() { + return Padding( + padding: EdgeInsets.only(right: 5.w), + child: SizedBox( + width: _onlineUsersShellWidth, + height: _onlineUsersShellHeight, + ), + ); + } + ///房间榜单入口 _buildExperience() { return Consumer(