2.0.2代码提交

This commit is contained in:
CYH 2024-03-06 15:01:18 +08:00
parent 8f674b5f78
commit 6efa96a0d6
22 changed files with 621 additions and 352 deletions

View File

@ -71,8 +71,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21 minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode 52 versionCode 53
versionName "2.0.2" versionName "2.0.3"
manifestPlaceholders = [ manifestPlaceholders = [
vivo_APPID: "105669716", vivo_APPID: "105669716",
vivo_APPKEY:"84f750207787376b310ca5b0d5969122", vivo_APPKEY:"84f750207787376b310ca5b0d5969122",

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -315,7 +315,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios" :path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
SPEC CHECKSUMS: SPEC CHECKSUMS:
app_settings: 54b8813f690b34f757c0bf97a46637bed5acc76c app_settings: d103828c9f5d515c4df9ee754dabd443f7cedcf3
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
BMKLocationKit: a93bc412af3a601f12d243f4fb83f77650103e56 BMKLocationKit: a93bc412af3a601f12d243f4fb83f77650103e56
Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da Bugly: b8715e6ec4004b7f7fbffab0643ba80545aee3da

View File

@ -383,7 +383,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.5; MARKETING_VERSION = 2.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -534,7 +534,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.5; MARKETING_VERSION = 2.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -579,7 +579,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.4.5; MARKETING_VERSION = 2.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp; PRODUCT_BUNDLE_IDENTIFIER = com.example.kyApp;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

View File

@ -743,7 +743,8 @@ class _TIMTextFieldLayoutNarrowState
getImageFile(); getImageFile();
}, },
child: child:
Image.asset(getMsgImage('photo'), width: 40.sp), Opacity(opacity: 0.75,
child: Image.asset(getMsgImage('photo'), width: 40.sp)),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
@ -754,8 +755,10 @@ class _TIMTextFieldLayoutNarrowState
} }
getTakeImageFile(); getTakeImageFile();
}, },
child: Image.asset(getMsgImage('take_photo'), child: Opacity(opacity: 0.75,
width: 40.sp), child: Image.asset(getMsgImage('take_photo'),
width: 40.sp),
),
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
@ -780,8 +783,10 @@ class _TIMTextFieldLayoutNarrowState
} }
getVideoFile(ImageSource.gallery); getVideoFile(ImageSource.gallery);
}, },
child: Image.asset(getMsgImage('icon_video'), child: Opacity(opacity: 0.75,
width: 40.sp), child: Image.asset(getMsgImage('icon_video'),
width: 40.sp),
),
), ),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
@ -792,8 +797,10 @@ class _TIMTextFieldLayoutNarrowState
} }
getVideoFile(ImageSource.camera); getVideoFile(ImageSource.camera);
}, },
child: Image.asset(getMsgImage('icon_video_camera'), child: Opacity(opacity: 0.75,
width: 40.sp), child: Image.asset(getMsgImage('icon_video_camera'),
width: 40.sp),
),
), ),
], ],
), ),
@ -884,6 +891,10 @@ class _TIMTextFieldLayoutNarrowState
); );
} }
opacityWidget(Widget child) {
return Opacity(opacity: 0.75,child: widget,);
}
chatActionWidget(String img, String action, GestureTapCallback onTap) { chatActionWidget(String img, String action, GestureTapCallback onTap) {
return GestureDetector( return GestureDetector(
onTap: onTap, onTap: onTap,

View File

@ -9,6 +9,7 @@ import 'package:circle_app/network/api.dart';
import 'package:circle_app/network/dio_manager.dart'; import 'package:circle_app/network/dio_manager.dart';
import 'package:circle_app/router/app_routers.dart'; import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart'; import 'package:circle_app/util/util.dart';
import 'package:circle_app/view/notice.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -16,13 +17,12 @@ import 'package:tencent_cloud_chat_uikit/business_logic/view_models/tui_chat_glo
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart'; import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart'; import 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart';
import '../../common/colors/app_color.dart';
import '../../util/eventBus.dart'; import '../../util/eventBus.dart';
import '../userinfo/logic.dart'; import '../userinfo/logic.dart';
class ChatPage extends StatefulWidget { class ChatPage extends StatefulWidget {
ChatPage({Key? key}) : super(key: key);
ChatPage({Key? key})
: super(key: key);
@override @override
State<ChatPage> createState() => _ChatPageState(); State<ChatPage> createState() => _ChatPageState();
@ -32,6 +32,10 @@ class _ChatPageState extends State<ChatPage> {
// final logic = Get.find<ChatLogic>(); // final logic = Get.find<ChatLogic>();
// //
// final state = Get.find<ChatLogic>().state; // final state = Get.find<ChatLogic>().state;
bool isShowTip = false;
String tip = 'Ta主页形象质量不错哦您也完善一下呗点击前往';
@override @override
void dispose() { void dispose() {
// TODO: implement dispose // TODO: implement dispose
@ -40,9 +44,9 @@ class _ChatPageState extends State<ChatPage> {
} }
final TIMUIKitChatController _timuiKitChatController = final TIMUIKitChatController _timuiKitChatController =
TIMUIKitChatController(); TIMUIKitChatController();
V2TimConversation con = Get.arguments; V2TimConversation con = Get.arguments;
User? userInfoBean; UserBean? userInfoBean;
UserBean? otherUserBean; UserBean? otherUserBean;
String conversationID = ''; String conversationID = '';
bool isBlack = false; bool isBlack = false;
@ -54,25 +58,26 @@ class _ChatPageState extends State<ChatPage> {
super.initState(); super.initState();
initEventBus(); initEventBus();
loadMyInfo(); loadMyInfo();
loadUserData();
} }
void loadIsShowSendGiftDialogData() async { void loadIsShowSendGiftDialogData() async {
var data = await DioManager.instance.get(url: Api.isShow_give_gift + conversationID.split('_').last); var data = await DioManager.instance
.get(url: Api.isShow_give_gift + conversationID.split('_').last);
if (data['code'] == 200) { if (data['code'] == 200) {
if (data['data']) { if (data['data']) {
Get.bottomSheet(SendGiftDialog(accid: conversationID,title: data['msg'],), isScrollControlled: true, Get.bottomSheet(
SendGiftDialog(
accid: conversationID,
title: data['msg'],
),
isScrollControlled: true,
enableDrag: false); enableDrag: false);
} }
} }
} }
loadUserData() async { loadUserData() async {
conversationID = con!.conversationID!; conversationID = con!.conversationID!;
String url = "${Api.getUserInfoTA + conversationID.split('_').last}/home"; String url = "${Api.getUserInfoTA + conversationID.split('_').last}/home";
var data = await DioManager.instance.get(url: url); var data = await DioManager.instance.get(url: url);
@ -82,48 +87,71 @@ class _ChatPageState extends State<ChatPage> {
if (bean.isSuccess()) { if (bean.isSuccess()) {
otherUserBean = bean.data.user; otherUserBean = bean.data.user;
if (!isShowTip) {
setState(() { fetchMyAlbum(Api.getMyAlbum);
}
}); setState(() {});
} }
loadIsShowSendGiftDialogData(); loadIsShowSendGiftDialogData();
} }
Future<void> fetchMyAlbum(String url) async {
var myAlbumData = await DioManager.instance.get(url: url);
var myAlbumBean = BaseResponse<AlbumResponseBean>.fromJson(
myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData));
initEventBus()async{ if (myAlbumBean.isSuccess()) {
sub = EventBusManager.on<SendCoustomMessage>().listen((event) async{ List list = myAlbumBean.data.lists ?? [];
V2TimValueCallback<V2TimMessage>? sendMessageRes = if (list.isEmpty) {
await _timuiKitChatController.sendMessage( isShowTip = true;
messageInfo: event.createCustomMessageRes?.data?.messageInfo); tip = '您还没上传照片,上传后更方便了解,点击前往';
if (sendMessageRes!.code == 0) { setState(() {
//
if (sendMessageRes.data?.customElem?.extension != 'cardData') {
showOKToast('发送成功');
}
//
sendMessageRes.data?.customElem?.data; //data
sendMessageRes.data?.customElem?.desc; //desc
sendMessageRes.data?.customElem?.extension; //extension
}
});
});
} else {
if (otherUserBean!.userType == 1 && userInfoBean!.userType != 1) {
isShowTip = true;
setState(() {
});
}
}
}
} }
Widget renderCustomStickerPanel({
sendTextMessage, initEventBus() async {
sendFaceMessage, sub = EventBusManager.on<SendCoustomMessage>().listen((event) async {
deleteText, V2TimValueCallback<V2TimMessage>? sendMessageRes =
addCustomEmojiText, await _timuiKitChatController.sendMessage(
addText, messageInfo: event.createCustomMessageRes?.data?.messageInfo);
List<CustomEmojiFaceData> defaultCustomEmojiStickerList = const [], if (sendMessageRes!.code == 0) {
double? height, //
double? width if (sendMessageRes.data?.customElem?.extension != 'cardData') {
}) { showOKToast('发送成功');
}
//
sendMessageRes.data?.customElem?.data; //data
sendMessageRes.data?.customElem?.desc; //desc
sendMessageRes.data?.customElem?.extension; //extension
}
});
}
Widget renderCustomStickerPanel(
{sendTextMessage,
sendFaceMessage,
deleteText,
addCustomEmojiText,
addText,
List<CustomEmojiFaceData> defaultCustomEmojiStickerList = const [],
double? height,
double? width}) {
final defaultEmojiList = final defaultEmojiList =
defaultCustomEmojiStickerList.map((customEmojiPackage) { defaultCustomEmojiStickerList.map((customEmojiPackage) {
return CustomStickerPackage( return CustomStickerPackage(
name: customEmojiPackage.name, name: customEmojiPackage.name,
baseUrl: "assets/custom_face_resource/${customEmojiPackage.name}", baseUrl: "assets/custom_face_resource/${customEmojiPackage.name}",
@ -133,7 +161,7 @@ class _ChatPageState extends State<ChatPage> {
.asMap() .asMap()
.keys .keys
.map((idx) => .map((idx) =>
CustomSticker(index: idx, name: customEmojiPackage.list[idx])) CustomSticker(index: idx, name: customEmojiPackage.list[idx]))
.toList(), .toList(),
menuItem: CustomSticker( menuItem: CustomSticker(
index: 0, index: 0,
@ -141,8 +169,8 @@ class _ChatPageState extends State<ChatPage> {
)); ));
}).toList(); }).toList();
return StickerPanel( return StickerPanel(
// height: 100.sp, // height: 100.sp,
backgroundColor:Colors.transparent, backgroundColor: Colors.transparent,
showBottomContainer: true, showBottomContainer: true,
sendTextMsg: sendTextMessage, sendTextMsg: sendTextMessage,
sendFaceMsg: (index, data) => sendFaceMsg: (index, data) =>
@ -158,103 +186,185 @@ class _ChatPageState extends State<ChatPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// //
return TIMChat( return Stack(
conversation: con, fit: StackFit.expand,
customStickerPanel: renderCustomStickerPanel, children: [
// onTapAvatar :(String userId,TapDownDetails tapDownDetails)async{ TIMChat(
// var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last,preventDuplicates: false); conversation: con,
// // setState(() { customStickerPanel: renderCustomStickerPanel,
// // // onTapAvatar :(String userId,TapDownDetails tapDownDetails)async{
// // }); // var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last,preventDuplicates: false);
// }, // // setState(() {
controller : _timuiKitChatController, // //
config: TIMUIKitChatConfig( // // });
// },
controller: _timuiKitChatController,
config: TIMUIKitChatConfig(
// 使
isAllowClickAvatar: true,
isUseDefaultEmoji: true,
isAllowLongPressMessage: true,
isShowReadingStatus: true,
isShowGroupReadingStatus: true,
notificationTitle: "",
isUseMessageReaction: true,
notificationBody:
(V2TimMessage message, String convID, ConvType convType) {
// V2TIM_ELEM_TYPE_NONE = 0, ///<
// V2TIM_ELEM_TYPE_TEXT = 1, ///<
// V2TIM_ELEM_TYPE_CUSTOM = 2, ///<
// V2TIM_ELEM_TYPE_IMAGE = 3, ///<
// V2TIM_ELEM_TYPE_SOUND = 4, ///<
// V2TIM_ELEM_TYPE_VIDEO = 5, ///<
// V2TIM_ELEM_TYPE_FILE = 6, ///<
// V2TIM_ELEM_TYPE_LOCATION = 7, ///<
// V2TIM_ELEM_TYPE_FACE = 8, ///<
// V2TIM_ELEM_TYPE_GROUP_TIPS = 9, ///< Tips
// V2TIM_ELEM_TYPE_MERGER = 10, ///<
// 使 if (userInfoBean == null) {
isAllowClickAvatar: true, loadMyInfo();
isUseDefaultEmoji: true, }
isAllowLongPressMessage: true,
isShowReadingStatus: true,
isShowGroupReadingStatus: true,
notificationTitle: "",
isUseMessageReaction: true,
notificationBody: (V2TimMessage message, String convID, ConvType convType) {
// V2TIM_ELEM_TYPE_NONE = 0, ///<
// V2TIM_ELEM_TYPE_TEXT = 1, ///<
// V2TIM_ELEM_TYPE_CUSTOM = 2, ///<
// V2TIM_ELEM_TYPE_IMAGE = 3, ///<
// V2TIM_ELEM_TYPE_SOUND = 4, ///<
// V2TIM_ELEM_TYPE_VIDEO = 5, ///<
// V2TIM_ELEM_TYPE_FILE = 6, ///<
// V2TIM_ELEM_TYPE_LOCATION = 7, ///<
// V2TIM_ELEM_TYPE_FACE = 8, ///<
// V2TIM_ELEM_TYPE_GROUP_TIPS = 9, ///< Tips
// V2TIM_ELEM_TYPE_MERGER = 10, ///<
if (userInfoBean == null) { if (message.elemType == 1) {
loadMyInfo(); return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty
} ? (userInfoBean!.nickname ?? '昵称待审核') + ':'
: '') +
if (message.elemType ==1) { message.textElem!.text! ??
return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + message.textElem!.text! ?? ''; '';
} else if (message.elemType == 3) { } else if (message.elemType == 3) {
return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一张图片'; return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty
} else if (message.elemType == 4) { ? (userInfoBean!.nickname ?? '昵称待审核') + ':'
return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条语音'; : '') +
} else if (message.elemType == 5) { '发了一张图片';
return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条视频'; } else if (message.elemType == 4) {
} else { return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty
return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty ? (userInfoBean!.nickname ?? '昵称待审核') +':' : '') + '发了一条消息'; ? (userInfoBean!.nickname ?? '昵称待审核') + ':'
} : '') +
'发了一条语音';
}, } else if (message.elemType == 5) {
groupReadReceiptPermissionList: [ return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty
GroupReceiptAllowType.work, ? (userInfoBean!.nickname ?? '昵称待审核') + ':'
GroupReceiptAllowType.meeting, : '') +
GroupReceiptAllowType.public '发了一条视频';
], } else {
), return ((userInfoBean!.nickname ?? '昵称待审核').isNotEmpty
customAppBar:MyAppBar( ? (userInfoBean!.nickname ?? '昵称待审核') + ':'
centerTitle: '', : '') +
actionWdiget: GestureDetector( '发了一条消息';
onTap: () { }
Get.bottomSheet( },
MoreDialog( groupReadReceiptPermissionList: [
GroupReceiptAllowType.work,
GroupReceiptAllowType.meeting,
GroupReceiptAllowType.public
],
),
customAppBar: MyAppBar(
centerTitle: '',
actionWdiget: GestureDetector(
onTap: () {
Get.bottomSheet(
MoreDialog(
sessionId: conversationID, sessionId: conversationID,
userId: (otherUserBean?.id ?? 0) > 0 ? otherUserBean!.id!.toString() : '', userId: (otherUserBean?.id ?? 0) > 0
? otherUserBean!.id!.toString()
: '',
deleteMsgCallBack: () { deleteMsgCallBack: () {
// context.read<ChatViewModel>().clearMsg(); // context.read<ChatViewModel>().clearMsg();
// ChatViewModel viewModel = context.read<ChatViewModel>(); // ChatViewModel viewModel = context.read<ChatViewModel>();
// viewModel.messageList.clear(); // viewModel.messageList.clear();
// viewModel.notifyListeners(); // viewModel.notifyListeners();
},blackCallBack: () { },
blackCallBack: () {
loadUserData(); loadUserData();
},), },
isScrollControlled: true); ),
// defaultAvatarTap(widget.sessionId, isSelf:false); isScrollControlled: true);
}, // defaultAvatarTap(widget.sessionId, isSelf:false);
child: Image.asset( },
getMsgImage('msg_more'), child: Image.asset(
width: 24.sp, getMsgImage('msg_more'),
)), width: 24.sp,
onPressed: () {}, )),
onPressed: () {},
),
userAvatarBuilder: (BuildContext context, V2TimMessage message) {
return avatarWidget(
(message.faceUrl?.isNotEmpty ?? false)
? message.faceUrl!
: 'https://qiniuyun.leyuan666.com/quanzi/avatar/default.png',
message!);
},
), ),
if (isShowTip)
userAvatarBuilder: (BuildContext context, V2TimMessage message) { Positioned(child: tipWidget(tip)),
return avatarWidget((message.faceUrl?.isNotEmpty ?? false) ? message.faceUrl! : 'https://qiniuyun.leyuan666.com/quanzi/avatar/default.png',message!); ],
},
); );
} }
avatarWidget(String url,V2TimMessage message, {double width = 34}) { tipWidget(String tip) {
return Column(
children: [
GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity)!.then((value) {
loadMyInfo();
});
},
child: Container(
width: Get.width - 16,
height: 40.sp,
margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top + 45),
padding: EdgeInsets.fromLTRB(16.sp, 0.sp, 16.sp, 0.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xFF353443),
),
child: Row(
children: [
Expanded(
child: Text(
tip,
style: TextStyle(
color: Colors.white,
fontSize: 13.sp,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
GestureDetector(
onTap: () {
isShowTip = false;
setState(() {
});
},
child: Icon(
Icons.close,
size: 20,
color: AppColor.mainColor,
),
)
],
),
),
),
],
);
}
avatarWidget(String url, V2TimMessage message, {double width = 34}) {
print(url); print(url);
return GestureDetector( return GestureDetector(
onTap: () async { onTap: () async {
// V2TimConversation con = Get.arguments; // V2TimConversation con = Get.arguments;
// if (message.sender == con.userID.toString()) return; // if (message.sender == con.userID.toString()) return;
var data = await Get.toNamed(AppRoutes.UserInfoActivity,arguments: message.sender!.toString().split('_').last,preventDuplicates: false); var data = await Get.toNamed(AppRoutes.UserInfoActivity,
}, arguments: message.sender!.toString().split('_').last,
preventDuplicates: false);
},
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
@ -262,27 +372,31 @@ class _ChatPageState extends State<ChatPage> {
getCircleImage('avatar_bg'), getCircleImage('avatar_bg'),
width: width.sp, width: width.sp,
), ),
url.contains("http") ? ClipOval( url.contains("http")
child: CachedNetworkImage( ? ClipOval(
imageUrl:url, child: CachedNetworkImage(
width: (width - 2).sp, imageUrl: url,
height: (width - 2).sp, width: (width - 2).sp,
fit: BoxFit.cover, height: (width - 2).sp,
), fit: BoxFit.cover,
) : Text(url,style: TextStyle(color: Color(0xffF756FF),fontSize: 12.sp),) ),
)
: Text(
url,
style: TextStyle(color: Color(0xffF756FF), fontSize: 12.sp),
)
], ],
)); ));
} }
void loadMyInfo() async { void loadMyInfo() async {
var data = await DioManager.instance.get(url: Api.getUserMine); var data = await DioManager.instance.get(url: Api.getUserMine);
if (data['code'] == 200) { var bean = BaseResponse<ResponseBean>.fromJson(
var bean = BaseResponse<MineResponseBean>.fromJson( data, (data) => ResponseBean.fromJson(data));
data, (data) => MineResponseBean.fromJson(data));
if (bean.isSuccess()) {
userInfoBean = bean.data.user!;
} if (bean.code == 200) {
userInfoBean = bean.data.user!;
loadUserData();
} }
} }
@ -290,82 +404,78 @@ class _ChatPageState extends State<ChatPage> {
return userInfoBean == null return userInfoBean == null
? Container() ? Container()
: GestureDetector( : GestureDetector(
onTap: () { onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity, Get.toNamed(AppRoutes.UserInfoActivity,
arguments: userInfoBean!.id!.toString()); arguments: userInfoBean!.id!.toString());
}, },
child: Container( child: Container(
margin: margin: EdgeInsets.only(left: 0 > 99 ? 80.sp : 65.sp),
EdgeInsets.only(left: 0 > 99 ? 80.sp : 65.sp), child: Row(
child: Row( children: [
children: [ ClipOval(
ClipOval( child: Image.network(
child: Image.network( otherUserBean!.avatar!,
otherUserBean!.avatar!, width: 40.sp,
width: 40.sp, height: 40.sp,
height: 40.sp, fit: BoxFit.cover,
fit: BoxFit.cover, )),
)), SizedBox(
SizedBox( width: 4.sp,
width: 4.sp, ),
// Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// userInfoBean!.nickname ?? '昵称待审核',
// style: TextStyle(
// color: Colors.white,
// fontSize:
// ((otherUserBean!.onlineFlag ?? '').isNotEmpty)
// ? 14.sp
// : 16.sp),
// ),
// if ((otherUserBean!.onlineFlag ?? '').isNotEmpty)
// Text(
// otherUserBean!.onlineFlag ?? '',
// style: TextStyle(
// color: Colors.white.withOpacity(0.75),
// fontSize: 12.sp),
// ),
// ],
// ),
// if (otherUserBean!.! <= 1 ))
// GestureDetector(
// onTap: () {
// if (userInfoBean!.followStatus! <= 1) {
// setFollow();
// } else {
// addFollowHeader();
// }
// },
// child: Container(
// margin: EdgeInsets.only(
// left: 5.sp,
// ),
// padding: EdgeInsets.only(left: 4.sp, right: 4.sp),
// height: 22.sp,
// decoration: BoxDecoration(
// gradient: AppColor.newMainVerLinearGradient,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Center(
// child: Text(
// userInfoBean!.followStatus! <= 1 ? '关注' : '+特别关心',
// style: TextStyle(
// fontSize: 12.sp, color: Colors.white)),
// ),
// ),
// ),
],
),
), ),
// Column( );
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// userInfoBean!.nickname ?? '昵称待审核',
// style: TextStyle(
// color: Colors.white,
// fontSize:
// ((otherUserBean!.onlineFlag ?? '').isNotEmpty)
// ? 14.sp
// : 16.sp),
// ),
// if ((otherUserBean!.onlineFlag ?? '').isNotEmpty)
// Text(
// otherUserBean!.onlineFlag ?? '',
// style: TextStyle(
// color: Colors.white.withOpacity(0.75),
// fontSize: 12.sp),
// ),
// ],
// ),
// if (otherUserBean!.! <= 1 ))
// GestureDetector(
// onTap: () {
// if (userInfoBean!.followStatus! <= 1) {
// setFollow();
// } else {
// addFollowHeader();
// }
// },
// child: Container(
// margin: EdgeInsets.only(
// left: 5.sp,
// ),
// padding: EdgeInsets.only(left: 4.sp, right: 4.sp),
// height: 22.sp,
// decoration: BoxDecoration(
// gradient: AppColor.newMainVerLinearGradient,
// borderRadius: BorderRadius.circular(14),
// ),
// child: Center(
// child: Text(
// userInfoBean!.followStatus! <= 1 ? '关注' : '+特别关心',
// style: TextStyle(
// fontSize: 12.sp, color: Colors.white)),
// ),
// ),
// ),
],
),
),
);
} }
} }
class ChatLoadUserInfoData {}
class ChatLoadUserInfoData {
}

