修改聊天卡片UI,卡片圈子点击
This commit is contained in:
parent
5a1ffc90e3
commit
ac526afef6
@ -3,6 +3,7 @@ import 'dart:math';
|
||||
|
||||
import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_chat_text_elem.dart';
|
||||
import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitMessageItem/tim_uikit_merger_message_elem.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
@ -402,10 +403,9 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
if (messageItem.customElem?.extension?.contains('cardData') ?? false) {
|
||||
Map info = jsonDecode(messageItem.customElem?.data ?? '');
|
||||
return Container(
|
||||
height: info.containsKey('city') ? 175 : 140,
|
||||
height: info.containsKey('city') ? 175.sp : 135.sp,
|
||||
width: Get.width,
|
||||
|
||||
margin: EdgeInsets.only(left: 20),
|
||||
margin: EdgeInsets.only(left: isFromSelf ? 16 : 0, right: isFromSelf ? 0 : 16),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
@ -415,43 +415,78 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12,right: 12),
|
||||
padding: EdgeInsets.only(left: 12.sp, right: 12.sp),
|
||||
// height: 60,
|
||||
child: Column(
|
||||
children: [
|
||||
if (info.containsKey('city'))
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
margin: EdgeInsets.only(top: 10.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5),width: 3,height: 3,decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.5),color: Color(0xFF00FFF4)),),
|
||||
Text(info['city'],style: TextStyle(color: Colors.white,fontSize: 14,fontWeight: FontWeight.w500),)
|
||||
margin: EdgeInsets.only(right: 5.sp),
|
||||
width: 3.sp,
|
||||
height: 3.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(1.5.sp),
|
||||
color: Color(0xFF00FFF4)),
|
||||
),
|
||||
Text(
|
||||
info['city'],
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
if (info.containsKey('both_interests'))
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 16),
|
||||
margin: EdgeInsets.only(top: 16.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5),width: 3,height: 3,decoration: BoxDecoration(borderRadius: BorderRadius.circular(1.5),color: Color(0xFF00FFF4)),),
|
||||
Text(info['both_interests'],style: TextStyle(color: Colors.white,fontSize: 14,fontWeight: FontWeight.w500),)
|
||||
margin: EdgeInsets.only(right: 5.sp),
|
||||
width: 3,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(1.5),
|
||||
color: Color(0xFF00FFF4)),
|
||||
),
|
||||
Text(
|
||||
info['both_interests'],
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10,bottom: 10),
|
||||
margin: EdgeInsets.only(top: 10.sp, bottom: 10.sp),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(isFromSelf ? info['user']['signature'] : info['my']['signature'],style: TextStyle(color: Colors.white,fontSize: 14,fontWeight: FontWeight.w500),maxLines: 2,overflow: TextOverflow.ellipsis,),
|
||||
child: Text(
|
||||
isFromSelf
|
||||
? info['user']['signature']
|
||||
: info['my']['signature'],
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
getCircleImage('line'),
|
||||
width: Get.width,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
interestWdiget(isFromSelf ? info['interests'] : info['myInterests'])
|
||||
interestWdiget(
|
||||
isFromSelf ? info['interests'] : info['myInterests'])
|
||||
],
|
||||
),
|
||||
)
|
||||
@ -460,7 +495,6 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
return TIMUIKitCustomElem(
|
||||
message: messageItem,
|
||||
customElem: messageItem.customElem,
|
||||
@ -656,7 +690,12 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
itemCount: data.length,
|
||||
padding: EdgeInsets.symmetric(vertical: 11.sp),
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.Signal_circle_list,
|
||||
arguments: data[index]['id']);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 11.sp), // 替换为实际的 item 间距
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
@ -691,6 +730,7 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
),
|
||||
),
|
||||
), // 替换为实际的列表项小部件
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
@ -1114,7 +1154,6 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
context, widget.message, model, theme, details, true, false);
|
||||
},
|
||||
),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -1308,7 +1347,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
children: [
|
||||
if (model.isMultiSelect)
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 12, top: 10, left: isSelf ? 16 : 0),
|
||||
margin:
|
||||
EdgeInsets.only(right: 12, top: 10, left: isSelf ? 16 : 0),
|
||||
child: CheckBoxButton(
|
||||
isChecked: model.multiSelectedMessageList.contains(message),
|
||||
onChanged: (value) {
|
||||
@ -1350,29 +1390,30 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
}
|
||||
}
|
||||
},
|
||||
child:
|
||||
(message.customElem?.extension?.contains('cardData') ?? false) ? _getMessageItemBuilder(message, 1, model) : Row(
|
||||
child: (message.customElem?.extension?.contains('cardData') ??
|
||||
false)
|
||||
? _getMessageItemBuilder(message, 1, model)
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: isSelf
|
||||
? MainAxisAlignment.end
|
||||
: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
|
||||
|
||||
if (!isSelf && widget.showAvatar)
|
||||
InkWell(
|
||||
onLongPress: () {
|
||||
if (widget.onLongPressForOthersHeadPortrait !=
|
||||
null) {}
|
||||
if (model.chatConfig.isAllowLongPressAvatarToAt) {
|
||||
if (model
|
||||
.chatConfig.isAllowLongPressAvatarToAt) {
|
||||
widget.onLongPressForOthersHeadPortrait!(
|
||||
message.sender, message.nickName);
|
||||
}
|
||||
},
|
||||
onTapDown: isDesktopScreen
|
||||
? (details) {
|
||||
if (widget.onTapForOthersPortrait != null &&
|
||||
if (widget.onTapForOthersPortrait !=
|
||||
null &&
|
||||
widget.allowAvatarTap) {
|
||||
widget.onTapForOthersPortrait!(
|
||||
message.sender ?? "", details);
|
||||
@ -1382,17 +1423,22 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
onTap: isDesktopScreen
|
||||
? null
|
||||
: () {
|
||||
if (widget.onTapForOthersPortrait != null &&
|
||||
if (widget.onTapForOthersPortrait !=
|
||||
null &&
|
||||
widget.allowAvatarTap) {
|
||||
widget.onTapForOthersPortrait!(
|
||||
message.sender ?? "", TapDownDetails());
|
||||
message.sender ?? "",
|
||||
TapDownDetails());
|
||||
}
|
||||
},
|
||||
child: widget.userAvatarBuilder != null
|
||||
? widget.userAvatarBuilder!(context, message)
|
||||
? widget.userAvatarBuilder!(
|
||||
context, message)
|
||||
: Container(
|
||||
margin: (isSelf && isShowNickNameForSelf) ||
|
||||
(!isSelf && isShowNickNameForOthers)
|
||||
margin:
|
||||
(isSelf && isShowNickNameForSelf) ||
|
||||
(!isSelf &&
|
||||
isShowNickNameForOthers)
|
||||
? const EdgeInsets.only(top: 2)
|
||||
: null,
|
||||
child: SizedBox(
|
||||
@ -1401,7 +1447,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
child: Avatar(
|
||||
faceUrl: message.faceUrl ?? "",
|
||||
showName:
|
||||
MessageUtils.getDisplayName(message),
|
||||
MessageUtils.getDisplayName(
|
||||
message),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -1420,31 +1467,36 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
if ((isSelf && isShowNickNameForSelf) ||
|
||||
(!isSelf && isShowNickNameForOthers))
|
||||
widget.topRowBuilder != null
|
||||
? widget.topRowBuilder!(context, message)
|
||||
? widget.topRowBuilder!(
|
||||
context, message)
|
||||
: Container(
|
||||
margin: const EdgeInsets.only(bottom: 4),
|
||||
margin: const EdgeInsets.only(
|
||||
bottom: 4),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context)
|
||||
maxWidth:
|
||||
MediaQuery.of(context)
|
||||
.size
|
||||
.width /
|
||||
1.7),
|
||||
child: Text(
|
||||
MessageUtils.getDisplayName(message),
|
||||
MessageUtils.getDisplayName(
|
||||
message),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: widget.themeData
|
||||
?.nickNameTextStyle ??
|
||||
TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.weakTextColor),
|
||||
color: theme
|
||||
.weakTextColor),
|
||||
),
|
||||
)),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
if (isSelf && message.elemType != 2)
|
||||
renderHoverTipAndReadStatus(model, isSelf,
|
||||
message, isPeerRead, theme),
|
||||
renderHoverTipAndReadStatus(model,
|
||||
isSelf, message, isPeerRead, theme),
|
||||
Container(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth * 0.77,
|
||||
@ -1458,18 +1510,22 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: IgnorePointer(
|
||||
ignoring: model.isMultiSelect,
|
||||
child: _getMessageItemBuilder(
|
||||
ignoring:
|
||||
model.isMultiSelect,
|
||||
child:
|
||||
_getMessageItemBuilder(
|
||||
message,
|
||||
message.status,
|
||||
model)),
|
||||
onSecondaryTapDown: (details) {
|
||||
if (widget.onLongPress != null) {
|
||||
if (widget.onLongPress !=
|
||||
null) {
|
||||
widget.onLongPress!(
|
||||
context, message);
|
||||
return;
|
||||
}
|
||||
if (!PlatformUtils().isMobile) {
|
||||
if (!PlatformUtils()
|
||||
.isMobile) {
|
||||
if (widget.allowLongPress) {
|
||||
_onOpenToolTip(
|
||||
context,
|
||||
@ -1483,13 +1539,15 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
if (widget.onLongPress != null) {
|
||||
if (widget.onLongPress !=
|
||||
null) {
|
||||
widget.onLongPress!(
|
||||
context, message);
|
||||
return;
|
||||
}
|
||||
if (widget.allowLongPress &&
|
||||
PlatformUtils().isMobile) {
|
||||
PlatformUtils()
|
||||
.isMobile) {
|
||||
_onOpenToolTip(
|
||||
context,
|
||||
message,
|
||||
@ -1508,9 +1566,10 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
message: message,
|
||||
isUseDefaultEmoji:
|
||||
widget.isUseDefaultEmoji,
|
||||
customEmojiStickerList:
|
||||
widget.customEmojiStickerList,
|
||||
isFromSelf: message.isSelf ?? true,
|
||||
customEmojiStickerList: widget
|
||||
.customEmojiStickerList,
|
||||
isFromSelf:
|
||||
message.isSelf ?? true,
|
||||
isShowJump: false,
|
||||
clearJump: () {},
|
||||
chatModel: model)
|
||||
@ -1520,7 +1579,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
),
|
||||
if (!isSelf &&
|
||||
message.elemType ==
|
||||
MessageElemType.V2TIM_ELEM_TYPE_SOUND &&
|
||||
MessageElemType
|
||||
.V2TIM_ELEM_TYPE_SOUND &&
|
||||
message.localCustomInt != null &&
|
||||
message.localCustomInt !=
|
||||
HistoryMessageDartConstant.read)
|
||||
@ -1528,10 +1588,11 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5, bottom: 12),
|
||||
child: Icon(Icons.circle,
|
||||
color: theme.cautionColor, size: 10)),
|
||||
color: theme.cautionColor,
|
||||
size: 10)),
|
||||
if (!isSelf && message.elemType != 2)
|
||||
renderHoverTipAndReadStatus(model, isSelf,
|
||||
message, isPeerRead, theme),
|
||||
renderHoverTipAndReadStatus(model,
|
||||
isSelf, message, isPeerRead, theme),
|
||||
],
|
||||
),
|
||||
if (widget.bottomRowBuilder != null)
|
||||
@ -1539,7 +1600,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
],
|
||||
),
|
||||
),
|
||||
if (widget.message.elemType == 6 && isDownloadWaiting)
|
||||
if (widget.message.elemType == 6 &&
|
||||
isDownloadWaiting)
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 24, left: 6),
|
||||
child: LoadingAnimationWidget.threeArchedCircle(
|
||||
@ -1547,7 +1609,9 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
if (isSelf && widget.showAvatar && message.elemType != 2)
|
||||
if (isSelf &&
|
||||
widget.showAvatar &&
|
||||
message.elemType != 2)
|
||||
widget.userAvatarBuilder != null
|
||||
? widget.userAvatarBuilder!(context, message)
|
||||
: SizedBox(
|
||||
@ -1555,7 +1619,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
height: 40,
|
||||
child: InkWell(
|
||||
onTapDown: (details) {
|
||||
if (widget.onTapForOthersPortrait != null &&
|
||||
if (widget.onTapForOthersPortrait !=
|
||||
null &&
|
||||
widget.allowAvatarTap) {
|
||||
widget.onTapForOthersPortrait!(
|
||||
message.sender ?? "", details);
|
||||
@ -1564,7 +1629,8 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
child: Avatar(
|
||||
faceUrl: message.faceUrl ?? "",
|
||||
showName:
|
||||
MessageUtils.getDisplayName(message)),
|
||||
MessageUtils.getDisplayName(
|
||||
message)),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,7 +1,44 @@
|
||||
import 'package:circle_app/app/circle/logic.dart';
|
||||
import 'package:circle_app/network/api.dart';
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'state.dart';
|
||||
|
||||
class Signal_circle_listLogic extends GetxController {
|
||||
final Signal_circle_listState state = Signal_circle_listState();
|
||||
|
||||
Circle? circle;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
loadData();
|
||||
}
|
||||
|
||||
void loadData() async {
|
||||
var data = await DioManager.instance
|
||||
.get(url: 'up-service/interest/${Get.arguments}');
|
||||
if (data['code'] == 200) {
|
||||
circle = Circle.fromJson(data['data']);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
outCircle(String interest_id, bool isStatus) async {
|
||||
var data = await DioManager.instance.post(
|
||||
url: Api.outCrrcle + interest_id + "/join",
|
||||
params: {"status": isStatus ? "0" : "1"});
|
||||
var bean = BaseResponse<String>.fromJson(data, (data) => data);
|
||||
if (bean.code == 200) {
|
||||
|
||||
circle!.isJoin = !isStatus;
|
||||
update();
|
||||
|
||||
}
|
||||
showToast(bean.msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:circle_app/app/circle/widgets/info_list_view.dart';
|
||||
import 'package:circle_app/components/my_app_bar.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
@ -15,7 +16,6 @@ class Signal_circle_listPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
@ -24,34 +24,32 @@ class Signal_circle_listPage extends StatelessWidget {
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
image: AssetImage(getBaseImage('home_back')))),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SafeArea(
|
||||
child: GetBuilder(builder: (Signal_circle_listLogic controller) {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: logic.circle?.title ?? '',
|
||||
),
|
||||
body: Container(
|
||||
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Column(children: [
|
||||
backNavigatorItem(),
|
||||
// backNavigatorItem(),
|
||||
// Text(controller.state.msg),
|
||||
//组件使用
|
||||
// Expanded(
|
||||
// child: InfoListView(0, Circle(id: Get.arguments['id']), controller));
|
||||
Expanded(
|
||||
child: controller.circle == null
|
||||
? loaddingWidget(true)
|
||||
: InfoListView(0, controller.circle!, controller))
|
||||
]),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
backNavigatorItem() {
|
||||
return MyAppBar(
|
||||
centerTitle: Get.arguments['title'],
|
||||
);
|
||||
}));
|
||||
}
|
||||
//
|
||||
// backNavigatorItem() {
|
||||
// return MyAppBar(
|
||||
// centerTitle: ,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
|
||||
@ -44,6 +44,8 @@ import 'package:circle_app/app/setup/binding.dart';
|
||||
import 'package:circle_app/app/setup/view.dart';
|
||||
import 'package:circle_app/app/login/complete_material/binding.dart';
|
||||
import 'package:circle_app/app/login/complete_material/view.dart';
|
||||
import 'package:circle_app/app/signal_circle_list/binding.dart';
|
||||
import 'package:circle_app/app/signal_circle_list/view.dart';
|
||||
import 'package:circle_app/app/splash/binding.dart';
|
||||
import 'package:circle_app/app/swiper/binding.dart';
|
||||
import 'package:circle_app/app/swiper/view.dart';
|
||||
@ -207,5 +209,11 @@ class AppPages {
|
||||
page: () => PrivacyPage(),
|
||||
binding: PrivacyBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: AppRoutes.Signal_circle_list,
|
||||
page: () => Signal_circle_listPage(),
|
||||
binding: Signal_circle_listBinding(),
|
||||
),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -32,6 +32,8 @@ abstract class AppRoutes {
|
||||
|
||||
static const PrivacyActivity = '/user/PrivacyActivity';
|
||||
|
||||
static const Signal_circle_list = '/msg/chat/signal_circle_list';
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user