速聊推荐,聊天打招呼,分享圈子,许愿功能
This commit is contained in:
parent
fcaf64a6f7
commit
b9664e13a8
BIN
circle_app/assets/images/home/im_more.png
Normal file
BIN
circle_app/assets/images/home/im_more.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 850 B |
BIN
circle_app/assets/images/msg/hello.png
Normal file
BIN
circle_app/assets/images/msg/hello.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
BIN
circle_app/assets/images/msg/share_circle.png
Normal file
BIN
circle_app/assets/images/msg/share_circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
circle_app/assets/images/msg/wish.png
Normal file
BIN
circle_app/assets/images/msg/wish.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
40
circle_app/ios/Info.plist
Normal file
40
circle_app/ios/Info.plist
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>weixin</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>wxab2387c2198f01e1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
<array>
|
||||
<string>weixinULAPI</string>
|
||||
<string>weixin</string>
|
||||
<string>wechat</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -4,7 +4,9 @@ import 'dart:math';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
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/app/chat/widget/chat_msg_invent_wish_item.dart';
|
||||
import 'package:circle_app/app/chat/widget/chat_msg_partner_item.dart';
|
||||
import 'package:circle_app/app/chat/widget/chat_msg_wish_info_item.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@ -46,6 +48,7 @@ import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart';
|
||||
|
||||
import '../../../../common/Widgets/text_more.dart';
|
||||
import '../../../circle/logic.dart';
|
||||
import '../../widget/chat_msg_get_gift_item.dart';
|
||||
import '../TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_chat_gift_elem.dart';
|
||||
import '../TIMUIKitMessageItem/TIMUIKitMessageReaction/tim_uikit_message_reaction_select_emoji.dart';
|
||||
|
||||
@ -425,6 +428,18 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
);
|
||||
}
|
||||
|
||||
if (messageItem.customElem?.extension?.contains('getGiftData') ?? false) {
|
||||
return ChatMsgGetGiftItem(messageItem);
|
||||
}
|
||||
|
||||
if (messageItem.customElem?.extension?.contains('getInventWishData') ?? false) {
|
||||
return ChatMsgInventWishItem(messageItem);
|
||||
}
|
||||
|
||||
if (messageItem.customElem?.extension?.contains('getWishData') ?? false) {
|
||||
return ChatMsgWishInfoItem(messageItem);
|
||||
}
|
||||
|
||||
if (messageItem.customElem?.extension?.contains('sendVip') ?? false) {
|
||||
return ChatMsgPartnerItem(messageItem);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:circle_app/network/api.dart';
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:diff_match_patch/diff_match_patch.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_setting_model.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/friendShip/friendship_services.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart';
|
||||
@ -28,6 +29,7 @@ import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField
|
||||
import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitChat/TIMUIKitTextField/tim_uikit_text_field_layout/wide.dart';
|
||||
|
||||
import '../../../../common/Widgets/open_vip_tip/view.dart';
|
||||
import '../../../../util/eventBus.dart';
|
||||
|
||||
enum MuteStatus { none, me, all }
|
||||
@ -126,6 +128,7 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
|
||||
String languageType = "";
|
||||
int? currentCursor;
|
||||
bool isAddingAtSearchWords = false;
|
||||
bool imStatusOK = false;
|
||||
double inputWidth = 900;
|
||||
|
||||
String hintText = '说些什么吧~';
|
||||
@ -260,15 +263,49 @@ class _InputTextFieldState extends TIMUIKitState<TIMInputTextField> {
|
||||
|
||||
return userList;
|
||||
}
|
||||
bool isSendLoging = false;
|
||||
|
||||
Future checkImStatus() async {
|
||||
var data =
|
||||
await DioManager.instance.get(url: Api.imstate);
|
||||
|
||||
int code = data['code'];
|
||||
if (code == 200) {
|
||||
imStatusOK = true;
|
||||
} else {
|
||||
if (code == 21201) {
|
||||
Get.bottomSheet(
|
||||
Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Open_vip_tipPage(true),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
enableDrag: false);
|
||||
}
|
||||
showOKToast(data['msg']);
|
||||
imStatusOK = false;
|
||||
}
|
||||
return imStatusOK;
|
||||
}
|
||||
|
||||
|
||||
bool isSendLoging = false;
|
||||
onSubmitted() async {
|
||||
if(isSendLoging){
|
||||
if (isSendLoging) {
|
||||
return;
|
||||
}
|
||||
if (isBlack) {
|
||||
showOKToast("您已将对方拉黑,请移除黑名单后在发送消息~");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool isOK = await checkImStatus();
|
||||
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
lastText = "";
|
||||
String text = textEditingController.text.trim();
|
||||
final convType = widget.conversationType;
|
||||
@ -312,7 +349,6 @@ bool isSendLoging = false;
|
||||
}
|
||||
|
||||
if (text.isNotEmpty && text != zeroWidthSpace) {
|
||||
|
||||
if (widget.model.repliedMessage != null) {
|
||||
MessageUtils.handleMessageError(
|
||||
widget.model.sendReplyMessage(
|
||||
@ -345,14 +381,15 @@ bool isSendLoging = false;
|
||||
if (words.isEmpty) {
|
||||
MessageUtils.handleMessageError(
|
||||
widget.model.sendTextMessage(
|
||||
text: text, convID: widget.conversationID, convType: convType),
|
||||
text: text,
|
||||
convID: widget.conversationID,
|
||||
convType: convType),
|
||||
context);
|
||||
} else {
|
||||
textEditingController.text = text;
|
||||
showOKToast('含违规词汇,无法发送');
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
textEditingController.clear();
|
||||
currentCursor = null;
|
||||
@ -420,7 +457,7 @@ bool isSendLoging = false;
|
||||
affinity: TextAffinity.downstream,
|
||||
offset: widget.model.editRevokedMsg.length));
|
||||
widget.model.editRevokedMsg = "";
|
||||
Future.delayed(Duration(milliseconds: 300),() {
|
||||
Future.delayed(Duration(milliseconds: 300), () {
|
||||
focusNode.requestFocus();
|
||||
});
|
||||
}
|
||||
@ -736,19 +773,18 @@ bool isSendLoging = false;
|
||||
(appLocale == AppLocale.zhHans || appLocale == AppLocale.zhHant)
|
||||
? 'zh'
|
||||
: 'en';
|
||||
if(null==commentBlackEvent){
|
||||
commentBlackEvent = EventBusManager.on<CommentBlackEvent>().listen((event) {
|
||||
if(event.userId == widget.currentConversation.userID!){
|
||||
if (null == commentBlackEvent) {
|
||||
commentBlackEvent =
|
||||
EventBusManager.on<CommentBlackEvent>().listen((event) {
|
||||
if (event.userId == widget.currentConversation.userID!) {
|
||||
isBlack = event.isBlack;
|
||||
}
|
||||
});
|
||||
getBlack();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
StreamSubscription? commentBlackEvent =null;
|
||||
|
||||
StreamSubscription? commentBlackEvent = null;
|
||||
bool isBlack = false;
|
||||
|
||||
getBlack() async {
|
||||
@ -768,9 +804,6 @@ bool isSendLoging = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void didUpdateWidget(TIMInputTextField oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
@ -782,7 +815,6 @@ bool isSendLoging = false;
|
||||
textEditingController.clear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
@ -790,12 +822,11 @@ bool isSendLoging = false;
|
||||
// handleSetDraftText();
|
||||
widget.model.removeListener(onModelChanged);
|
||||
focusNode.dispose();
|
||||
if(null!=commentBlackEvent){
|
||||
if (null != commentBlackEvent) {
|
||||
print("TIMInputTextField解绑");
|
||||
EventBusManager.cancelSubscription(commentBlackEvent!);
|
||||
}
|
||||
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -903,7 +934,6 @@ bool isSendLoging = false;
|
||||
addStickerToText: addStickerToText,
|
||||
customStickerPanel: widget.customStickerPanel,
|
||||
forbiddenText: forbiddenText,
|
||||
|
||||
onChanged: (text) async {
|
||||
if (widget.onChanged != null) {
|
||||
widget.onChanged!(text);
|
||||
|
||||
@ -5,8 +5,11 @@ import 'dart:math';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:circle_app/app/chat/TIMUIKitChat/TIMUIKitTextField/tim_uikit_send_sound_message.dart';
|
||||
import 'package:circle_app/app/chat/widget/send_gift_dialog.dart';
|
||||
import 'package:circle_app/app/chat/widget/wish_dialog.dart';
|
||||
import 'package:circle_app/app/minefragment/logic.dart';
|
||||
import 'package:circle_app/common/Widgets/open_vip_tip/view.dart';
|
||||
import 'package:circle_app/common/colors/app_color.dart';
|
||||
import 'package:circle_app/network/api.dart';
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
@ -38,6 +41,7 @@ import 'package:video_thumbnail/video_thumbnail.dart';
|
||||
|
||||
import '../../../../../util/eventBus.dart';
|
||||
import '../../../../call_out/logic.dart';
|
||||
import '../../../widget/chat_circle_share_dialog.dart';
|
||||
import '../../../widget/chat_gift_pannel.dart';
|
||||
|
||||
GlobalKey<_TIMTextFieldLayoutNarrowState> TIMnarrowTextFieldKey = GlobalKey();
|
||||
@ -158,11 +162,13 @@ class TIMTextFieldLayoutNarrow extends StatefulWidget {
|
||||
|
||||
class _TIMTextFieldLayoutNarrowState
|
||||
extends TIMUIKitState<TIMTextFieldLayoutNarrow> {
|
||||
|
||||
final TUISettingModel settingModel = serviceLocator<TUISettingModel>();
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
|
||||
bool isVip = false;
|
||||
|
||||
bool imStatusOK = false;
|
||||
|
||||
bool showMore = false;
|
||||
bool showMoreButton = true;
|
||||
bool showSendSoundText = false;
|
||||
@ -465,9 +471,9 @@ class _TIMTextFieldLayoutNarrowState
|
||||
_buildRepliedMessage(widget.repliedMessage),
|
||||
Stack(
|
||||
children: [
|
||||
|
||||
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: showKeyboard || showEmojiPanel ? 0 : 50.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(
|
||||
@ -481,7 +487,7 @@ class _TIMTextFieldLayoutNarrowState
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 8, horizontal: 12.sp),
|
||||
EdgeInsets.symmetric(vertical: 8, horizontal: 12.sp),
|
||||
constraints: const BoxConstraints(minHeight: 30),
|
||||
child: Row(
|
||||
children: [
|
||||
@ -556,7 +562,7 @@ class _TIMTextFieldLayoutNarrowState
|
||||
});
|
||||
} else {
|
||||
var data =
|
||||
await Permission.microphone.request();
|
||||
await Permission.microphone.request();
|
||||
if (data.isGranted) {
|
||||
setState(() {
|
||||
showEmojiPanel = false;
|
||||
@ -577,7 +583,9 @@ class _TIMTextFieldLayoutNarrowState
|
||||
width: 25.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.sp,),
|
||||
SizedBox(
|
||||
width: 10.sp,
|
||||
),
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
@ -587,103 +595,102 @@ class _TIMTextFieldLayoutNarrowState
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8, horizontal: 12.sp),
|
||||
constraints:
|
||||
const BoxConstraints(minHeight: 30),
|
||||
const BoxConstraints(minHeight: 30),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x1AFFFFFF),
|
||||
borderRadius: BorderRadius.circular(26.sp),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
|
||||
if (widget.forbiddenText == null)
|
||||
Expanded(
|
||||
child: showSendSoundText
|
||||
? TIMSendSoundMessage(
|
||||
onDownBottom:
|
||||
widget.goDownBottom,
|
||||
conversationID:
|
||||
widget.conversationID,
|
||||
conversationType:
|
||||
widget.conversationType)
|
||||
onDownBottom:
|
||||
widget.goDownBottom,
|
||||
conversationID:
|
||||
widget.conversationID,
|
||||
conversationType:
|
||||
widget.conversationType)
|
||||
: KeyboardVisibility(
|
||||
child: ExtendedTextField(
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp),
|
||||
maxLines: 4,
|
||||
minLines: 1,
|
||||
focusNode: widget.focusNode,
|
||||
onChanged: debounceFunc,
|
||||
onTap: () {
|
||||
showKeyboard = true;
|
||||
widget.goDownBottom();
|
||||
setState(() {
|
||||
showEmojiPanel = false;
|
||||
showMore = false;
|
||||
});
|
||||
},
|
||||
keyboardType:
|
||||
TextInputType.multiline,
|
||||
textInputAction:
|
||||
PlatformUtils()
|
||||
.isAndroid
|
||||
? TextInputAction
|
||||
.newline
|
||||
: TextInputAction
|
||||
.send,
|
||||
onEditingComplete: () {
|
||||
widget.onSubmitted();
|
||||
if (showKeyboard) {
|
||||
widget.focusNode
|
||||
.requestFocus();
|
||||
child: ExtendedTextField(
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp),
|
||||
maxLines: 4,
|
||||
minLines: 1,
|
||||
focusNode: widget.focusNode,
|
||||
onChanged: debounceFunc,
|
||||
onTap: () {
|
||||
showKeyboard = true;
|
||||
widget.goDownBottom();
|
||||
setState(() {
|
||||
showEmojiPanel = false;
|
||||
showMore = false;
|
||||
});
|
||||
},
|
||||
keyboardType:
|
||||
TextInputType.multiline,
|
||||
textInputAction:
|
||||
PlatformUtils()
|
||||
.isAndroid
|
||||
? TextInputAction
|
||||
.newline
|
||||
: TextInputAction
|
||||
.send,
|
||||
onEditingComplete: () {
|
||||
widget.onSubmitted();
|
||||
if (showKeyboard) {
|
||||
widget.focusNode
|
||||
.requestFocus();
|
||||
}
|
||||
setState(() {
|
||||
if (widget
|
||||
.textEditingController
|
||||
.text
|
||||
.isEmpty) {
|
||||
showMoreButton = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
textAlignVertical:
|
||||
TextAlignVertical.top,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color:
|
||||
Color(0xB3FFFFFF),
|
||||
),
|
||||
hintText: widget.hintText,
|
||||
fillColor:
|
||||
Colors.transparent,
|
||||
filled: true,
|
||||
isDense: true,
|
||||
),
|
||||
controller: widget
|
||||
.textEditingController,
|
||||
specialTextSpanBuilder:
|
||||
PlatformUtils().isWeb
|
||||
? null
|
||||
: DefaultSpecialTextSpanBuilder(
|
||||
isUseDefaultEmoji:
|
||||
widget
|
||||
.isUseDefaultEmoji,
|
||||
customEmojiStickerList:
|
||||
widget
|
||||
.customEmojiStickerList,
|
||||
showAtBackground:
|
||||
true,
|
||||
)),
|
||||
onChanged: (bool visibility) {
|
||||
if (showKeyboard !=
|
||||
visibility) {
|
||||
setState(() {
|
||||
showKeyboard = visibility;
|
||||
});
|
||||
}
|
||||
setState(() {
|
||||
if (widget
|
||||
.textEditingController
|
||||
.text
|
||||
.isEmpty) {
|
||||
showMoreButton = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
textAlignVertical:
|
||||
TextAlignVertical.top,
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14.sp,
|
||||
color:
|
||||
Color(0xB3FFFFFF),
|
||||
),
|
||||
hintText: widget.hintText,
|
||||
fillColor:
|
||||
Colors.transparent,
|
||||
filled: true,
|
||||
isDense: true,
|
||||
),
|
||||
controller: widget
|
||||
.textEditingController,
|
||||
specialTextSpanBuilder:
|
||||
PlatformUtils().isWeb
|
||||
? null
|
||||
: DefaultSpecialTextSpanBuilder(
|
||||
isUseDefaultEmoji:
|
||||
widget
|
||||
.isUseDefaultEmoji,
|
||||
customEmojiStickerList:
|
||||
widget
|
||||
.customEmojiStickerList,
|
||||
showAtBackground:
|
||||
true,
|
||||
)),
|
||||
onChanged: (bool visibility) {
|
||||
if (showKeyboard !=
|
||||
visibility) {
|
||||
setState(() {
|
||||
showKeyboard = visibility;
|
||||
});
|
||||
}
|
||||
}),
|
||||
}),
|
||||
),
|
||||
if (widget.forbiddenText == null)
|
||||
const SizedBox(
|
||||
@ -704,7 +711,6 @@ class _TIMTextFieldLayoutNarrowState
|
||||
),
|
||||
],
|
||||
)),
|
||||
|
||||
],
|
||||
),
|
||||
if (widget.forbiddenText == null)
|
||||
@ -735,11 +741,15 @@ class _TIMTextFieldLayoutNarrowState
|
||||
Container(
|
||||
height: 40.sp,
|
||||
width: Get.width,
|
||||
margin: EdgeInsets.only(bottom: showEmojiPanel ? Platform.isIOS ? 0.sp : 10.sp : 0),
|
||||
margin: EdgeInsets.only(
|
||||
bottom: showEmojiPanel
|
||||
? Platform.isIOS
|
||||
? 0.sp
|
||||
: 10.sp
|
||||
: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (isBlack) {
|
||||
@ -749,7 +759,7 @@ class _TIMTextFieldLayoutNarrowState
|
||||
getImageFile();
|
||||
},
|
||||
child:
|
||||
Image.asset(getMsgImage('photo'), width: 40.sp),
|
||||
Image.asset(getMsgImage('photo'), width: 40.sp),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
@ -803,9 +813,9 @@ class _TIMTextFieldLayoutNarrowState
|
||||
AnimatedContainer(
|
||||
duration: Duration(
|
||||
milliseconds:
|
||||
(showKeyboard && PlatformUtils().isAndroid)
|
||||
? 200
|
||||
: 340),
|
||||
(showKeyboard && PlatformUtils().isAndroid)
|
||||
? 200
|
||||
: 340),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
height: max(_getBottomHeight(), 0.0),
|
||||
// child: ListView(
|
||||
@ -817,7 +827,7 @@ class _TIMTextFieldLayoutNarrowState
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom:0,
|
||||
bottom: 0,
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(
|
||||
milliseconds: (showKeyboard && PlatformUtils().isAndroid)
|
||||
@ -832,12 +842,106 @@ class _TIMTextFieldLayoutNarrowState
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!showKeyboard && !showEmojiPanel)
|
||||
Positioned(
|
||||
top: 0,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10.sp, right: 10.sp),
|
||||
height: 50.sp,
|
||||
width: Get.width,
|
||||
child: Row(
|
||||
children: [
|
||||
chatActionWidget('hello', '打招呼', () async {
|
||||
var reulst = await DioManager.instance.get(url: Api.msgRandOne);
|
||||
String text = reulst['data'];
|
||||
var result = await widget.model.sendTextMessage(
|
||||
text: text, convID: widget.conversationID, convType: ConvType.c2c);
|
||||
}),
|
||||
chatActionWidget('wish', '许个愿', () {
|
||||
Get.bottomSheet(
|
||||
WishDialog(
|
||||
accId: widget.userId!,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
enableDrag: false);
|
||||
}),
|
||||
chatActionWidget('share_circle', '分享圈子', () {
|
||||
Get.bottomSheet(
|
||||
ChatCircleShareDialog(
|
||||
accId: widget.userId!,
|
||||
),
|
||||
isScrollControlled: true,
|
||||
enableDrag: false);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
chatActionWidget(String img, String action, GestureTapCallback onTap) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 80.sp,
|
||||
height: 28.sp,
|
||||
margin: EdgeInsets.only(right: 4.sp),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
borderRadius: BorderRadius.circular(14.sp)),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF423055),
|
||||
borderRadius: BorderRadius.circular(14.sp)),
|
||||
margin: EdgeInsets.all(1.sp),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
getMsgImage(img),
|
||||
width: 20.sp,
|
||||
),
|
||||
SizedBox(
|
||||
width: 2.sp,
|
||||
),
|
||||
Text(
|
||||
action,
|
||||
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future checkImStatus() async {
|
||||
var data = await DioManager.instance.get(url: Api.imstate);
|
||||
|
||||
int code = data['code'];
|
||||
if (code == 200) {
|
||||
imStatusOK = true;
|
||||
} else {
|
||||
if (code == 21201) {
|
||||
Get.bottomSheet(
|
||||
Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Open_vip_tipPage(true),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
enableDrag: false);
|
||||
}
|
||||
showOKToast(data['msg']);
|
||||
imStatusOK = false;
|
||||
}
|
||||
return imStatusOK;
|
||||
}
|
||||
|
||||
Future checkVipStatus(int plate) async {
|
||||
var data =
|
||||
await DioManager.instance.get(url: Api.getIsVips + plate.toString());
|
||||
@ -871,6 +975,12 @@ class _TIMTextFieldLayoutNarrowState
|
||||
return;
|
||||
}
|
||||
|
||||
isOK = await checkImStatus();
|
||||
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
|
||||
await requestStoragePermission();
|
||||
|
||||
XFile? pickedFile;
|
||||
@ -878,8 +988,7 @@ class _TIMTextFieldLayoutNarrowState
|
||||
|
||||
try {
|
||||
pickedFile = await _picker.pickVideo(
|
||||
source: imageSource, maxDuration: const Duration(seconds: 30)
|
||||
);
|
||||
source: imageSource, maxDuration: const Duration(seconds: 30));
|
||||
if (pickedFile == null) {
|
||||
return;
|
||||
}
|
||||
@ -947,6 +1056,11 @@ class _TIMTextFieldLayoutNarrowState
|
||||
|
||||
Future getImageFile() async {
|
||||
bool isOK = await checkVipStatus(3);
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
isOK = await checkImStatus();
|
||||
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
@ -973,12 +1087,17 @@ class _TIMTextFieldLayoutNarrowState
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
await requestStoragePermission();
|
||||
isOK = await checkImStatus();
|
||||
|
||||
if (!isOK) {
|
||||
return;
|
||||
}
|
||||
await requestStoragePermission();
|
||||
try {
|
||||
final XFile? pickedFile = await _picker.pickImage(
|
||||
source: ImageSource.camera,
|
||||
);
|
||||
if(null==pickedFile){
|
||||
if (null == pickedFile) {
|
||||
return;
|
||||
}
|
||||
widget.model.sendImageMessage(
|
||||
@ -1005,7 +1124,6 @@ class _TIMTextFieldLayoutNarrowState
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_handleCameraAndMic() async {
|
||||
// // 请求权限
|
||||
// Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions(
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/app/chat/TIMUIKitChat/tim_uikit_chat.dart';
|
||||
import 'package:circle_app/app/chat/widget/send_gift_dialog.dart';
|
||||
import 'package:circle_app/app/minefragment/logic.dart';
|
||||
import 'package:circle_app/components/my_app_bar.dart';
|
||||
import 'package:circle_app/main.dart';
|
||||
@ -58,6 +59,7 @@ class _ChatPageState extends State<ChatPage> {
|
||||
messageInfo: event.createCustomMessageRes?.data?.messageInfo);
|
||||
if (sendMessageRes!.code == 0) {
|
||||
// 发送成功
|
||||
showOKToast('发送成功');
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
@ -168,7 +170,7 @@ class _ChatPageState extends State<ChatPage> {
|
||||
],
|
||||
),
|
||||
customAppBar:MyAppBar(
|
||||
centerTitle: con.showName != null ? con.showName! : '',
|
||||
centerTitle: con != null ? con.showName! : '',
|
||||
actionWdiget: GestureDetector(
|
||||
onTap: () async{
|
||||
var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: con.userID.toString().split('_').last,preventDuplicates: false);
|
||||
|
||||
215
circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart
Normal file
215
circle_app/lib/app/chat/widget/chat_circle_share_dialog.dart
Normal file
@ -0,0 +1,215 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../network/api.dart';
|
||||
import '../../../network/dio_manager.dart';
|
||||
import '../../../util/util.dart';
|
||||
import '../../circle/logic.dart';
|
||||
|
||||
class ChatCircleShareDialog extends StatefulWidget {
|
||||
String accId;
|
||||
ChatCircleShareDialog({super.key,required this.accId});
|
||||
|
||||
|
||||
@override
|
||||
_ChatCircleShareDialogState createState() =>
|
||||
new _ChatCircleShareDialogState();
|
||||
|
||||
}
|
||||
|
||||
class _ChatCircleShareDialogState extends State<ChatCircleShareDialog> {
|
||||
// TODO: add state variables and methods
|
||||
|
||||
int page = 1;
|
||||
bool isMore = true;
|
||||
InterestsBean circle = InterestsBean(lists: []);
|
||||
ScrollController scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
scrollController.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
scrollController.addListener(() {
|
||||
if (scrollController.position.pixels ==
|
||||
scrollController.position.maxScrollExtent) {
|
||||
if (isMore) {
|
||||
page = page + 1;
|
||||
loadData();
|
||||
}
|
||||
}
|
||||
});
|
||||
loadData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
loadData() async {
|
||||
var data = await DioManager.instance
|
||||
.get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20});
|
||||
|
||||
var bean = BaseResponse<InterestsBean>.fromJson(
|
||||
data, (data) => InterestsBean.fromJson(data));
|
||||
|
||||
circle = bean.data!;
|
||||
if (circle.lists.length < 20) {
|
||||
isMore = false;
|
||||
}
|
||||
setState(() {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: add widget build method
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(child: Container()),
|
||||
Container(
|
||||
height:Get.height * 0.5,
|
||||
color: Color(0xFF423055),
|
||||
child: circle.lists.isEmpty
|
||||
? !isMore
|
||||
? noResultWidget()
|
||||
: loaddingWidget(isMore)
|
||||
: ListView.builder(
|
||||
controller: scrollController,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == circle.lists.length) {
|
||||
return loaddingWidget(isMore);
|
||||
}
|
||||
var bean = circle.lists[index];
|
||||
|
||||
return circleInfoItemWidget(
|
||||
circle.lists[index]);
|
||||
},
|
||||
itemCount: circle.lists.length + 1,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
circleInfoItemWidget(Circle bean) {
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 10.sp, left: 10.sp, right: 10.sp),
|
||||
child: Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 12.sp, right: 12.sp),
|
||||
height: 72.sp,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
image: AssetImage(getCircleImage('top_circle_bg')))),
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: 42.sp,
|
||||
height: 42.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color(0xFF71F3F2),
|
||||
Color(0xFFF558FF),
|
||||
],
|
||||
stops: [0.0365, 0.9427],
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(1.sp),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: bean.image,
|
||||
width: 40.sp,
|
||||
height: 40.sp,
|
||||
memCacheHeight: 40,
|
||||
memCacheWidth: 40,
|
||||
fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 8.sp, top: 12.sp),
|
||||
// alignment: Alignment.,
|
||||
height: 72.sp,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
bean.title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
'${convertToTenThousand(bean.viewTotal)}人看过',
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff03FEFB),
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
GestureDetector(
|
||||
//分享圈子
|
||||
onTap: () async {
|
||||
sendCircleCustomMsg(widget.accId, jsonEncode(bean.toJson()), '分享[${bean.title}]');
|
||||
},
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
getCircleImage('add'),
|
||||
width: 77.sp,
|
||||
),
|
||||
Text(
|
||||
'立即分享',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 12.sp),
|
||||
)
|
||||
],
|
||||
))
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -13,8 +13,9 @@ import 'partner_option.dart';
|
||||
|
||||
class ChatGiftPannel extends StatefulWidget {
|
||||
String accid;
|
||||
String giftId;
|
||||
int selectedIndex;
|
||||
ChatGiftPannel({Key? key,required this.accid,this.selectedIndex = 0}) : super(key: key);
|
||||
ChatGiftPannel({Key? key,required this.accid,this.selectedIndex = 0, this.giftId = ''}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _ChatGiftPannelState();
|
||||
@ -142,7 +143,7 @@ class _ChatGiftPannelState extends State<ChatGiftPannel>
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: [
|
||||
Gift(widget.accid,),
|
||||
Gift(widget.accid,widget.giftId),
|
||||
PartnerOption(accid: widget.accid),
|
||||
],
|
||||
))
|
||||
|
||||
115
circle_app/lib/app/chat/widget/chat_msg_get_gift_item.dart
Normal file
115
circle_app/lib/app/chat/widget/chat_msg_get_gift_item.dart
Normal file
@ -0,0 +1,115 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/common/colors/app_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
import 'chat_gift_pannel.dart';
|
||||
|
||||
class ChatMsgGetGiftItem extends StatelessWidget {
|
||||
V2TimMessage message;
|
||||
// TODO: add state variables, methods and constructor params
|
||||
ChatMsgGetGiftItem(this.message);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Map<String, dynamic> giftData = jsonDecode(message.customElem!.data!);
|
||||
double price = giftData['price'];
|
||||
// "msg" -> "{\"giftImageUrl\":\"http://qiniuyun.ikuayou.com/live/gifts/2.png\",\"giftName\":\"舔狗楷模\",\"gmtNotice\":\"2023-0..."
|
||||
// TODO: add widget build method
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (!(message.isSelf ?? false)) {
|
||||
showGiftPannel();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 203.sp,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 80.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
borderRadius: BorderRadius.circular(8.sp)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 10.sp),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: giftData['icon'],
|
||||
width: 60.sp,
|
||||
height: 60.sp,
|
||||
)),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
// alignment: Alignment.center,
|
||||
child: Text(
|
||||
'求您送我${giftData['name']}',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.sp,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'价值${price.toInt()}小票',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
message.isSelf! ? Container() : GestureDetector(
|
||||
onTap: () {
|
||||
showGiftPannel();
|
||||
},
|
||||
child: Container(
|
||||
height: 30.sp,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.sp),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF9457FE),
|
||||
Color(0xFFCF4CFF),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Text('满足TA,让感情升升温',style: TextStyle(color: Colors.white),),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showGiftPannel() {
|
||||
Get.bottomSheet(
|
||||
ChatGiftPannel(
|
||||
accid: message.sender!.toString(),
|
||||
),
|
||||
isScrollControlled: false,
|
||||
enableDrag: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -20,7 +20,7 @@ class ChatMsgGiftItem extends StatelessWidget {
|
||||
// "msg" -> "{\"giftImageUrl\":\"http://qiniuyun.ikuayou.com/live/gifts/2.png\",\"giftName\":\"舔狗楷模\",\"gmtNotice\":\"2023-0..."
|
||||
// TODO: add widget build method
|
||||
return Container(
|
||||
width: 203.sp,
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
color: Colors.black87,
|
||||
child: Column(
|
||||
children: [
|
||||
@ -45,7 +45,7 @@ class ChatMsgGiftItem extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 8.sp,),
|
||||
Container(
|
||||
child: Text('价值${giftData['totalPrice']}豆子',style: TextStyle(color: Color(0xFFF7FAFA),fontSize: 14.sp),overflow: TextOverflow.ellipsis,),
|
||||
child: Text('价值${giftData['totalPrice']}小票',style: TextStyle(color: Color(0xFFF7FAFA),fontSize: 14.sp),overflow: TextOverflow.ellipsis,),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
import '../../../common/colors/app_color.dart';
|
||||
import 'chat_gift_pannel.dart';
|
||||
|
||||
class ChatMsgInventWishItem extends StatelessWidget {
|
||||
V2TimMessage message;
|
||||
// TODO: add state variables, methods and constructor params
|
||||
ChatMsgInventWishItem(this.message);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map<String, dynamic> giftData = jsonDecode(message.customElem!.data!);
|
||||
// TODO: add widget build method
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (!(message.isSelf ?? false)) {
|
||||
showGiftPannel(giftData['id'].toString());
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 80.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
borderRadius: BorderRadius.circular(8.sp)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 10.sp),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: giftData['icon'],
|
||||
width: 60.sp,
|
||||
height: 60.sp,
|
||||
)),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
// alignment: Alignment.center,
|
||||
child: Text(
|
||||
'邀请你许个愿',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.sp,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'我可以考虑满足你哦~',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 13.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showGiftPannel(String giftId) {
|
||||
Get.bottomSheet(
|
||||
ChatGiftPannel(
|
||||
accid: message.sender!.toString(),
|
||||
giftId: giftId,
|
||||
),
|
||||
isScrollControlled: false,
|
||||
enableDrag: false,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
126
circle_app/lib/app/chat/widget/chat_msg_wish_info_item.dart
Normal file
126
circle_app/lib/app/chat/widget/chat_msg_wish_info_item.dart
Normal file
@ -0,0 +1,126 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
import '../../../common/colors/app_color.dart';
|
||||
import 'chat_gift_pannel.dart';
|
||||
|
||||
class ChatMsgWishInfoItem extends StatelessWidget {
|
||||
|
||||
V2TimMessage message;
|
||||
// TODO: add state variables, methods and constructor params
|
||||
ChatMsgWishInfoItem(this.message);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Map<String, dynamic> giftData = jsonDecode(message.customElem!.data!);
|
||||
// TODO: add widget build method
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (!(message.isSelf ?? false)) {
|
||||
showGiftPannel(giftData['id'].toString());
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 80.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: message.isSelf! ? AppColor.mainVerLinearGradient : LinearGradient(colors: [Color(0xFF493E5C),Color(0xFF493E5C)]),
|
||||
borderRadius: BorderRadius.circular(8.sp)),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 10.sp),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: giftData['icon'],
|
||||
width: 60.sp,
|
||||
height: 60.sp,
|
||||
)),
|
||||
Expanded(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
// alignment: Alignment.center,
|
||||
child: Text(
|
||||
'许愿:想要',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
giftData['name'],
|
||||
style: TextStyle(
|
||||
color: AppColor.mainColor, fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.sp,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
'感恩:${giftData['option']}',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA), fontSize: 14.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
message.isSelf!
|
||||
? Container()
|
||||
: GestureDetector(
|
||||
onTap: () {
|
||||
showGiftPannel(giftData['id'].toString());
|
||||
},
|
||||
child: Container(
|
||||
height: 30.sp,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.sp),
|
||||
gradient: AppColor.mainVerLinearGradient),
|
||||
child: Text(
|
||||
'满足TA',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showGiftPannel(String giftId) {
|
||||
Get.bottomSheet(
|
||||
ChatGiftPannel(
|
||||
accid: message.sender!.toString(),
|
||||
giftId: giftId,
|
||||
),
|
||||
isScrollControlled: false,
|
||||
enableDrag: false,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,3 +1,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:circle_app/main.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
@ -8,22 +11,24 @@ import 'package:circle_app/network/api.dart';
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
|
||||
import '../../../common/Widgets/RechargeScreenDialog.dart';
|
||||
import '../../../common/Widgets/base_tip_widget.dart';
|
||||
|
||||
class Gift extends StatefulWidget {
|
||||
String accid;
|
||||
Gift(this.accid, {super.key});
|
||||
String giftId;
|
||||
Gift(this.accid,this.giftId, {super.key});
|
||||
@override
|
||||
_GiftState createState() => _GiftState();
|
||||
}
|
||||
|
||||
class _GiftState extends State<Gift> {
|
||||
var livePlatform = MethodChannel('com.flutter.liveView');
|
||||
List giftList = [];
|
||||
|
||||
String giftId = '';
|
||||
|
||||
String tipStr = '';
|
||||
String balanceTipStr = '充值';
|
||||
|
||||
String incomeBalance = '';
|
||||
|
||||
@ -37,10 +42,26 @@ class _GiftState extends State<Gift> {
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
giftId = widget.giftId;
|
||||
loadGiftData();
|
||||
getAsset();
|
||||
}
|
||||
|
||||
gelectThirdItem() async {
|
||||
var data = await DioManager.getInstance().get(url: Api.walletRechargeSelectItem);
|
||||
if (data['code'] == 200) {
|
||||
// "walletRechargeSelectItemBos" -> [_GrowableList]
|
||||
List response =data['data']['priceConfs'];
|
||||
|
||||
incomeBalance = data['data']['balance'].toString();
|
||||
// List<RechargeItem> walletRechargeSelectItemBos = [];
|
||||
AssetsDataDataPriceConfs info = AssetsDataDataPriceConfs.fromJson(response.last);
|
||||
balanceTipStr = info.remark!.isNotEmpty ? '首冲最高赠送' + info.remark!.split('送').last + '>' : '充值>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
@ -102,7 +123,7 @@ class _GiftState extends State<Gift> {
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'充值>',
|
||||
balanceTipStr,
|
||||
style: TextStyle(
|
||||
color: AppColor.mainColor,
|
||||
fontSize: 12.sp,
|
||||
@ -117,32 +138,33 @@ class _GiftState extends State<Gift> {
|
||||
},
|
||||
child: Container(
|
||||
height: 27.sp,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF3E3D4C),
|
||||
borderRadius: BorderRadius.circular(13.5.sp)),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 18.sp,
|
||||
),
|
||||
Text(
|
||||
'${giftCount}',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
SizedBox(
|
||||
width: 10.sp,
|
||||
),
|
||||
const Icon(
|
||||
Icons.arrow_drop_down,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(
|
||||
width: 8.sp,
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (giftId.isEmpty) {
|
||||
showOKToast('请选择您想求送的礼物');
|
||||
} else {
|
||||
sendGetGiftData();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: 56.sp,
|
||||
height: 27.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
borderRadius: BorderRadius.circular(13.5.sp)),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'求送',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8,),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (giftId.isEmpty) {
|
||||
@ -166,7 +188,7 @@ class _GiftState extends State<Gift> {
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -184,6 +206,11 @@ class _GiftState extends State<Gift> {
|
||||
);
|
||||
}
|
||||
|
||||
void sendGetGiftData() async {
|
||||
var info = giftList[0][selectedIndex];
|
||||
sendGetGiftCustomMsg(widget.accid, jsonEncode(info), '求您送我${info['name']}');
|
||||
}
|
||||
|
||||
|
||||
void sendGiftData() async {
|
||||
var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':giftCount,'toUserId':widget.accid!.split('_').last});
|
||||
@ -203,6 +230,10 @@ class _GiftState extends State<Gift> {
|
||||
List dataList = result['data'];
|
||||
List giftItemData = [];
|
||||
for (int i = 0; i < dataList.length; i++) {
|
||||
var info = dataList[i];
|
||||
if (info['id'] == giftId) {
|
||||
selectedIndex = i;
|
||||
}
|
||||
giftItemData.add(dataList[i]);
|
||||
if (i % 7 == 0 && i != 0) {
|
||||
List temp = [];
|
||||
@ -220,7 +251,7 @@ class _GiftState extends State<Gift> {
|
||||
|
||||
if (jsonMap['code'] == 200) {
|
||||
incomeBalance = jsonMap['data']['balance'].toString();
|
||||
|
||||
await gelectThirdItem();
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
@ -228,14 +259,15 @@ class _GiftState extends State<Gift> {
|
||||
giftGridWidget(List info) {
|
||||
return Container(
|
||||
width: Get.width,
|
||||
height: 245.sp,
|
||||
// color: Colors.red,
|
||||
height: 255.sp,
|
||||
padding: EdgeInsets.only(left: 16.sp, right: 16.sp),
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 8.0.sp,
|
||||
mainAxisSpacing: 8.0.sp,
|
||||
childAspectRatio: 0.7,
|
||||
crossAxisSpacing: 0.0.sp,
|
||||
mainAxisSpacing: 0.sp,
|
||||
childAspectRatio: (Get.width - 32.sp) / 4 / 127.5.sp ,
|
||||
),
|
||||
itemCount: info.length,
|
||||
// Replace with the actual item count
|
||||
@ -262,7 +294,8 @@ class _GiftState extends State<Gift> {
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
height: 105.sp,
|
||||
height: 127.5.sp,
|
||||
// color: Colors.red,
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage(getMsgImage('gift_bg'),),
|
||||
@ -276,14 +309,14 @@ class _GiftState extends State<Gift> {
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(),
|
||||
isSelected ? Image.asset(getMsgImage('gift_bg'),) : Container(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.network(
|
||||
info['icon'],
|
||||
width: 48.sp,
|
||||
height: 48.sp,
|
||||
width: 70.sp,
|
||||
height: 70.sp,
|
||||
),
|
||||
Text(info['name'],
|
||||
style: TextStyle(
|
||||
|
||||
203
circle_app/lib/app/chat/widget/send_gift_dialog.dart
Normal file
203
circle_app/lib/app/chat/widget/send_gift_dialog.dart
Normal file
@ -0,0 +1,203 @@
|
||||
import 'package:circle_app/common/colors/app_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||
|
||||
import '../../../common/Widgets/base_tip_widget.dart';
|
||||
import '../../../network/api.dart';
|
||||
import '../../../network/dio_manager.dart';
|
||||
import '../../../util/util.dart';
|
||||
|
||||
class SendGiftDialog extends StatefulWidget {
|
||||
String accid;
|
||||
|
||||
SendGiftDialog({super.key,required this.accid});
|
||||
@override
|
||||
_SendGiftDialogState createState() => new _SendGiftDialogState();
|
||||
|
||||
}
|
||||
|
||||
class _SendGiftDialogState extends State<SendGiftDialog> {
|
||||
// TODO: add state variables and methods
|
||||
List giftList = [];
|
||||
String giftId = '';
|
||||
String withStr = '';
|
||||
int selectedIndex = -1;
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
loadGiftData();
|
||||
}
|
||||
|
||||
void loadGiftData() async {
|
||||
var result = await DioManager.instance.get(url: Api.giftList);
|
||||
if (result['code'] == 200) {
|
||||
giftList = result['data'];
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: add widget build method
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Center(
|
||||
child: Container(
|
||||
height: 255.sp,
|
||||
margin: EdgeInsets.only(left: 15.sp,right: 15.sp),
|
||||
padding: EdgeInsets.only(left: 15.sp,right: 15.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
gradient: LinearGradient(colors: [Color(0xFF4C3E5F),Color(0xFF324140)]),
|
||||
border: GradientBoxBorder(
|
||||
gradient:
|
||||
AppColor.mainVerLinearGradient,
|
||||
width: 1.sp,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 18.sp),
|
||||
child: Text(
|
||||
'今天找TA聊天的人有点多哦,为了避免打扰你需要赠送个礼物给TA才能继续聊天哈~',
|
||||
style: TextStyle(color: Colors.white, fontSize: 15.sp),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 102.sp,
|
||||
margin: EdgeInsets.only(top: 12.sp,),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF132B40), Color(0xFF251240)])),
|
||||
child: giftGridWidget(),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 25.sp,),
|
||||
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
height: 42.sp,
|
||||
width: 136.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.sp),
|
||||
color: Color(0x26FFFFFF)
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'放弃',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
if (selectedIndex < 0) {
|
||||
showOKToast('请选择一个礼物');
|
||||
return;
|
||||
}
|
||||
var result = await DioManager.instance.post(url: Api.sendGift,params: {'accid':widget.accid,'giftId':giftId,'num':1,'toUserId':widget.accid!.split('_').last});
|
||||
if (result['code'] == 200) {
|
||||
showOKToast('赠送成功');
|
||||
Get.back();
|
||||
} else if (result['code'] == 31201) {
|
||||
showOKToast(result['msg']);
|
||||
showRechargeScreenDialog();
|
||||
}
|
||||
|
||||
},
|
||||
child: Container(
|
||||
height: 42.sp,
|
||||
width: 136.sp,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.sp),
|
||||
gradient: AppColor.mainVerLinearGradient
|
||||
),
|
||||
child: Text(
|
||||
'赠送',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
giftGridWidget() {
|
||||
return Container(
|
||||
width: Get.width,
|
||||
height: 102.sp,
|
||||
padding:
|
||||
EdgeInsets.only(left: 10.sp, right: 10.sp, top: 10.sp, bottom: 10.sp),
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: giftList.length,
|
||||
itemBuilder: (context, index) {
|
||||
// Replace the placeholders with the actual item widgets
|
||||
return giftItemWidget(giftList[index], index);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
giftItemWidget(Map info, int index) {
|
||||
bool isSelected = giftId.contains(info['id'].toString());
|
||||
double price = info['price'];
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
selectedIndex = index;
|
||||
giftId = info['id'].toString();
|
||||
// tipStr = info['topHours'] != null ? info['topHours'].toString() : '';
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
height: 78.sp,
|
||||
width: 78.sp,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.network(
|
||||
info['icon'],
|
||||
width: 65.sp,
|
||||
height: 65.sp,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
55
circle_app/lib/app/chat/widget/svg_dialog.dart
Normal file
55
circle_app/lib/app/chat/widget/svg_dialog.dart
Normal file
@ -0,0 +1,55 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:svgaplayer_flutter/parser.dart';
|
||||
import 'package:svgaplayer_flutter/player.dart';
|
||||
|
||||
class SvgDialog extends StatefulWidget {
|
||||
String url;
|
||||
SvgDialog({Key? key,required this.url}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SvgDialogState createState() => _SvgDialogState();
|
||||
}
|
||||
|
||||
class _SvgDialogState extends State<SvgDialog>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late SVGAAnimationController animationController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
animationController = SVGAAnimationController(vsync: this);
|
||||
loadAnimation();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
this.animationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void loadAnimation() async {
|
||||
final videoItem = await SVGAParser.shared.decodeFromURL(
|
||||
widget.url);
|
||||
animationController.videoItem = videoItem;
|
||||
animationController
|
||||
.forward() // Try to use .forward() .reverse()
|
||||
.whenComplete(() {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: RSizedBox(
|
||||
width: Get.width,
|
||||
height: Get.height,
|
||||
child: SVGAImage(animationController,fit: BoxFit.cover,),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
286
circle_app/lib/app/chat/widget/wish_dialog.dart
Normal file
286
circle_app/lib/app/chat/widget/wish_dialog.dart
Normal file
@ -0,0 +1,286 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:circle_app/common/colors/app_color.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_pickers/pickers.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../network/api.dart';
|
||||
import '../../../network/dio_manager.dart';
|
||||
import '../../circle/view.dart';
|
||||
|
||||
class WishDialog extends StatefulWidget {
|
||||
String accId;
|
||||
|
||||
WishDialog({super.key, required this.accId});
|
||||
@override
|
||||
_WishDialogState createState() => new _WishDialogState();
|
||||
}
|
||||
|
||||
class _WishDialogState extends State<WishDialog> {
|
||||
// TODO: add state variables and methods
|
||||
List giftList = [];
|
||||
String giftId = '';
|
||||
String withStr = '';
|
||||
int selectedIndex = -1;
|
||||
|
||||
List<String> optionList = [
|
||||
'分享一张本人照片',
|
||||
'给你我的联系方式',
|
||||
'来一场浪漫的约会',
|
||||
'来一次真诚的告白',
|
||||
'玩一个刺激的游戏',
|
||||
'透露一个小秘密',
|
||||
'一起聊天半小时'
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
loadGiftData();
|
||||
}
|
||||
|
||||
void loadGiftData() async {
|
||||
var result = await DioManager.instance.get(url: Api.giftList);
|
||||
if (result['code'] == 200) {
|
||||
giftList = result['data'];
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
giftGridWidget() {
|
||||
return Container(
|
||||
width: Get.width,
|
||||
height: 102.sp,
|
||||
padding:
|
||||
EdgeInsets.only(left: 10.sp, right: 10.sp, top: 10.sp, bottom: 10.sp),
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: giftList.length,
|
||||
itemBuilder: (context, index) {
|
||||
// Replace the placeholders with the actual item widgets
|
||||
return giftItemWidget(giftList[index], index);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
giftItemWidget(Map info, int index) {
|
||||
bool isSelected = giftId.contains(info['id'].toString());
|
||||
double price = info['price'];
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
selectedIndex = index;
|
||||
giftId = info['id'].toString();
|
||||
// tipStr = info['topHours'] != null ? info['topHours'].toString() : '';
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
height: 78.sp,
|
||||
width: 78.sp,
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
isSelected ? Image.asset(getMsgImage('gift_bg')) : Container(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.network(
|
||||
info['icon'],
|
||||
width: 65.sp,
|
||||
height: 65.sp,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// TODO: add widget build method
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container())),
|
||||
SafeArea(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(10.sp),
|
||||
bottomRight: Radius.circular(10.sp)),
|
||||
color: Color(0xFF423055),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 8.sp, bottom: 15.sp),
|
||||
width: 30.sp,
|
||||
height: 3.sp,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x33FFFFFF),
|
||||
borderRadius: BorderRadius.circular(1.5.sp)),
|
||||
),
|
||||
Text(
|
||||
'对方满足你的愿望后要尽快兑现承诺哈,感恩是你们建立稳定关系的保障哦~',
|
||||
style: TextStyle(color: Colors.white, fontSize: 15.sp),
|
||||
),
|
||||
Container(
|
||||
height: 102.sp,
|
||||
margin: EdgeInsets.only(top: 12.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFF132B40), Color(0xFF251240)])),
|
||||
child: giftGridWidget(),
|
||||
),
|
||||
Container(
|
||||
height: 30.sp,
|
||||
padding: EdgeInsets.only(left: 10.sp, right: 10.sp),
|
||||
margin: EdgeInsets.only(top: 12.sp),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0x1AFFFFFF),
|
||||
borderRadius: BorderRadius.circular(15.sp)),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'选择感恩方式',
|
||||
style: TextStyle(
|
||||
color: Color(0xB3FFFFFF), fontSize: 15.sp),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
showOptionPiker(withStr);
|
||||
},
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
withStr.isNotEmpty ? withStr : '请选择',
|
||||
style: TextStyle(
|
||||
color: withStr.isNotEmpty
|
||||
? AppColor.mainColor
|
||||
: Colors.white,
|
||||
fontSize: 15.sp),
|
||||
),
|
||||
Image.asset(
|
||||
getHomeImage('icon_in'),
|
||||
width: 24.sp,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 12.sp, bottom: 15.sp),
|
||||
padding: EdgeInsets.only(left: 30.sp, right: 30.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedIndex < 0) {
|
||||
showOKToast('请选择一个礼物');
|
||||
return;
|
||||
}
|
||||
var info = giftList[selectedIndex];
|
||||
|
||||
sendInventWishCustomMsg(
|
||||
widget.accId, jsonEncode(info), '邀请你许个愿');
|
||||
},
|
||||
child: Container(
|
||||
height: 42.sp,
|
||||
width: 136.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.sp),
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'邀请对方许愿',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (selectedIndex < 0) {
|
||||
showOKToast('请选择一个礼物');
|
||||
return;
|
||||
} else if (withStr.isEmpty) {
|
||||
showOKToast('请选择感恩方式');
|
||||
return;
|
||||
}
|
||||
var info = giftList[selectedIndex];
|
||||
info['option'] = withStr;
|
||||
sendGetWishCustomMsg(
|
||||
widget.accId, jsonEncode(info), '许愿:想要${info['name']}');
|
||||
},
|
||||
child: Container(
|
||||
height: 42.sp,
|
||||
width: 136.sp,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.sp),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFF7660FF),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'立即许愿',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
showOptionPiker(String text) {
|
||||
Pickers.showSinglePicker(context,
|
||||
pickerStyle: DefaultPickerStyle.dark(),
|
||||
data: optionList,
|
||||
selectData: text.isNotEmpty ? text : optionList.first,
|
||||
onConfirm: (p, position) {
|
||||
withStr = p;
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -66,8 +66,9 @@ class CircleLogic extends GetxController {
|
||||
initGerder();
|
||||
getCityList();
|
||||
|
||||
getBanner();
|
||||
getNearByList();
|
||||
// getBanner();
|
||||
// getNearByList();
|
||||
|
||||
|
||||
EventBusManager.on<CommentVipEvent>().listen((event) {
|
||||
myVip = event.vip;
|
||||
@ -390,7 +391,7 @@ class VicinityItemBean {
|
||||
});
|
||||
|
||||
factory VicinityItemBean.fromJson(Map<String, dynamic> json) {
|
||||
var interestList = json['interests'] as List;
|
||||
var interestList = json['interests'] != null ? json['interests'] as List : [];
|
||||
List<Interest> interests =
|
||||
interestList.map((interest) => Interest.fromJson(interest)).toList();
|
||||
|
||||
@ -416,7 +417,7 @@ class VicinityItemBean {
|
||||
orientationName: json['orientation_name'],
|
||||
bgPicUrl: json['bg_picUrl'],
|
||||
onlineFlag: json['online_flag'],
|
||||
isOnline: json['isOnline'],
|
||||
isOnline: json['isOnline'] == 1 || json['isOnline'] == true,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
widget.logic.getBanner();
|
||||
widget.logic.getNearByList();
|
||||
sub = EventBusManager.on<NearScrollTap>().listen((event) {
|
||||
// if (widget.logic.myVip > 0) {
|
||||
_scrollController.animateTo(0,
|
||||
|
||||
@ -36,9 +36,8 @@ class ExternalshareLogic extends GetxController {
|
||||
showOKToast("请上传图片");
|
||||
return ;
|
||||
}
|
||||
String jsonString = jsonEncode(state.imaglist);
|
||||
var data = await DioManager.instance.post(url:' Api.UPDATE_EXTERNAL_SHARE', params: {
|
||||
'picUrl':jsonString
|
||||
var data = await DioManager.instance.post(url:Api.offSite, params: {
|
||||
'picUrl':state.imaglist
|
||||
});
|
||||
if(data["code"]==200){
|
||||
Get.back();
|
||||
|
||||
@ -58,12 +58,12 @@ class ExternalsharePage extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 8.sp),
|
||||
buildRichText(
|
||||
"1. 站外平台粉丝达到1000人以上,发新动态置顶一天,可获得1000豆子;"),
|
||||
"1. 站外平台粉丝达到1000人以上,发新动态置顶一天,可获得1000小票;"),
|
||||
SizedBox(height: 8.sp),
|
||||
buildRichText("2. 邀请海报发到微信朋友圈或QQ动态(删除无效),可获得100豆子;"),
|
||||
buildRichText("2. 邀请海报发到微信朋友圈或QQ动态(删除无效),可获得100小票;"),
|
||||
SizedBox(height: 8.sp),
|
||||
buildRichText(
|
||||
"3. 分享到圈内群聊(QQ、微信、B站、快手、抖音、微博、推特或其他平台均有效),群里有多少人点击就获得多少豆子。"),
|
||||
"3. 分享到圈内群聊(QQ、微信、B站、快手、抖音、微博、推特或其他平台均有效),群里有多少人点击就获得多少小票。"),
|
||||
SizedBox(height: 24.sp),
|
||||
|
||||
buildRichText("*上传分享截图"),
|
||||
@ -77,6 +77,9 @@ class ExternalsharePage extends StatelessWidget {
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3, // 每行显示的项目数量
|
||||
crossAxisSpacing: 10.sp,
|
||||
mainAxisSpacing: 10.sp,
|
||||
childAspectRatio: 1.0
|
||||
),
|
||||
itemCount: logic.state.imaglist.length < 9
|
||||
? logic.state.imaglist.length + 1
|
||||
@ -91,10 +94,11 @@ class ExternalsharePage extends StatelessWidget {
|
||||
logic.getImageFile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
|
||||
child: Image(
|
||||
fit: BoxFit.cover,
|
||||
image: AssetImage(
|
||||
getMineImage("icon_img_add")),
|
||||
getMineImage("icon_img_add"),),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:circle_app/app/circle/logic.dart';
|
||||
import 'package:circle_app/app/msg/logic.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../minefragment/logic.dart';
|
||||
@ -9,6 +10,7 @@ class HomeBinding extends Bindings {
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => HomeLogic());
|
||||
Get.lazyPut(() => CircleLogic());
|
||||
Get.lazyPut(() => MsgLogic());
|
||||
Get.lazyPut(() => MinefragmentLogic());
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,17 +3,21 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
|
||||
import 'package:circle_app/app/chat/widget/svg_dialog.dart';
|
||||
import 'package:circle_app/app/circle/logic.dart';
|
||||
import 'package:circle_app/app/like/view.dart';
|
||||
import 'package:circle_app/app/minefragment/logic.dart';
|
||||
import 'package:circle_app/app/msg/logic.dart';
|
||||
import 'package:circle_app/main.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:event_bus/event_bus.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/core/core_services.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/message/message_services.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart';
|
||||
@ -30,7 +34,6 @@ import 'state.dart';
|
||||
|
||||
class HomeLogic extends GetxController with WidgetsBindingObserver {
|
||||
late TabController tabController;
|
||||
|
||||
int currentIndex = 0;
|
||||
Widget currentPage = Container();
|
||||
|
||||
@ -111,7 +114,7 @@ class HomeLogic extends GetxController with WidgetsBindingObserver {
|
||||
Map<String, dynamic> jsonData = json.decode(customData);
|
||||
int event = jsonData['event'];
|
||||
Map<String, dynamic> content = jsonData['content'];
|
||||
switch(event){
|
||||
switch(event) {
|
||||
case 1://关注
|
||||
String ageMsg = "${content['genderName']}·${content['age']}·${content['roleName']}·${content['orientationName']}";
|
||||
if(content['isFollow']==1){//互关
|
||||
@ -145,16 +148,35 @@ class HomeLogic extends GetxController with WidgetsBindingObserver {
|
||||
.v2TIMMessageManager.addAdvancedMsgListener(
|
||||
listener: V2TimAdvancedMsgListener(
|
||||
onRecvNewMessage: (message) {
|
||||
getUnreadSize();
|
||||
print(message);
|
||||
if (message.elemType == MessageElemType.V2TIM_ELEM_TYPE_CUSTOM) {
|
||||
if ( message.customElem?.data != null) {
|
||||
print(message.customElem!.data!);
|
||||
Map jsonData = jsonDecode(message.customElem!.data!);
|
||||
String event = jsonData['event'].toString();
|
||||
if (int.parse(event) == 3) {
|
||||
showOKToast(message.customElem!.desc!.toString());
|
||||
EventBusManager.fire(LikeRefresh());
|
||||
if (jsonData.containsKey('event')) {
|
||||
String event = jsonData['event'].toString();
|
||||
if (int.parse(event) == 3) {
|
||||
showOKToast(message.customElem!.desc!.toString());
|
||||
EventBusManager.fire(LikeRefresh());
|
||||
} else if (int.parse(event) == 5) {
|
||||
|
||||
// print(jsonData.toString());
|
||||
var info = jsonDecode(jsonData['content']);
|
||||
TencentImSDKPlugin.v2TIMManager.v2ConversationManager.pinConversation(conversationID: 'c2c_' + info['fromImId'], isPinned: info['top'] == 1);
|
||||
}
|
||||
} else if (jsonData.containsKey('type')) {
|
||||
int type = jsonData['type'];
|
||||
if (type == 1) {
|
||||
String giftUrl = jsonData['gifUrl'];
|
||||
if (giftUrl.isNotEmpty) {
|
||||
Get.bottomSheet(SvgDialog(url: giftUrl),isScrollControlled: true,
|
||||
enableDrag: false,isDismissible:false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -312,7 +334,8 @@ class HomeLogic extends GetxController with WidgetsBindingObserver {
|
||||
final logic = Get.put(MinefragmentLogic());
|
||||
logic.getMode();
|
||||
} else if (index == 2) {
|
||||
getUnreadSize();
|
||||
final logic = Get.find<MsgLogic>();
|
||||
logic.loadChatData();
|
||||
}
|
||||
update();
|
||||
}
|
||||
@ -373,3 +396,10 @@ class HomeLogic extends GetxController with WidgetsBindingObserver {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class conTop {
|
||||
bool isTop;
|
||||
String conId;
|
||||
conTop(this.isTop,this.conId);
|
||||
}
|
||||
@ -4,6 +4,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import '../../util/eventBus.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'state.dart';
|
||||
|
||||
@ -23,9 +24,21 @@ class LikelistLogic extends GetxController {
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
var mineLogic = Get.find<MinefragmentLogic>();
|
||||
isVip = mineLogic.isVip.value;
|
||||
// var mineLogic = Get.find<MinefragmentLogic>();
|
||||
// isVip = mineLogic.isVip.value;
|
||||
await loadMyInfo();
|
||||
initList();
|
||||
|
||||
}
|
||||
|
||||
loadMyInfo() async {
|
||||
var data = await DioManager.instance.get(url: Api.getUserMine);
|
||||
var bean = BaseResponse<MineResponseBean>.fromJson(
|
||||
data, (data) => MineResponseBean.fromJson(data));
|
||||
if (bean.isSuccess()) {
|
||||
isVip = bean.data.user.vip;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
initList() async {
|
||||
|
||||
@ -10,16 +10,39 @@ import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../components/my_app_bar.dart';
|
||||
import '../../main.dart';
|
||||
import '../../router/app_routers.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class LikelistPage extends StatelessWidget {
|
||||
class LikelistPage extends StatefulWidget {
|
||||
LikelistPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LikelistPage> createState() => _LikelistPageState();
|
||||
}
|
||||
|
||||
class _LikelistPageState extends State<LikelistPage> with RouteAware {
|
||||
final logic = Get.find<LikelistLogic>();
|
||||
|
||||
final state = Get.find<LikelistLogic>().state;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
routeObserver.subscribe(this, ModalRoute.of(context) as PageRoute);
|
||||
}
|
||||
|
||||
@override
|
||||
void didPopNext() {
|
||||
// TODO: implement didPopNext
|
||||
super.didPopNext();
|
||||
logic.loadMyInfo();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<LikelistLogic>(builder: (logic) {
|
||||
@ -55,7 +78,6 @@ class LikelistPage extends StatelessWidget {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Widget showGd() {
|
||||
double interval = 50;
|
||||
List<String> urlList = [];
|
||||
@ -413,7 +435,6 @@ class LikelistPage extends StatelessWidget {
|
||||
logic.initList();
|
||||
}
|
||||
|
||||
|
||||
showRechargeDialog() async {
|
||||
MinefragmentLogic ctr = Get.find();
|
||||
Get.bottomSheet(
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import 'package:circle_app/common/colors/app_color.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
@ -59,16 +61,17 @@ class LoginPage extends StatelessWidget {
|
||||
// bottom: 0,
|
||||
|
||||
child: Container(
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white60,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: Border.all(
|
||||
color: Colors.white60,
|
||||
width: 0.5.sp)),
|
||||
)),
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: GradientBoxBorder(
|
||||
gradient:
|
||||
AppColor.mainVerLinearGradient,
|
||||
width: 1.sp,
|
||||
),
|
||||
))),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -132,16 +135,18 @@ class LoginPage extends StatelessWidget {
|
||||
// bottom: 0,
|
||||
|
||||
child: Container(
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white60,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: Border.all(
|
||||
color: Colors.white60,
|
||||
width: 0.5.sp)),
|
||||
)),
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white60,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: GradientBoxBorder(
|
||||
gradient: AppColor
|
||||
.mainVerLinearGradient,
|
||||
width: 1.sp,
|
||||
),
|
||||
))),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -229,16 +234,18 @@ class LoginPage extends StatelessWidget {
|
||||
// bottom: 0,
|
||||
|
||||
child: Container(
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white60,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: Border.all(
|
||||
color: Colors.white60,
|
||||
width: 0.5.sp)),
|
||||
)),
|
||||
width: 280.sp,
|
||||
height: 60.sp,
|
||||
decoration: BoxDecoration(
|
||||
// color: Colors.white60,
|
||||
borderRadius:
|
||||
BorderRadius.circular(30.sp),
|
||||
border: GradientBoxBorder(
|
||||
gradient: AppColor
|
||||
.mainVerLinearGradient,
|
||||
width: 1.sp,
|
||||
),
|
||||
))),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -280,15 +287,14 @@ class LoginPage extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
logic.loginType = logic.loginType == 0 ? 1 : 0;
|
||||
logic.update();
|
||||
},
|
||||
child: Container(
|
||||
width:280.sp,
|
||||
margin: EdgeInsets.only(top: 15.sp,right: 0.sp),
|
||||
width: 280.sp,
|
||||
margin: EdgeInsets.only(top: 15.sp, right: 0.sp),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
logic.loginType == 1 ? '验证码登录' : '密码登录',
|
||||
@ -297,7 +303,6 @@ class LoginPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -165,7 +165,7 @@ class _MinefragmentPageState extends State<MinefragmentPage> with RouteAware {
|
||||
|
||||
|
||||
return Column(
|
||||
children: [_myAssetItemView(),_circleItemView(logic),_invienItemView(),_editGoodReviewItemView(), _helpItemView(),_setUpItemView()],
|
||||
children: [_myAssetItemView(),_circleItemView(logic),_invienItemView(),_shareItemView(),_editGoodReviewItemView(), _helpItemView(),_setUpItemView()],
|
||||
);
|
||||
}
|
||||
|
||||
@ -411,6 +411,10 @@ class _MinefragmentPageState extends State<MinefragmentPage> with RouteAware {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
'免费领小票',
|
||||
style: const TextStyle(color: Colors.white60),
|
||||
),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_slidable_for_tencent_im/flutter_slidable.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:scroll_to_index/scroll_to_index.dart';
|
||||
@ -11,7 +9,6 @@ import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_state.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_statelesswidget.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/life_cycle/conversation_life_cycle.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_conversation_view_model.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_friendship_view_model.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/core/tim_uikit_wide_modal_operation_key.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/data_services/services_locatar.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
@ -19,7 +16,6 @@ import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_conversation_co
|
||||
import 'package:tencent_cloud_chat_uikit/ui/utils/platform.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/utils/screen_utils.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/views/TIMUIKitConversation/tim_uikit_conversation_item.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/widgets/customize_ball_pulse_header.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/base_widgets/tim_ui_kit_base.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/ui/widgets/wide_popup.dart';
|
||||
|
||||
@ -141,6 +137,8 @@ class ConversationItemSlidePanel extends TIMUIKitStatelessWidget {
|
||||
/// A label to display below the [icon].
|
||||
final String? label;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget tuiBuild(BuildContext context, TUIKitBuildValue value) {
|
||||
return SlidableAction(
|
||||
@ -162,11 +160,11 @@ class _TIMConversationState extends TIMUIKitState<TIMConversation> {
|
||||
final TUIThemeViewModel themeViewModel = serviceLocator<TUIThemeViewModel>();
|
||||
// final TUIFriendShipViewModel friendShipViewModel =
|
||||
// serviceLocator<TUIFriendShipViewModel>();
|
||||
|
||||
bool hasMore = true;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
final controller = getController();
|
||||
widget.scrollController!.addListener(() {
|
||||
|
||||
|
||||
@ -1,9 +1,13 @@
|
||||
import 'package:circle_app/app/likelist/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:flutter/cupertino.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import '../../common/Widgets/base_tip_widget.dart';
|
||||
import '../circle/logic.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class MsgLogic extends GetxController {
|
||||
@ -11,12 +15,15 @@ class MsgLogic extends GetxController {
|
||||
List<UserListItem> lists = [];
|
||||
|
||||
ScrollController listScrollController = ScrollController();
|
||||
List chatList = [];
|
||||
|
||||
int total = 0;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
|
||||
loadChatData();
|
||||
loadLikeData();
|
||||
}
|
||||
loadLikeData() async {
|
||||
@ -32,4 +39,114 @@ class MsgLogic extends GetxController {
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
void loadChatData() async {
|
||||
var data =
|
||||
await DioManager.instance.post(url: Api.recommendQuickChatUser, params: {
|
||||
'page':1,
|
||||
'pageSize':8
|
||||
});
|
||||
if (data['code'] == 200) {
|
||||
total = data['data']['total'];
|
||||
chatList = data['data']['lists'];
|
||||
}
|
||||
|
||||
// vicinityList = bean.data.lists;
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
Future<bool> queryQuickStart() async {
|
||||
var data =
|
||||
await DioManager.getInstance().get(url: Api.queryQuickStart);
|
||||
if (data["code"] == 200) {
|
||||
if (data["data"] == 0) {
|
||||
var data = await DioManager.getInstance()
|
||||
.get(url: Api.startQuick);
|
||||
if (data["code"] == 200) {
|
||||
showOKToast("已开启速聊");
|
||||
loadChatData();
|
||||
return true;
|
||||
} else if (data["code"] == 10102) {
|
||||
showRechargeScreenDialog();
|
||||
}
|
||||
} else if (data["data"] == 1) {
|
||||
|
||||
showOKToast("速聊开启中");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
stopQueryQuick()async{
|
||||
var data =
|
||||
await DioManager.getInstance().get(url: Api.stopQuick);
|
||||
if (data["code"] == 200) {
|
||||
showOKToast('操作成功');
|
||||
loadChatData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Future<bool> callOrhers() async {
|
||||
var data = await DioManager.getInstance().post(url: Api.callOthers);
|
||||
|
||||
if (data["code"] == 200) {
|
||||
showOKToast("已成功召唤三十人,请耐心等待TA的回复哈~");
|
||||
return true;
|
||||
} else if(data["code"] == 10081){
|
||||
showOKToast(data["msg"]);
|
||||
showRechargeScreenDialog();
|
||||
|
||||
}else{
|
||||
showOKToast(data["msg"]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
showTipPop() {
|
||||
Get.bottomSheet(
|
||||
CupertinoActionSheet(
|
||||
title: Text(
|
||||
'上速聊推荐可以让更多人看到你',
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
), //标题
|
||||
//提示内容
|
||||
actions: <Widget>[
|
||||
//操作按钮集合
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
queryQuickStart();
|
||||
},
|
||||
child: const Text('冲到第一'),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
callOrhers();
|
||||
Get.back();
|
||||
|
||||
},
|
||||
child: const Text('一键呼唤三十位您想认识的人'),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
stopQueryQuick();
|
||||
},
|
||||
child: const Text('不显示在速聊列表'),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
//取消按钮
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: const Text('取消'),
|
||||
),
|
||||
),
|
||||
isScrollControlled: true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,8 @@ class MsgPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
final ctr = Get.put(MsgLogic());
|
||||
// final ctr = Get.put(MsgLogic());
|
||||
final ctr = Get.find<MsgLogic>();
|
||||
var logic = Get.find<CircleLogic>();
|
||||
void getPipeiData() async {
|
||||
var data = await DioManager.instance
|
||||
@ -73,10 +74,10 @@ class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
return Column(
|
||||
children: [
|
||||
navigatorItem(controller),
|
||||
// tipWidget(),
|
||||
// reconmandWidget(),
|
||||
tipWidget(),
|
||||
reconmandWidget(),
|
||||
// Text(controller.state.msg),
|
||||
Expanded(child: TIMConversation(
|
||||
Expanded(child: TIMConversation(
|
||||
autoScrollController: logic.scrollController,
|
||||
scrollController: logic.listScrollController,
|
||||
onTapItem: (selectedConv) async{
|
||||
@ -246,7 +247,7 @@ class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
margin: EdgeInsets.only(top: 18.sp, bottom: 15.sp),
|
||||
padding: EdgeInsets.only(left: 16.sp, right: 12.sp),
|
||||
width: Get.width,
|
||||
height: 20,
|
||||
height: 20.sp,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -259,13 +260,7 @@ class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async{
|
||||
V2TimConversation conv = V2TimConversation(
|
||||
type: 1,
|
||||
userID: '10040818',
|
||||
conversationID: 'c2c_10040818',
|
||||
showName: '456');
|
||||
Get.toNamed(AppRoutes.Chat, arguments: conv);
|
||||
|
||||
Get.toNamed(AppRoutes.Quick);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -279,7 +274,7 @@ class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
).createShader(Offset.zero & bounds.size);
|
||||
},
|
||||
child: Text(
|
||||
'n人等您聊',
|
||||
'${ctr.total}人等您聊',
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
@ -302,65 +297,176 @@ class _MsgPageState extends State<MsgPage> with AutomaticKeepAliveClientMixin {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 16.sp, right: 18.sp),
|
||||
width: Get.width,
|
||||
height: 80.sp,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
getMsgImage('msg_first'),
|
||||
width: 50.sp,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
'抢占第一',
|
||||
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||
),
|
||||
],
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
ctr.showTipPop();
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
getMsgImage('msg_first'),
|
||||
width: 50.sp,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
'抢占第一',
|
||||
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Container(
|
||||
// width: 50.sp * 10,
|
||||
child: Row(
|
||||
children: [
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
peopleWidget(),
|
||||
],
|
||||
),
|
||||
),
|
||||
itemBuilder: (contenxt, index) {
|
||||
if (index == ctr.chatList.length) {
|
||||
return MoreItem();
|
||||
}
|
||||
return peopleWidget(ctr.chatList[index]);
|
||||
},
|
||||
itemCount: ctr.chatList.length + 1,
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
peopleWidget() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 18.sp),
|
||||
child: Column(
|
||||
Widget MoreItem() {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.Quick);
|
||||
},
|
||||
child: Container(
|
||||
// width: 68.sp,
|
||||
margin: EdgeInsets.only(left: 12.sp),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: ClipOval(
|
||||
child: Container(
|
||||
color: Colors.black,
|
||||
width: 50.sp,
|
||||
height: 50.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
getHomeImage("im_more"),
|
||||
width: 50.sp,
|
||||
// height: 48.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 4.0.sp),
|
||||
Center(
|
||||
child: Text(
|
||||
"查看更多",
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp,
|
||||
color: Colors.white, // Replace with desired text color
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
topWidget() {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
ctr.showTipPop();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 18.sp),
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
getMsgImage('msg_first'),
|
||||
width: 50.sp,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
'抢占第一',
|
||||
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
peopleWidget(Map info) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.UserInfoActivity,arguments: info['id'].toString());
|
||||
},
|
||||
child: Stack(
|
||||
|
||||
children: [
|
||||
Image.asset(
|
||||
getMsgImage('msg_first'),
|
||||
width: 50.sp,
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
'抢占第一',
|
||||
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 12.sp),
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(
|
||||
height: 52.sp,
|
||||
width: 52.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColor.mainVerLinearGradient,
|
||||
borderRadius: BorderRadius.circular(26.sp)
|
||||
),
|
||||
),
|
||||
ClipOval(
|
||||
child: Image.network(
|
||||
info['avatar'],
|
||||
fit: BoxFit.cover,
|
||||
width: 50.sp,
|
||||
height: 50.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
),
|
||||
Text(
|
||||
info['nickname'] ?? '',
|
||||
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
(info['gender'] ?? 0) > 0
|
||||
? Positioned(
|
||||
bottom: 28.sp,
|
||||
right: 0.sp,
|
||||
child: Image.asset(
|
||||
getMsgImage(getGenderContent(info['gender'])),
|
||||
height: 15.sp,
|
||||
)
|
||||
) : Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -11,15 +11,35 @@ class MyCircleLogic extends GetxController {
|
||||
PageController pageController =
|
||||
PageController(initialPage: 1, viewportFraction: 0.8);
|
||||
InterestsBean circle = InterestsBean(lists: []);
|
||||
ScrollController scrollController = ScrollController();
|
||||
final CircleState state = CircleState();
|
||||
int page = 1;
|
||||
|
||||
bool isMore = true;
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
scrollController.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
var data = await DioManager.instance
|
||||
await loadData();
|
||||
scrollController.addListener(() {
|
||||
if (scrollController.position.pixels ==
|
||||
scrollController.position.maxScrollExtent) {
|
||||
loadMore();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> loadData() async {
|
||||
var data = await DioManager.instance
|
||||
.get(url: Api.getMyCircleInterests, params: {"page": page,'page_size':20});
|
||||
|
||||
var bean = BaseResponse<InterestsBean>.fromJson(
|
||||
|
||||
@ -64,8 +64,12 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
? noResultWidget()
|
||||
: loaddingWidget(logic.isMore)
|
||||
: ListView.builder(
|
||||
// controller: logic.rightCtr,
|
||||
controller: logic.scrollController,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == logic.circle.lists.length) {
|
||||
return loaddingWidget(logic.isMore);
|
||||
}
|
||||
|
||||
var bean = logic.circle.lists[index];
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
@ -77,7 +81,7 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
child: circleInfoItemWidget(
|
||||
logic.circle.lists[index]));
|
||||
},
|
||||
itemCount: logic.circle.lists.length,
|
||||
itemCount: logic.circle.lists.length + 1,
|
||||
))
|
||||
// Swiper(
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
@ -286,7 +290,7 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
SizedBox(
|
||||
height: 30.sp,
|
||||
width:
|
||||
30.0.sp + 14.sp * (widgets.length - 1.sp),
|
||||
30.0.sp + 15.sp * (widgets.length - 1),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: widgets,
|
||||
|
||||
10
circle_app/lib/app/quick/binding.dart
Normal file
10
circle_app/lib/app/quick/binding.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class QuickBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => QuickLogic());
|
||||
}
|
||||
}
|
||||
51
circle_app/lib/app/quick/logic.dart
Normal file
51
circle_app/lib/app/quick/logic.dart
Normal file
@ -0,0 +1,51 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
|
||||
class QuickLogic extends GetxController {
|
||||
|
||||
final RefreshController refreshController = RefreshController();
|
||||
List lists = [];
|
||||
int page = 1;
|
||||
int isVip = 0;
|
||||
bool isLoad = true;
|
||||
bool isMore = true;
|
||||
ScrollController scrollController = ScrollController();
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
initList();
|
||||
}
|
||||
|
||||
initList() async {
|
||||
var data =
|
||||
await DioManager.instance.post(url: Api.recommendQuickChatUser, params: {
|
||||
'page':page,
|
||||
'pageSize':20
|
||||
});
|
||||
if (data['code'] == 200) {
|
||||
|
||||
List list = data['data']['lists'];
|
||||
if (list.isNotEmpty) {
|
||||
isLoad = false;
|
||||
if (page == 1) {
|
||||
refreshController.refreshCompleted();
|
||||
refreshController.loadComplete();
|
||||
lists = list;
|
||||
} else {
|
||||
lists.addAll(list);
|
||||
refreshController.loadComplete();
|
||||
}
|
||||
} else {
|
||||
refreshController.loadNoData();
|
||||
isMore = false;
|
||||
}
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
393
circle_app/lib/app/quick/view.dart
Normal file
393
circle_app/lib/app/quick/view.dart
Normal file
@ -0,0 +1,393 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/app/msg/logic.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../common/colors/app_color.dart';
|
||||
import '../../components/my_app_bar.dart';
|
||||
import '../../router/app_routers.dart';
|
||||
import '../../util/util.dart';
|
||||
import '../circle/logic.dart';
|
||||
import '../userinfo/logic.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class QuickPage extends StatelessWidget {
|
||||
QuickPage({Key? key}) : super(key: key);
|
||||
|
||||
final logic = Get.find<MsgLogic>();
|
||||
final ctr = Get.find<QuickLogic>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<QuickLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getBaseImage("bg")),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(
|
||||
centerTitle: "速聊",
|
||||
onCenterTitlePressed: (){
|
||||
ctr.scrollController.animateTo(0, duration: Duration(milliseconds: 300), curve: Curves.easeInOut);
|
||||
},
|
||||
actionWdiget: const Text(
|
||||
"一呼百应",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
onPressed: () {
|
||||
showTipPop();
|
||||
}
|
||||
),
|
||||
body: SafeArea(
|
||||
child: logic.isLoad
|
||||
? loaddingWidget(true)
|
||||
: logic.lists.isEmpty
|
||||
? noResultWidget()
|
||||
: SmartRefresher(
|
||||
controller: logic.refreshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
enablePullUp: true,
|
||||
child: ListView.builder(
|
||||
controller: ctr.scrollController,
|
||||
// padding: EdgeInsets.all(10.sp),
|
||||
itemCount: ctr.lists.length,
|
||||
itemBuilder: (context, index) {
|
||||
var info = VicinityItemBean.fromJson(ctr.lists[index]);
|
||||
|
||||
return ListItem(info,index);
|
||||
// return itemWidget(index,logic.lists[index]);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
showTipPop() {
|
||||
Get.bottomSheet(
|
||||
CupertinoActionSheet(
|
||||
title: Text(
|
||||
'上速聊推荐可以让更多人看到你',
|
||||
style: TextStyle(fontSize: 22.sp),
|
||||
), //标题
|
||||
//提示内容
|
||||
actions: <Widget>[
|
||||
//操作按钮集合
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
// Get.find
|
||||
var result = await logic.queryQuickStart();
|
||||
if (result) {
|
||||
_onRefresh();
|
||||
}
|
||||
},
|
||||
child: Text('冲到第一'),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
logic.callOrhers();
|
||||
Get.back();
|
||||
|
||||
},
|
||||
child: Text('一键呼唤三十位您想认识的人'),
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
logic.stopQueryQuick();
|
||||
},
|
||||
child: Text('不显示在速聊列表'),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
//取消按钮
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Text('取消'),
|
||||
),
|
||||
),
|
||||
isScrollControlled: true);
|
||||
}
|
||||
|
||||
|
||||
Widget ListItem(VicinityItemBean item, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.UserInfoActivity, arguments: item.id.toString());
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10.sp),
|
||||
// padding: EdgeInsets.only( left: 8.sp, right: 8.sp),
|
||||
width: Get.width,
|
||||
// height: 210.sp + (item.images.isNotEmpty ? 98.sp : 0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
border: GradientBoxBorder(
|
||||
|
||||
gradient:
|
||||
AppColor.mainVerLinearGradient,
|
||||
width: 1.sp,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 1.sp, left: 1.sp, right: 1.sp),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(10.sp),
|
||||
topRight: Radius.circular(10.sp),
|
||||
),
|
||||
child: Image(
|
||||
image: AssetImage(getCircleImage("icon_list_null")),
|
||||
width: Get.width,
|
||||
fit: BoxFit.fill,
|
||||
height: 92.sp,
|
||||
)
|
||||
),
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 2.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 6.sp, left: 8.sp),
|
||||
width: 88.sp,
|
||||
height: 88.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Color(0xFF71F3F2),
|
||||
Color(0xFFF558FF),
|
||||
],
|
||||
stops: [0.0365, 0.9427],
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(2.sp),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.network(item.avatarThumb,
|
||||
width: 88.sp, height: 88.sp, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 6.sp, left: 9.sp),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
item.nickname,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: const Color.fromRGBO(247, 250, 250, 1.0),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.sp),
|
||||
if (item.gender != null)
|
||||
_buildInfoRow(item),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
// height: 55.sp, // 设置固定高度
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: 55.sp
|
||||
),
|
||||
width: Get.width,
|
||||
margin: EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft, // 文本左对齐,垂直居中
|
||||
child: Text(
|
||||
item.signature ?? '暂时还没有签名哦~',
|
||||
maxLines: 2,
|
||||
style: TextStyle(color: Colors.white, fontSize: 18.sp),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (item.interests.isNotEmpty)
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 8.sp, right: 3.sp,bottom: 5.sp),
|
||||
child: _buildInterestsListView(item.interests)),
|
||||
|
||||
if (item.images.isNotEmpty)
|
||||
Container(
|
||||
height: 98,margin: EdgeInsets.only(top: 6.sp,left: 10.sp,right: 10.sp,bottom: 10.sp),
|
||||
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
for (int i = 0; i < item.images.length; i++)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.Swiper,
|
||||
arguments: {
|
||||
'imaglist': item.images,
|
||||
'index': i
|
||||
});
|
||||
},
|
||||
child: ListAlbumItem(item.images[i], i)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget ListAlbumItem(String item, int index) {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 2.sp),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.sp),
|
||||
child: CachedNetworkImage(
|
||||
width: 88.sp,
|
||||
height: 88.sp,
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: item + "?imageView2/1/w/176/h/176/q/75",
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(var item) {
|
||||
String ageMsg =
|
||||
getAgeCOntent(item!.gender, item!.age, item!.role, item!.orientation);
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(141, 255, 248, 1.0),
|
||||
Color.fromRGBO(181, 211, 255, 1.0),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 2.sp,
|
||||
bottom: 2.sp,
|
||||
left: 10.sp,
|
||||
right: 10.sp,
|
||||
),
|
||||
child: Text(
|
||||
ageMsg,
|
||||
style: const TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
if (item.vip > 0)
|
||||
Image(
|
||||
image: AssetImage(getBaseImage(item.vip == 1 ? "vip" : 'year_vip')),
|
||||
width: 44.sp,
|
||||
height: 18.sp,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInterestsListView(List<Interest> interests) {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
children: [
|
||||
for (int index = 0; index < interests.length; index++)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.Signal_circle_list,
|
||||
arguments: interests[index].id);
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 11.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17.0),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
),
|
||||
color: const Color(0xFF392D53),
|
||||
),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(1.sp),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17.0),
|
||||
color: const Color(0xFF392D53),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 2.sp,
|
||||
bottom: 2.sp,
|
||||
left: 15.sp,
|
||||
right: 15.sp,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
interests[index].title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13.0,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _onRefresh() async {
|
||||
ctr.page = 1;
|
||||
ctr.initList();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
ctr.page = ctr.page + 1;
|
||||
ctr.initList();
|
||||
}
|
||||
}
|
||||
@ -152,197 +152,6 @@ void uploadBuzIDAndToken() async {
|
||||
}
|
||||
}
|
||||
|
||||
initPush() {
|
||||
// final TimUiKitPushPlugin cPush = TimUiKitPushPlugin(
|
||||
// isUseGoogleFCM: true, // 中国大陆版无此参数
|
||||
// );
|
||||
// cPush.init(
|
||||
// pushClickAction: pushClickAction, // 单击通知后的事件回调,会在STEP6讲解
|
||||
// appInfo: PushConfig.appInfo, // 传入STEP1做的appInfo
|
||||
// );
|
||||
}
|
||||
|
||||
//跳转发消息页面
|
||||
pushChatPage(String userId, String imId, String userName) {
|
||||
var con = V2TimConversation(
|
||||
conversationID: "c2c_$imId", userID: imId, showName: userName, type: 1);
|
||||
Get.toNamed(AppRoutes.Chat, arguments: con);
|
||||
createCustomMsg(userId, imId);
|
||||
}
|
||||
|
||||
createCustomMsg(String userId, String imId) async {
|
||||
//通过会话ID获取指定会话列表
|
||||
V2TimValueCallback<List<V2TimConversation>>
|
||||
getConversationListByConversaionIdsRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getConversationManager()
|
||||
.getConversationListByConversaionIds(
|
||||
conversationIDList: ["c2c_$imId"]); //需要获取会话列表数据的会话id列表
|
||||
if (getConversationListByConversaionIdsRes.code == 0 &&
|
||||
getConversationListByConversaionIdsRes.data!.isEmpty) {
|
||||
//获取资料,然后发送自定义卡片消息
|
||||
var data = await DioManager.instance.get(
|
||||
url: 'msg-service/user/$userId/chat/card',
|
||||
);
|
||||
if (data['code'] == 200) {
|
||||
String desc = '';
|
||||
String cityStr = '';
|
||||
Map<String, dynamic> info = {};
|
||||
|
||||
if (data['data']['both_interests'] != null) {
|
||||
List<dynamic> both_interests = data['data']['both_interests'];
|
||||
List<String> circleList = [];
|
||||
both_interests.forEach((element) {
|
||||
circleList.add(element['title']);
|
||||
});
|
||||
if (circleList.isNotEmpty) {
|
||||
info['both_interests'] =
|
||||
'你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
if (desc.isEmpty) {
|
||||
desc = '你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data['data']['both_cities'] != null) {
|
||||
List city = data['data']['both_cities'];
|
||||
print('城市' + city.toString());
|
||||
if (city.isNotEmpty) {
|
||||
desc = '你们都在${city.first}留下过足迹';
|
||||
cityStr = '你们都在${city.first}留下过足迹';
|
||||
}
|
||||
}
|
||||
|
||||
if (desc.isNotEmpty) {
|
||||
if (data['data']['both_cities'] != null) {
|
||||
info['city'] = cityStr;
|
||||
}
|
||||
info['interests'] = data['data']['interests'] ?? [];
|
||||
info['guide_text'] = data['data']['guide_text'] ?? '';
|
||||
info['my'] = data['data']['my'] ?? '';
|
||||
info['myInterests'] = data['data']['myInterests'] ?? [];
|
||||
info['user'] = data['data']['user'];
|
||||
info['guide_text'] = data['data']['guide_text'] ?? '请问现在有空吗?';
|
||||
await sendCustomMsg(imId, jsonEncode(info), desc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送文本消息
|
||||
sendTextMsg(String userId, {String content = '看看这次缘分匹配到哪位小可爱呢?'}) async {
|
||||
// 创建文本消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createTextMessage(
|
||||
text: content, // 文本信息
|
||||
);
|
||||
if (createTextMessageRes.code == 0) {
|
||||
// 文本信息创建成功
|
||||
String? id = createTextMessageRes.data?.id;
|
||||
// 发送文本消息
|
||||
// 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// 若只填写groupID则发群组消息
|
||||
// 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getMessageManager()
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
// await TencentImSDKPlugin.v2TIMManager
|
||||
// .getMessageManager()
|
||||
// .createTextAtMessage(text: '看看这次缘分匹配到哪位小可爱呢?',atUserList: [],
|
||||
// );
|
||||
// if (createCustomMessageRes.code == 0) {
|
||||
// String? id = createCustomMessageRes.data?.id;
|
||||
// // 发送自定义消息
|
||||
// // 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// // 若只填写groupID则发群组消息
|
||||
// // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
// V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
// .v2TIMManager
|
||||
// .getMessageManager()
|
||||
// .sendMessage(id: id!, receiver: userId,groupID: '');
|
||||
// if (sendMessageRes.code == 0) {
|
||||
// // 发送成功
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//发送卡片自定义消息
|
||||
sendCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'cardData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
//EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
|
||||
// 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// 若只填写groupID则发群组消息
|
||||
// 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getMessageManager()
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发送圈子自定义消息
|
||||
sendCircleCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'circleData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
//EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
|
||||
// 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// 若只填写groupID则发群组消息
|
||||
// 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getMessageManager()
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
showOKToast('发送成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@ -89,6 +89,8 @@ class Api {
|
||||
//发消息是否需要vip弹窗
|
||||
static const getIsVips = 'mall-service/vips/show/';
|
||||
|
||||
//IM状态
|
||||
static const imstate = '/user-service/user/im/state';
|
||||
|
||||
|
||||
//发视频图片消息增加计数
|
||||
@ -328,4 +330,26 @@ class Api {
|
||||
//礼物馆
|
||||
static const giftHall = '/mall-service/gift/giftHall/';
|
||||
|
||||
//速聊推荐
|
||||
static const recommendQuickChatUser = '/msg-service/recommendQuickChatUser';
|
||||
|
||||
//站外分享
|
||||
static const offSite = '/up-service/share/offSite';
|
||||
|
||||
//抢占第一
|
||||
static const startQuick = '/msg-service/startQuick';
|
||||
|
||||
|
||||
//是否开启速聊
|
||||
static const queryQuickStart = '/msg-service/queryQuickStart';
|
||||
|
||||
//不显示在速聊列表
|
||||
static const stopQuick = '/msg-service/stopQuick';
|
||||
|
||||
//呼唤30人
|
||||
static const callOthers = '/msg-service/call/others';
|
||||
|
||||
|
||||
//获取一条招呼语
|
||||
static const msgRandOne = '/msg-service/message/hello_word/randOne';
|
||||
}
|
||||
@ -42,9 +42,9 @@ class DioManager {
|
||||
// 请求基地址
|
||||
baseUrl: baseUrl,
|
||||
// 连接服务器超时时间,单位是毫秒
|
||||
connectTimeout: const Duration(seconds: 300),
|
||||
connectTimeout: const Duration(seconds: 30),
|
||||
// 接收数据的最长时限
|
||||
receiveTimeout: const Duration(seconds: 300),
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
));
|
||||
_dio!.interceptors.add(LogInterceptor(
|
||||
responseBody: true,
|
||||
@ -247,23 +247,11 @@ class DioManager {
|
||||
pushLoginPage();
|
||||
break;
|
||||
}
|
||||
if (responseMap["code"] != 200) {
|
||||
if (responseMap["code"] != 200 && responseMap["code"] != 10000) {
|
||||
showOKToast(responseMap['msg']);
|
||||
}
|
||||
}
|
||||
return responseMap;
|
||||
// switch(responseMap["code"]){
|
||||
// case 200:
|
||||
// case 30503:
|
||||
// return responseMap;
|
||||
// case 5003:
|
||||
// pushLoginPage();
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// return {'code': responseMap["code"], 'msg': responseMap["msg"]};
|
||||
// }
|
||||
return responseMap;
|
||||
} on DioException catch (e) {
|
||||
SharedPreferencesHelper sp = await SharedPreferencesHelper.getInstance();
|
||||
if (sp.getString(SharedPreferencesHelper.LOGINPHONE) == '18800000100') {
|
||||
|
||||
@ -46,6 +46,7 @@ import 'package:circle_app/app/offaccount/view.dart';
|
||||
import 'package:circle_app/app/photoinfo/binding.dart';
|
||||
import 'package:circle_app/app/photoinfo/view.dart';
|
||||
import 'package:circle_app/app/privacy/view.dart';
|
||||
import 'package:circle_app/app/quick/view.dart';
|
||||
import 'package:circle_app/app/report/binding.dart';
|
||||
import 'package:circle_app/app/report/view.dart';
|
||||
import 'package:circle_app/app/reset_pwd/binding.dart';
|
||||
@ -80,6 +81,7 @@ import '../app/good_reviews/binding.dart';
|
||||
import '../app/good_reviews/view.dart';
|
||||
import '../app/my_assets/binding.dart';
|
||||
import '../app/privacy/binding.dart';
|
||||
import '../app/quick/binding.dart';
|
||||
import '../app/splash/view.dart';
|
||||
import '../app/visitorlist/binding.dart';
|
||||
import 'app_routers.dart';
|
||||
@ -263,8 +265,9 @@ class AppPages {
|
||||
GetPage(name: AppRoutes.BillActivity, page: () => BillPage(),
|
||||
binding: BillBinding(),),
|
||||
GetPage(name: AppRoutes.GiftShopPage, page: () => Gift_shopPage(),
|
||||
binding: Gift_shopBinding(),)
|
||||
|
||||
binding: Gift_shopBinding(),),
|
||||
GetPage(name: AppRoutes.Quick, page: () => QuickPage(),
|
||||
binding: QuickBinding(),)
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@ -51,6 +51,6 @@ abstract class AppRoutes {
|
||||
|
||||
static const GiftShopPage = '/GiftShopPage';
|
||||
|
||||
|
||||
static const Quick = '/msg/quick';
|
||||
|
||||
}
|
||||
@ -16,10 +16,12 @@ import 'package:oktoast/oktoast.dart';
|
||||
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
import 'package:video_compress/video_compress.dart';
|
||||
|
||||
import '../app/circle/logic.dart';
|
||||
import '../app/select_circle/logic.dart';
|
||||
import '../network/dio_manager.dart';
|
||||
import 'SharedPreferencesHelper.dart';
|
||||
|
||||
class Util {}
|
||||
@ -483,3 +485,245 @@ Size boundingTextSize(BuildContext context, String text, TextStyle style,
|
||||
..layout(maxWidth: maxWidth);
|
||||
return textPainter.size;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//跳转发消息页面
|
||||
pushChatPage(String userId, String imId, String userName) {
|
||||
var con = V2TimConversation(
|
||||
conversationID: "c2c_$imId", userID: imId, showName: userName, type: 1);
|
||||
Get.toNamed(AppRoutes.Chat, arguments: con);
|
||||
createCustomMsg(userId, imId);
|
||||
}
|
||||
|
||||
createCustomMsg(String userId, String imId) async {
|
||||
//通过会话ID获取指定会话列表
|
||||
V2TimValueCallback<List<V2TimConversation>>
|
||||
getConversationListByConversaionIdsRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getConversationManager()
|
||||
.getConversationListByConversaionIds(
|
||||
conversationIDList: ["c2c_$imId"]); //需要获取会话列表数据的会话id列表
|
||||
if (getConversationListByConversaionIdsRes.code == 0 &&
|
||||
getConversationListByConversaionIdsRes.data!.isEmpty) {
|
||||
//获取资料,然后发送自定义卡片消息
|
||||
var data = await DioManager.instance.get(
|
||||
url: 'msg-service/user/$userId/chat/card',
|
||||
);
|
||||
if (data['code'] == 200) {
|
||||
String desc = '';
|
||||
String cityStr = '';
|
||||
Map<String, dynamic> info = {};
|
||||
|
||||
if (data['data']['both_interests'] != null) {
|
||||
List<dynamic> both_interests = data['data']['both_interests'];
|
||||
List<String> circleList = [];
|
||||
both_interests.forEach((element) {
|
||||
circleList.add(element['title']);
|
||||
});
|
||||
if (circleList.isNotEmpty) {
|
||||
info['both_interests'] =
|
||||
'你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
if (desc.isEmpty) {
|
||||
desc = '你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data['data']['both_cities'] != null) {
|
||||
List city = data['data']['both_cities'];
|
||||
print('城市' + city.toString());
|
||||
if (city.isNotEmpty) {
|
||||
desc = '你们都在${city.first}留下过足迹';
|
||||
cityStr = '你们都在${city.first}留下过足迹';
|
||||
}
|
||||
}
|
||||
|
||||
if (desc.isNotEmpty) {
|
||||
if (data['data']['both_cities'] != null) {
|
||||
info['city'] = cityStr;
|
||||
}
|
||||
info['interests'] = data['data']['interests'] ?? [];
|
||||
info['guide_text'] = data['data']['guide_text'] ?? '';
|
||||
info['my'] = data['data']['my'] ?? '';
|
||||
info['myInterests'] = data['data']['myInterests'] ?? [];
|
||||
info['user'] = data['data']['user'];
|
||||
info['guide_text'] = data['data']['guide_text'] ?? '请问现在有空吗?';
|
||||
await sendCustomMsg(imId, jsonEncode(info), desc);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//发送文本消息
|
||||
sendTextMsg(String userId, {String content = '看看这次缘分匹配到哪位小可爱呢?'}) async {
|
||||
// 创建文本消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createTextMessage(
|
||||
text: content, // 文本信息
|
||||
);
|
||||
if (createTextMessageRes.code == 0) {
|
||||
// 文本信息创建成功
|
||||
String? id = createTextMessageRes.data?.id;
|
||||
// 发送文本消息
|
||||
// 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// 若只填写groupID则发群组消息
|
||||
// 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getMessageManager()
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
// await TencentImSDKPlugin.v2TIMManager
|
||||
// .getMessageManager()
|
||||
// .createTextAtMessage(text: '看看这次缘分匹配到哪位小可爱呢?',atUserList: [],
|
||||
// );
|
||||
// if (createCustomMessageRes.code == 0) {
|
||||
// String? id = createCustomMessageRes.data?.id;
|
||||
// // 发送自定义消息
|
||||
// // 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// // 若只填写groupID则发群组消息
|
||||
// // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
// V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
// .v2TIMManager
|
||||
// .getMessageManager()
|
||||
// .sendMessage(id: id!, receiver: userId,groupID: '');
|
||||
// if (sendMessageRes.code == 0) {
|
||||
// // 发送成功
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//发送卡片自定义消息
|
||||
sendCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'cardData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
if (Get.currentRoute == AppRoutes.Chat) {
|
||||
EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
} else {
|
||||
V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
.v2TIMManager
|
||||
.getMessageManager()
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发送圈子自定义消息
|
||||
sendCircleCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'circleData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发送求送礼物自定义消息
|
||||
sendGetGiftCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'getGiftData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发送许愿自定义消息
|
||||
sendGetWishCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'getWishData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
//
|
||||
// // 在sendMessage时,若只填写receiver则发个人用户单聊消息
|
||||
// // 若只填写groupID则发群组消息
|
||||
// // 若填写了receiver与groupID则发群内的个人用户,消息在群聊中显示,只有指定receiver能看见
|
||||
// V2TimValueCallback<V2TimMessage> sendMessageRes = await TencentImSDKPlugin
|
||||
// .v2TIMManager
|
||||
// .getMessageManager()
|
||||
// .sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
// if (sendMessageRes.code == 0) {
|
||||
// // 发送成功
|
||||
// sendMessageRes.data?.customElem?.data; //自定义data
|
||||
// sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
// sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
// showOKToast('发送成功');
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//发送邀请许愿自定义消息
|
||||
sendInventWishCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'getInventWishData',
|
||||
);
|
||||
if (createCustomMessageRes.code == 0) {
|
||||
String? id = createCustomMessageRes.data?.id;
|
||||
// 发送自定义消息
|
||||
EventBusManager.fire(SendCoustomMessage(createCustomMessageRes));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -553,6 +553,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@ -829,6 +837,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
gradient_borders:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: gradient_borders
|
||||
sha256: "69eeaff519d145a4c6c213ada1abae386bcc8981a4970d923e478ce7ba19e309"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
html:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1349,6 +1365,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
protobuf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: protobuf
|
||||
sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1562,6 +1586,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
svgaplayer_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: svgaplayer_flutter
|
||||
sha256: "13ad44aabb454e0094962b260c5333662fbd2879c7f9f8d2595b3c4b79817651"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@ -107,6 +107,10 @@ dependencies:
|
||||
flutter_bugly: ^0.4.4
|
||||
#图片压缩
|
||||
flutter_image_compress: ^1.1.3
|
||||
#SVGA显示控件
|
||||
svgaplayer_flutter: ^2.2.0
|
||||
#边框渐变
|
||||
gradient_borders: ^1.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user