View File

@ -522,8 +522,6 @@ class CircleLogic extends GetxController {
if (info.isNotEmpty) { if (info.isNotEmpty) {
newPeopleList.addAll(info); newPeopleList.addAll(info);
} }
newPeopleList.addAll(list);
pageIndex = pageIndex + 1; pageIndex = pageIndex + 1;
} else { } else {
peopleRefreshController.loadNoData(); peopleRefreshController.loadNoData();

View File

@ -688,7 +688,7 @@ class _CirclePageState extends State<CirclePage>
}, },
child: Image.asset( child: Image.asset(
getCircleImage('clocked_icon'), getCircleImage('clocked_icon'),
width: 50.sp, width: 65.sp,
), ),
)), )),
Container( Container(
@ -813,7 +813,7 @@ class _CirclePageState extends State<CirclePage>
// SizedBox(width: 2.sp,), // SizedBox(width: 2.sp,),
Container( Container(
margin: EdgeInsets.only(top: 4.sp), margin: EdgeInsets.only(top: 4.sp),
child: Text( child: Text(
'30', '30',
style: TextStyle( style: TextStyle(

View File

@ -387,7 +387,9 @@ class _DiscoverState extends State<Discover>
Get.toNamed(AppRoutes.Swiper, Get.toNamed(AppRoutes.Swiper,
arguments: { arguments: {
'imaglist': imgList, 'imaglist': imgList,
'index': index 'index': index,
'userId':user.userId.toString()
}); });
}, },
child: CachedNetworkImage( child: CachedNetworkImage(

View File

@ -98,7 +98,8 @@ class _DiscoverItemState extends State<DiscoverItem> {
Get.toNamed(AppRoutes.Swiper, Get.toNamed(AppRoutes.Swiper,
arguments: { arguments: {
'imaglist': imgList, 'imaglist': imgList,
'index': index 'index': index,
'userId':user.id.toString()
}); });
}, },
child: CachedNetworkImage( child: CachedNetworkImage(

View File

@ -697,12 +697,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
for (var element in lists.chat!.users!) { for (var element in lists.chat!.users!) {
widgets.add(Positioned( widgets.add(Positioned(
left: 12.sp * index, left: 12.sp * index,
child: GestureDetector( child: circleWidget(element.avatar!,element.id.toString(), width: 24),
onTap: () {
// pushOtherPeopleHomePage(element.id.toString());
},
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
),
)); ));
index++; index++;
} }
@ -723,14 +718,14 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
Album info = lists.album!.first; Album info = lists.album!.first;
if (info.type == 1) { if (info.type == 1) {
double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3; double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45;
if (lists.album!.length > 3) { if (lists.album!.length > 3) {
picHeight = picWidth * 2; picHeight = picWidth * 2;
} else { } else {
picHeight = picWidth; picHeight = picWidth;
} }
} else { } else {
picHeight = 140.sp; picHeight = 200.sp;
} }
} }
} }
@ -937,15 +932,6 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
borderRadius: BorderRadius.circular(6.sp), borderRadius: BorderRadius.circular(6.sp),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: album.url!, imageUrl: album.url!,
// placeholder: (context, url) =>
// SizedBox(
// width: 30.sp,
// height: 30.sp,
// child: CircularProgressIndicator(
// color: Color(0xFF07FAFB),
// strokeWidth: 2.sp,
// ),
// ),
errorWidget: (context, url, error) => errorWidget: (context, url, error) =>
const Icon(Icons.error), const Icon(Icons.error),
fit: BoxFit.cover, fit: BoxFit.cover,
@ -990,8 +976,6 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
GestureDetector( GestureDetector(
onTap: () { onTap: () {
pushMsgPage(lists, widget.bean.id.toString(),); pushMsgPage(lists, widget.bean.id.toString(),);
// pushHomePage(
// lists, widget.bean.id.toString());
}, },
child: Image.asset( child: Image.asset(
getCircleImage('chat'), getCircleImage('chat'),
@ -1016,19 +1000,19 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
); );
double picHeight = 0.0; double picHeight = 0.0;
double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3 + 45;
if (lists.album != null) { if (lists.album != null) {
if (lists.album!.isNotEmpty) { if (lists.album!.isNotEmpty) {
Album info = lists.album!.first; Album info = lists.album!.first;
if (info.type == 1) { if (info.type == 1) {
double picWidth = (Get.width - (widget.logic.runtimeType == LikeLogic ? 100.sp : 60.sp))/3;
if (lists.album!.length > 3) { if (lists.album!.length > 3) {
picHeight = picWidth * 2; picHeight = picWidth * 2;
} else { } else {
picHeight = picWidth; picHeight = picWidth;
} }
} else { } else {
picHeight = 140.sp; picHeight = 200.sp;
} }
} }
} }
@ -1038,11 +1022,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
lists.chat!.users!.forEach((element) { lists.chat!.users!.forEach((element) {
widgets.add(Positioned( widgets.add(Positioned(
left: 12.sp * index, left: 12.sp * index,
child: GestureDetector( child: circleWidget(element.avatar!,element.id.toString(), width: 24),
onTap: () {
},
child: circleWidget(element.avatar!,element.id.toString(), width: 24),
),
)); ));
index++; index++;
}); });
@ -1224,7 +1204,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
height: picHeight, height: picHeight,
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 5.sp), margin: EdgeInsets.only(top: 5.sp),
child: picHeight == 140.sp child: picHeight == 200.sp
? ClipRRect( ? ClipRRect(
borderRadius: BorderRadius.circular(6.sp), borderRadius: BorderRadius.circular(6.sp),
child: VideoItemWidget(lists.album![0].url!)) child: VideoItemWidget(lists.album![0].url!))
@ -1236,7 +1216,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
crossAxisCount: 3, //widget crossAxisCount: 3, //widget
crossAxisSpacing: 8.sp, crossAxisSpacing: 8.sp,
mainAxisSpacing: 8.sp, mainAxisSpacing: 8.sp,
childAspectRatio: 1.0 //1widget childAspectRatio:0.7 //1widget
), ),
itemBuilder: (contentxt, currentIndex) { itemBuilder: (contentxt, currentIndex) {
Album album = lists.album![currentIndex]; Album album = lists.album![currentIndex];
@ -1459,7 +1439,27 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
circleWidget(String url, String userId,{double width = 24}) { circleWidget(String url, String userId,{double width = 24}) {
return GestureDetector( return GestureDetector(
onTap: (){ onTap: () async {
if (widget.bean.is_limit&&widget.bean.amount > 0) {
await refreshCircleData();
}
if (widget.bean.is_limit&&widget.bean.amount>0) {
showJoinCiclePiker(widget.bean.id.toString(),widget.bean.amount.toString(),widget.bean.oldAmount.toString(),1,(payResult){
widget.bean.is_limit = false;
if (Get.isRegistered<CircleLogic>()) {
var logic = Get.find<CircleLogic>();
for (var element in logic.circle.lists) {
if (element.id == widget.bean.id) {
element.is_limit = false;
element.isJoin = true;
}
}
logic.update();
}
Get.back();
},widget.bean.ios_item);
return;
}
Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId); Get.toNamed(AppRoutes.UserInfoActivity, arguments: userId);
}, },
child: Stack( child: Stack(

View File

@ -596,14 +596,14 @@ class _LikeViewState extends State<LikeView>
Album info = lists.album!.first; Album info = lists.album!.first;
if (info.type == 1) { if (info.type == 1) {
double picWidth = (Get.width - 20.sp) / 3; double picWidth = (Get.width - 100.sp) / 3 + 40;
if (lists.album!.length > 3) { if (lists.album!.length > 3) {
picHeight = picWidth * 2; picHeight = picWidth * 2;
} else { } else {
picHeight = picWidth; picHeight = picWidth;
} }
} else { } else {
picHeight = 140.sp; picHeight = 200.sp;
} }
} }
} }
@ -787,7 +787,7 @@ class _LikeViewState extends State<LikeView>
crossAxisCount: 3, //widget crossAxisCount: 3, //widget
crossAxisSpacing: 8.sp, crossAxisSpacing: 8.sp,
mainAxisSpacing: 8.sp, mainAxisSpacing: 8.sp,
childAspectRatio: 1.0 //1widget childAspectRatio: 0.7 //1widget
), ),
itemBuilder: (contentxt, currentIndex) { itemBuilder: (contentxt, currentIndex) {
Album album = lists.album![currentIndex]; Album album = lists.album![currentIndex];
@ -799,7 +799,8 @@ class _LikeViewState extends State<LikeView>
} }
Get.toNamed(AppRoutes.Swiper, arguments: { Get.toNamed(AppRoutes.Swiper, arguments: {
'imaglist': imgList, 'imaglist': imgList,
'index': currentIndex 'index': currentIndex,
'userId':lists.user!.id.toString()
}); });
}, },
child: ClipRRect( child: ClipRRect(
@ -902,14 +903,14 @@ class _LikeViewState extends State<LikeView>
Album info = lists.album!.first; Album info = lists.album!.first;
if (info.type == 1) { if (info.type == 1) {
double picWidth = (Get.width - 20.sp) / 3; double picWidth = (Get.width - 100.sp) / 3 + 40;
if (lists.album!.length > 3) { if (lists.album!.length > 3) {
picHeight = picWidth * 2; picHeight = picWidth * 2;
} else { } else {
picHeight = picWidth; picHeight = picWidth;
} }
} else { } else {
picHeight = 140.sp; picHeight = 200.sp;
} }
} }
} }
@ -1103,7 +1104,7 @@ class _LikeViewState extends State<LikeView>
crossAxisSpacing: 8.sp, crossAxisSpacing: 8.sp,
mainAxisSpacing: 8.sp, mainAxisSpacing: 8.sp,
childAspectRatio: childAspectRatio:
1.0 //1widget 0.7 //1widget
), ),
itemBuilder: (contentxt, currentIndex) { itemBuilder: (contentxt, currentIndex) {
Album album = lists.album![currentIndex]; Album album = lists.album![currentIndex];
@ -1122,7 +1123,8 @@ class _LikeViewState extends State<LikeView>
Get.toNamed(AppRoutes.Swiper, Get.toNamed(AppRoutes.Swiper,
arguments: { arguments: {
'imaglist': imgList, 'imaglist': imgList,
'index': currentIndex 'index': currentIndex,
'userId':lists.user!.id.toString()
}); });
}, },
child: ClipRRect( child: ClipRRect(

View File

@ -374,7 +374,8 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
Get.toNamed(AppRoutes.Swiper, Get.toNamed(AppRoutes.Swiper,
arguments: { arguments: {
'imaglist': item.images, 'imaglist': item.images,
'index': i 'index': i,
// 'userId': item.id.toString()
}); });
}, },
child: ListAlbumItem(item.images[i], i)), child: ListAlbumItem(item.images[i], i)),

View File

@ -177,6 +177,7 @@ class Sys_notify_listLogic extends GetxController {
void onRefresh() async { void onRefresh() async {
page = 0; page = 0;
next = 0; next = 0;
lists.clear();
initList(); initList();
} }

View File

@ -281,7 +281,7 @@ class QuickPage extends StatelessWidget {
child: _buildInterestsListView(item.interests)), child: _buildInterestsListView(item.interests)),
if (item.images.isNotEmpty) if (item.images.isNotEmpty)
Container( Container(
height: 98, height: 130,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 6.sp, left: 10.sp, right: 10.sp, bottom: 10.sp), top: 6.sp, left: 10.sp, right: 10.sp, bottom: 10.sp),
child: SingleChildScrollView( child: SingleChildScrollView(
@ -295,7 +295,8 @@ class QuickPage extends StatelessWidget {
onTap: () { onTap: () {
Get.toNamed(AppRoutes.Swiper, arguments: { Get.toNamed(AppRoutes.Swiper, arguments: {
'imaglist': item.images, 'imaglist': item.images,
'index': i 'index': i,
'userId':item.id.toString()
}); });
}, },
child: ListAlbumItem(item.images[i], i)), child: ListAlbumItem(item.images[i], i)),
@ -315,7 +316,7 @@ class QuickPage extends StatelessWidget {
borderRadius: BorderRadius.circular(8.sp), borderRadius: BorderRadius.circular(8.sp),
child: CachedNetworkImage( child: CachedNetworkImage(
width: 88.sp, width: 88.sp,
height: 88.sp, height: 130.sp,
fit: BoxFit.cover, fit: BoxFit.cover,
imageUrl: item + "?imageView2/1/w/176/h/176/q/75", imageUrl: item + "?imageView2/1/w/176/h/176/q/75",
), ),

View File

@ -7,11 +7,15 @@ class SwiperLogic extends GetxController {
final SwiperState state = SwiperState(); final SwiperState state = SwiperState();
List<String> imgList = Get.arguments['imaglist'] ; List<String> imgList = Get.arguments['imaglist'] ;
int index = Get.arguments['index'] ; int index = Get.arguments['index'] ;
String userId = '';
SwiperController swiperController = SwiperController(); SwiperController swiperController = SwiperController();
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
Map arg = Get.arguments;
if (arg.containsKey('userId')) {
userId = arg['userId'];
}
} }
@override @override
void onReady() { void onReady() {

View File

@ -13,6 +13,7 @@ import 'package:get/get_state_manager/src/simple/get_state.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import '../../router/app_routers.dart';
import '../home/logic.dart'; import '../home/logic.dart';
import 'logic.dart'; import 'logic.dart';
import 'dart:ui' as ui; import 'dart:ui' as ui;
@ -113,7 +114,51 @@ class _SwiperPageState extends State<SwiperPage> {
size: 25.sp, size: 25.sp,
), ),
), ),
)) )),
if (logic.userId.isNotEmpty)
Positioned(
right: 16.sp,
top: 16.sp,
child: SafeArea(
child: GestureDetector(
onTap: () {
Get.toNamed(AppRoutes.UserInfoActivity,
arguments: logic.userId);
Get.delete<SwiperLogic>();
},
child: Container(
width: 73.sp,
height: 25.sp,
decoration: BoxDecoration(
gradient:
AppColor.mainVerLinearGradient,
borderRadius:
BorderRadius.circular(12.5.sp)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
margin: EdgeInsets.only(left: 5.sp),
child: Text(
'查看主页',
style: TextStyle(
color: Colors.white,
fontSize: 10.sp,
),
),
),
Image(
width: 15.sp,
image: AssetImage(
getDisCoverImage("right_icon")),
// width: 44.sp,
),
],
),
),
),
)),
], ],
), ),
), ),

View File

@ -429,6 +429,7 @@ class UserBean {
int role; int role;
int mark; int mark;
int orientation; int orientation;
int userType;
List<Interest> interests; List<Interest> interests;
List orientations; List orientations;
double lng; double lng;
@ -449,6 +450,7 @@ class UserBean {
required this.age, required this.age,
required this.signature, required this.signature,
required this.vip, required this.vip,
required this.userType,
required this.gender, required this.gender,
required this.hide_wx_num, required this.hide_wx_num,
required this.orientations, required this.orientations,
@ -471,6 +473,7 @@ class UserBean {
factory UserBean.fromJson(Map<String, dynamic> json) { factory UserBean.fromJson(Map<String, dynamic> json) {
return UserBean( return UserBean(
id: json['id'], id: json['id'],
userType: json['userType'] ?? 0,
currentCity: json['currentCity'] ?? '', currentCity: json['currentCity'] ?? '',
hide_wx_num: json['hide_wx_num'] ?? 0, hide_wx_num: json['hide_wx_num'] ?? 0,
orientations: json['orientations'] ?? [], orientations: json['orientations'] ?? [],
@ -488,7 +491,7 @@ class UserBean {
gender: json['gender'], gender: json['gender'],
role: json['role'], role: json['role'],
orientation: json['orientation'], orientation: json['orientation'],
interests: List<Interest>.from( interests: json['interests'] == null ? [] : List<Interest>.from(
json['interests'].map((x) => Interest.fromJson(x)), json['interests'].map((x) => Interest.fromJson(x)),
), ),
lng: json['lng'], lng: json['lng'],

View File

@ -672,28 +672,31 @@ class _SearchAnimationWidgetState extends State<SearchAnimationWidget>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
AnimatedBuilder( Stack(
animation: _controller, children: [
builder: (context, child) { Image.asset(getCircleImage('search_bg_icon'),width: 90.sp,),
return Transform.translate( AnimatedBuilder(
offset: Offset( animation: _controller,
30.0 * math.cos(2 * math.pi * _controller.value), builder: (context, child) {
30.0 * math.sin(2 * math.pi * _controller.value), return Container(
), margin: EdgeInsets.only(left: 30.sp,top: 30.sp),
child: IconButton( child: Transform.translate(
icon: Icon( offset: Offset(
Icons.search, 30.0 * math.cos(2 * math.pi * _controller.value),
color: Colors.white, 30.0 * math.sin(2 * math.pi * _controller.value),
size: 50.sp, ),
), child: Image.asset(
onPressed: () { getCircleImage('search_icon'),
//
}, width: 27.sp,
), ),
); ),
}), );
}),
],
),
Container( Container(
margin: EdgeInsets.only(top: 50.sp), margin: EdgeInsets.only(top: 20.sp),
child: Text( child: Text(
'正在为您匹配合适的那个Ta', '正在为您匹配合适的那个Ta',
style: TextStyle(color: Colors.white, fontSize: 16.sp), style: TextStyle(color: Colors.white, fontSize: 16.sp),

View File

@ -9,34 +9,30 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../main.dart'; import '../main.dart';
import '../router/app_routers.dart';
typedef void NoticeCallback(); typedef void NoticeCallback();
void showFloatingButtonOverlay(BuildContext context, String nickname,
void showFloatingButtonOverlay( String ageMsg, String avatar, int event, NoticeCallback noticeCallback) {
BuildContext context, String nickname, String ageMsg, String avatar,int event,NoticeCallback noticeCallback) {
OverlayState? overlayState = Overlay.of(context); OverlayState? overlayState = Overlay.of(context);
late OverlayEntry overlayEntry; late OverlayEntry overlayEntry;
bool showMessage = false; bool showMessage = false;
int countdownSeconds = 5; // int countdownSeconds = 5; //
// Timer // Timer
late Timer countdownTimer; late Timer countdownTimer;
// OverlayEntry // OverlayEntry
overlayEntry = OverlayEntry( overlayEntry = OverlayEntry(
builder: (BuildContext context) { builder: (BuildContext context) {
return Stack( return Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
Positioned( Positioned(
top: MediaQuery.of(context).padding.top, top: MediaQuery.of(context).padding.top,
// right: 16, // right: 16,
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut, curve: Curves.easeInOut,
@ -109,13 +105,14 @@ void showFloatingButtonOverlay(
], ],
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( event == 0 Text(
? "看了这么久,给我点个喜欢呗~" event == 0
: event == 1 ? "看了这么久,给我点个喜欢呗~"
? "我喜欢了你,可以喜欢我一下吗?" : event == 1
: event == 2 ? "我喜欢了你,可以喜欢我一下吗?"
? "你喜欢的人上线啦,赶紧找他聊天吧!" : event == 2
: "我也喜欢了你,一起聊聊呗~", ? "你喜欢的人上线啦,赶紧找他聊天吧!"
: "我也喜欢了你,一起聊聊呗~",
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
fontSize: 13.sp, fontSize: 13.sp,
@ -131,9 +128,7 @@ void showFloatingButtonOverlay(
countdownTimer.cancel(); countdownTimer.cancel();
try { try {
overlayEntry!.remove(); overlayEntry!.remove();
} catch (e) { } catch (e) {}
}
mainOverlayEntry = null; mainOverlayEntry = null;
noticeCallback(); noticeCallback();
@ -162,10 +157,10 @@ void showFloatingButtonOverlay(
event == 0 event == 0
? "喜欢" ? "喜欢"
: event == 1 : event == 1
? "回关" ? "回关"
: event == 2 : event == 2
? "私聊" ? "私聊"
: "私聊", : "私聊",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 14.sp, fontSize: 14.sp,
@ -181,31 +176,34 @@ void showFloatingButtonOverlay(
), ),
), ),
if (event == 0) if (event == 0)
Positioned( Positioned(
top: MediaQuery.of(context).padding.top, top: MediaQuery.of(context).padding.top,
right: 8, right: 8,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
countdownTimer.cancel(); countdownTimer.cancel();
// //
try { try {
overlayEntry!.remove(); overlayEntry!.remove();
} catch (e) { } catch (e) {}
mainOverlayEntry = null;
} },
mainOverlayEntry = null; child: Container(
}, height: 20,
child: Container( width: 30,
height: 20, decoration: BoxDecoration(
width: 30, borderRadius: BorderRadius.only(
decoration: BoxDecoration( topRight: Radius.circular(10),
borderRadius: BorderRadius.only(topRight: Radius.circular(10),bottomLeft: Radius.circular(10)), bottomLeft: Radius.circular(10)),
gradient: AppColor.mainVerLinearGradient gradient: AppColor.mainVerLinearGradient),
alignment: Alignment.center,
child: Icon(
Icons.close,
size: 20,
color: Colors.white,
),
), ),
alignment: Alignment.center, ))
child: Icon(Icons.close,size: 20,color: Colors.white,),
),
))
], ],
); );
}, },
@ -216,16 +214,105 @@ void showFloatingButtonOverlay(
countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) { countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) {
if (countdownSeconds > 0) { if (countdownSeconds > 0) {
countdownSeconds--; countdownSeconds--;
// overlayEntry.markNeedsBuild(); // OverlayEntry // overlayEntry.markNeedsBuild(); // OverlayEntry
} else { } else {
// //
timer.cancel(); timer.cancel();
try { try {
overlayEntry!.remove(); overlayEntry!.remove();
} catch (e) { } catch (e) {}
mainOverlayEntry = null;
} }
});
// OverlayEntry Overlay
overlayState?.insert(overlayEntry!);
}
void showTipFloatingButtonOverlay(BuildContext context, String tip) {
OverlayState? overlayState = Overlay.of(context);
late OverlayEntry overlayEntry;
bool showMessage = false;
int countdownSeconds = 5; //
// Timer
late Timer countdownTimer;
// OverlayEntry
overlayEntry = OverlayEntry(
builder: (BuildContext context) {
return Column(
children: [
GestureDetector(
onTap: () {
countdownTimer.cancel();
//
try {
overlayEntry!.remove();
} catch (e) {}
mainOverlayEntry = null;
Get.toNamed(AppRoutes.UserInfoActivity);
},
child: Container(
width: Get.width - 16,
height: 40.sp,
margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top + 45),
padding: EdgeInsets.fromLTRB(16.sp, 0.sp, 16.sp, 0.sp),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xFF353443).withOpacity(0.5),
),
child: Row(
children: [
Expanded(
child: Text(
tip,
style: TextStyle(
color: Colors.grey,
fontSize: 13.sp,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
)),
GestureDetector(
onTap: () {
countdownTimer.cancel();
//
try {
overlayEntry!.remove();
} catch (e) {}
mainOverlayEntry = null;
},
child: Icon(
Icons.close,
size: 20,
color: AppColor.mainColor,
),
)
],
),
),
),
],
);
},
);
// setState(() {});
showMessage = true;
mainOverlayEntry = overlayEntry;
countdownTimer = Timer.periodic(Duration(seconds: 1), (timer) {
if (countdownSeconds > 0) {
countdownSeconds--;
// overlayEntry.markNeedsBuild(); // OverlayEntry
} else {
//
timer.cancel();
try {
overlayEntry!.remove();
} catch (e) {}
mainOverlayEntry = null; mainOverlayEntry = null;
} }
}); });

View File

@ -112,7 +112,7 @@ dependencies:
#边框渐变 #边框渐变
gradient_borders: ^1.0.0 gradient_borders: ^1.0.0
#系统设置 #系统设置
app_settings: 4.0.4 app_settings: 4.3.1
#百度定位插件 #百度定位插件
flutter_bmflocation: ^3.6.0 flutter_bmflocation: ^3.6.0