android 闪屏和一些优化
This commit is contained in:
parent
5f009adf7a
commit
2fc4b89bc3
Binary file not shown.
|
Before Width: | Height: | Size: 546 KiB After Width: | Height: | Size: 88 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 284 KiB |
@ -273,8 +273,15 @@ class AccountPage extends StatelessWidget {
|
||||
top: 40.0.sp, left: 72.0.sp, right: 72.0.sp),
|
||||
height: 42.sp,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(21.0.sp),
|
||||
color: const Color(0xFF21BEAB),
|
||||
borderRadius: BorderRadius.circular(21),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
|
||||
@ -77,6 +77,7 @@ class BlacklistPage extends StatelessWidget {
|
||||
imageUrl: item.avatar,
|
||||
width: 53.sp,
|
||||
height: 53.sp,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -331,7 +331,7 @@ class Call_outLogic extends GetxController {
|
||||
}
|
||||
|
||||
SmartDialog.showLoading();
|
||||
upDataImage(quToken,pickedFile!,CONFIG.CALL_OUT_IMAGE,(result){
|
||||
uploadImage(quToken,pickedFile!,CONFIG.CALL_OUT_IMAGE,(result){
|
||||
SmartDialog.dismiss();
|
||||
state.imaglist.add(result);
|
||||
update();
|
||||
@ -373,6 +373,7 @@ class Call_outLogic extends GetxController {
|
||||
showToast("最多上传1个视频哦~");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final XFile? pickedFile = await _picker.pickVideo(
|
||||
source: ImageSource.gallery,
|
||||
@ -381,39 +382,82 @@ class Call_outLogic extends GetxController {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading();
|
||||
var path = await getApplicationSupportDirectoryPath();
|
||||
compressVideo(pickedFile.path, path, (result) async {
|
||||
print(result);
|
||||
videoPlayerController = VideoPlayerController.file(
|
||||
File(result),
|
||||
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
||||
);
|
||||
await videoPlayerController?.initialize();
|
||||
final Duration videoDuration = videoPlayerController!.value.duration;
|
||||
final double durationInSeconds = videoDuration.inSeconds.toDouble();
|
||||
print(durationInSeconds.toString());
|
||||
if (durationInSeconds >= 5 && durationInSeconds <= 30) {
|
||||
videoPlayerController?.setLooping(true);
|
||||
videoPlayerController?.addListener(() {
|
||||
if (!videoPlayerController!.value.isPlaying) {
|
||||
// Navigator.pop(context);
|
||||
}
|
||||
});
|
||||
// var path = await getApplicationSupportDirectoryPath();
|
||||
videoPlayerController = VideoPlayerController.file(
|
||||
File(pickedFile.path),
|
||||
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
||||
);
|
||||
await videoPlayerController?.initialize();
|
||||
final Duration videoDuration = videoPlayerController!.value.duration;
|
||||
final double durationInSeconds = videoDuration.inSeconds.toDouble();
|
||||
if (durationInSeconds >= 5 && durationInSeconds <= 30) {
|
||||
videoPlayerController?.setLooping(true);
|
||||
videoPlayerController?.addListener(() {
|
||||
if (!videoPlayerController!.value.isPlaying) {
|
||||
// Navigator.pop(context);
|
||||
}
|
||||
});
|
||||
|
||||
updataQiniu(result, pickedFile.name, CONFIG.CALL_OUT_VIDEO, quToken,
|
||||
(result) {
|
||||
SmartDialog.dismiss();
|
||||
state.videolist.add(result);
|
||||
update();
|
||||
});
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
showToast("请上传5-30秒的视频");
|
||||
}
|
||||
});
|
||||
uploadQiniu(pickedFile.path, pickedFile.name, CONFIG.CALL_OUT_VIDEO, quToken,
|
||||
(result) {
|
||||
SmartDialog.dismiss();
|
||||
state.videolist.add(result);
|
||||
update();
|
||||
});
|
||||
} else {
|
||||
SmartDialog.dismiss();
|
||||
showToast("请上传5-30秒的视频,当前视频长度为:$durationInSeconds""秒");
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
|
||||
//压缩 感觉越压越大
|
||||
// try {
|
||||
// final XFile? pickedFile = await _picker.pickVideo(
|
||||
// source: ImageSource.gallery,
|
||||
// );
|
||||
// if(null==pickedFile){
|
||||
// return;
|
||||
// }
|
||||
// SmartDialog.showLoading();
|
||||
// var path = await getApplicationSupportDirectoryPath();
|
||||
//
|
||||
//
|
||||
// compressVideo(pickedFile.path, path, (result) async {
|
||||
// print(result);
|
||||
// videoPlayerController = VideoPlayerController.file(
|
||||
// File(result),
|
||||
// videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
||||
// );
|
||||
// await videoPlayerController?.initialize();
|
||||
// final Duration videoDuration = videoPlayerController!.value.duration;
|
||||
// final double durationInSeconds = videoDuration.inSeconds.toDouble();
|
||||
// print("////////////");
|
||||
// print(durationInSeconds.toString());
|
||||
// if (durationInSeconds >= 5 && durationInSeconds <= 30) {
|
||||
// videoPlayerController?.setLooping(true);
|
||||
// videoPlayerController?.addListener(() {
|
||||
// if (!videoPlayerController!.value.isPlaying) {
|
||||
// // Navigator.pop(context);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// updataQiniu(result, pickedFile.name, CONFIG.CALL_OUT_VIDEO, quToken,
|
||||
// (result) {
|
||||
// SmartDialog.dismiss();
|
||||
// state.videolist.add(result);
|
||||
// update();
|
||||
// });
|
||||
// } else {
|
||||
// SmartDialog.dismiss();
|
||||
// showToast("请上传5-30秒的视频");
|
||||
// }
|
||||
// });
|
||||
// } catch (e) {}
|
||||
}
|
||||
|
||||
|
||||
Future<ClosedCaptionFile> _loadCaptions(BuildContext context) async {
|
||||
final String fileContents = await DefaultAssetBundle.of(context)
|
||||
.loadString('assets/bumble_bee_captions.vtt');
|
||||
|
||||
@ -456,7 +456,7 @@ class _TIMUIKItHistoryMessageListItemState
|
||||
children: [
|
||||
Container(
|
||||
|
||||
margin: EdgeInsets.only(right: 5.sp),
|
||||
margin: EdgeInsets.only(right: 2.sp),
|
||||
width: 3,
|
||||
height: 3,
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@ -284,6 +284,7 @@ class _TIMSendSoundMessageState extends TIMUIKitState<TIMSendSoundMessage> {
|
||||
final TUIChatSeparateViewModel model =
|
||||
Provider.of<TUIChatSeparateViewModel>(context);
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTapDown: (detail) async {
|
||||
if (!isInit) {
|
||||
bool hasMicrophonePermission = await Permissions.checkPermission(
|
||||
@ -303,7 +304,7 @@ class _TIMSendSoundMessageState extends TIMUIKitState<TIMSendSoundMessage> {
|
||||
onLongPressCancel: onLonePressCancel,
|
||||
child: Container(
|
||||
height: 35,
|
||||
color: isRecording ? theme.weakBackgroundColor : Colors.white,
|
||||
// color: isRecording ? theme.weakBackgroundColor : Colors.white,
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
TIM_t("按住说话"),
|
||||
@ -311,7 +312,7 @@ class _TIMSendSoundMessageState extends TIMUIKitState<TIMSendSoundMessage> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: theme.darkTextColor,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -234,9 +234,7 @@ class _TUIChatState extends TIMUIKitState<TIMChat> {
|
||||
}
|
||||
try {
|
||||
model.dispose();
|
||||
} catch (e) {
|
||||
|
||||
};
|
||||
} catch (e) {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,9 @@ 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 'package:tencent_cloud_chat_uikit/ui/controller/tim_uikit_chat_controller.dart';
|
||||
|
||||
import '../../util/eventBus.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class ChatPage extends StatefulWidget {
|
||||
@ -24,6 +26,30 @@ class _ChatPageState extends State<ChatPage> {
|
||||
//
|
||||
// final state = Get.find<ChatLogic>().state;
|
||||
|
||||
final TIMUIKitChatController _timuiKitChatController =
|
||||
TIMUIKitChatController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
initEventBus();
|
||||
}
|
||||
|
||||
initEventBus()async{
|
||||
EventBusManager.on<SendCoustomMessage>().listen((event) async{
|
||||
V2TimValueCallback<V2TimMessage>? sendMessageRes =
|
||||
await _timuiKitChatController.sendMessage(
|
||||
messageInfo: event.createCustomMessageRes?.data?.messageInfo);
|
||||
if (sendMessageRes!.code == 0) {
|
||||
// 发送成功
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
sendMessageRes.data?.customElem?.desc; //自定义desc
|
||||
sendMessageRes.data?.customElem?.extension; //自定义extension
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Widget renderCustomStickerPanel({
|
||||
sendTextMessage,
|
||||
sendFaceMessage,
|
||||
@ -72,6 +98,10 @@ class _ChatPageState extends State<ChatPage> {
|
||||
return TIMChat(
|
||||
conversation: Get.arguments,
|
||||
customStickerPanel: renderCustomStickerPanel,
|
||||
onTapAvatar :(String userId,TapDownDetails tapDownDetails){
|
||||
Get.toNamed(AppRoutes.UserInfoActivity,arguments: userId.toString().split('_').last);
|
||||
},
|
||||
controller : _timuiKitChatController,
|
||||
config: const TIMUIKitChatConfig(
|
||||
// 仅供演示,非全部配置项,实际使用中,可只传和默认项不同的参数,无需传入所有开关
|
||||
isAllowClickAvatar: true,
|
||||
@ -81,6 +111,8 @@ class _ChatPageState extends State<ChatPage> {
|
||||
isShowGroupReadingStatus: true,
|
||||
notificationTitle: "",
|
||||
isUseMessageReaction: true,
|
||||
|
||||
|
||||
groupReadReceiptPermissionList: [
|
||||
GroupReceiptAllowType.work,
|
||||
GroupReceiptAllowType.meeting,
|
||||
@ -93,7 +125,7 @@ class _ChatPageState extends State<ChatPage> {
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.UserInfoActivity,arguments: con.userID.toString().split('_').last);
|
||||
},
|
||||
child: Text('TA的主页',style: TextStyle(color: Color(0xFF00FFF4),fontSize:12.sp,fontWeight: FontWeight.w500),),
|
||||
child: Text('TA的主页',style: TextStyle(color: const Color(0xFF00FFF4),fontSize:12.sp,fontWeight: FontWeight.w500),),
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
@ -106,6 +138,7 @@ class _ChatPageState extends State<ChatPage> {
|
||||
}
|
||||
|
||||
avatarWidget(String url, {double width = 34}) {
|
||||
print(url);
|
||||
return GestureDetector(
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
|
||||
@ -13,8 +13,8 @@ class CircleLogic extends GetxController {
|
||||
PageController(initialPage: 1, viewportFraction: 0.8);
|
||||
InterestsBean circle = InterestsBean(lists: []);
|
||||
final CircleState state = CircleState();
|
||||
|
||||
Map? statistics;
|
||||
var statistics = Rx<DataModel>(DataModel(visitCount: 0, lastVisitUsers: [], likeMeCount: 0));
|
||||
//Map? statistics;
|
||||
int page = 1;
|
||||
|
||||
bool isMore = true;
|
||||
@ -95,9 +95,12 @@ class CircleLogic extends GetxController {
|
||||
loadCirclePeopleData() async {
|
||||
var data = await DioManager.instance
|
||||
.get(url: Api.getInterestsCount);
|
||||
var myAlbumBean = BaseResponse<DataModel>.fromJson(
|
||||
data, (data) => DataModel.fromJson(data));
|
||||
|
||||
if (data['code'] == 200) {
|
||||
statistics = data['data'];
|
||||
update();
|
||||
statistics.value = myAlbumBean.data;
|
||||
// update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,3 +234,21 @@ class LastJoinUser {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DataModel {
|
||||
int visitCount = 0;
|
||||
|
||||
List<dynamic> lastVisitUsers = [];
|
||||
|
||||
int likeMeCount = 0;
|
||||
|
||||
DataModel({required this.visitCount, required this.lastVisitUsers, required this.likeMeCount});
|
||||
|
||||
factory DataModel.fromJson(Map<String, dynamic> json) {
|
||||
return DataModel(
|
||||
visitCount: json['visit_count'],
|
||||
lastVisitUsers: json['last_visit_users'],
|
||||
likeMeCount: json['like_me_count'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ class _CirclePageState extends State<CirclePage>
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF423055),
|
||||
color: const Color(0xFF423055),
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fill,
|
||||
image: AssetImage(getBaseImage('home_back')))),
|
||||
@ -49,7 +49,11 @@ class _CirclePageState extends State<CirclePage>
|
||||
children: [
|
||||
Container(
|
||||
child: Column(children: [
|
||||
navigatorItem(),
|
||||
Container(
|
||||
child: Obx(() {
|
||||
return navigatorItem(controller.statistics.value);
|
||||
}),
|
||||
),
|
||||
// Text(controller.state.msg),
|
||||
//组件使用
|
||||
Expanded(
|
||||
@ -103,11 +107,11 @@ class _CirclePageState extends State<CirclePage>
|
||||
});
|
||||
}
|
||||
|
||||
navigatorItem() {
|
||||
Widget navigatorItem(DataModel statistics) {
|
||||
List<String> urlList = [];
|
||||
List infoList = [];
|
||||
if (logic.statistics != null) {
|
||||
infoList = logic.statistics!["last_visit_users"];
|
||||
if (statistics != null) {
|
||||
infoList = statistics.lastVisitUsers;
|
||||
if (infoList.isNotEmpty) {
|
||||
for (var element in infoList) {
|
||||
urlList.add(element["avatar"]);
|
||||
@ -117,21 +121,18 @@ class _CirclePageState extends State<CirclePage>
|
||||
|
||||
List<Widget> widgets = [];
|
||||
|
||||
for (int i = 0 ; i < urlList.length; i++) {
|
||||
for (int i = 0; i < urlList.length; i++) {
|
||||
var element = urlList[i];
|
||||
widgets.add(Positioned(
|
||||
left: 15.sp * i,
|
||||
|
||||
child: circleWidget(element),
|
||||
),
|
||||
);
|
||||
child: circleWidget(element),
|
||||
));
|
||||
}
|
||||
if (logic.statistics != null && widgets.isNotEmpty) {
|
||||
if (statistics != null && widgets.isNotEmpty) {
|
||||
widgets.add(Positioned(
|
||||
left: 15.sp * urlList.length,
|
||||
child: circleWidget(logic.statistics!['visit_count'].toString()),
|
||||
),
|
||||
);
|
||||
child: circleWidget(statistics.visitCount.toString()),
|
||||
));
|
||||
}
|
||||
|
||||
return Container(
|
||||
@ -142,21 +143,21 @@ class _CirclePageState extends State<CirclePage>
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.VisitorListActivity);
|
||||
},
|
||||
child: Container(
|
||||
|
||||
width: 30.sp * widgets.length,
|
||||
height: 44.sp,
|
||||
child: Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: widgets,
|
||||
),
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.VisitorListActivity);
|
||||
},
|
||||
child: Container(
|
||||
width: 30.sp * widgets.length,
|
||||
height: 44.sp,
|
||||
child: Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: widgets,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
ShaderMask(
|
||||
shaderCallback: (Rect bounds) {
|
||||
return const LinearGradient(
|
||||
@ -168,25 +169,25 @@ class _CirclePageState extends State<CirclePage>
|
||||
child: Text(
|
||||
'发现',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
shadows: const [
|
||||
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
|
||||
]),
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
shadows: const [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.MyCircle,arguments: '');
|
||||
},
|
||||
child: Image.asset(
|
||||
getCircleImage('my_circle'),
|
||||
width: 64.sp,
|
||||
),
|
||||
)),
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.MyCircle, arguments: '');
|
||||
},
|
||||
child: Image.asset(
|
||||
getCircleImage('my_circle'),
|
||||
width: 64.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@ -64,7 +64,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
||||
scrollController.position.maxScrollExtent) {
|
||||
loadMore();
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch (_) {}
|
||||
});
|
||||
circleId = widget.bean.id
|
||||
.toString();
|
||||
@ -167,7 +167,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
||||
|
||||
var sp = await SharedPreferencesHelper.getInstance();
|
||||
String myUserId = sp.getMyUserId();
|
||||
if (bean.user!.id.toString().contains(myUserId)) {
|
||||
if (bean.user!.id.toString() == myUserId) {
|
||||
showToast('无法与自己私聊');
|
||||
return;
|
||||
}
|
||||
@ -634,7 +634,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
||||
SizedBox(
|
||||
width: 8.sp,
|
||||
),
|
||||
lists.user!.vip==null|| lists.user!.vip! == 0
|
||||
lists.user?.vip != null && lists.user!.vip == 0
|
||||
? Container()
|
||||
: Image.asset(
|
||||
getCircleImage('vip'),
|
||||
@ -929,7 +929,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
||||
SizedBox(
|
||||
width: 8.sp,
|
||||
),
|
||||
lists.user!.vip==null|| lists.user!.vip! == 0
|
||||
lists.user?.vip != null && lists.user!.vip == 0
|
||||
? Container()
|
||||
: Image.asset(
|
||||
getCircleImage('vip'),
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_install_app/flutter_install_app.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
@ -117,7 +118,7 @@ class _CustomDialogState extends State<UpdateDialog> {
|
||||
value: myProgress,
|
||||
backgroundColor: Colors.grey,
|
||||
valueColor: const AlwaysStoppedAnimation<Color>(
|
||||
Colors.blue),
|
||||
Color(0xFF30FFD9)),
|
||||
strokeWidth: 4.0.sp,
|
||||
),
|
||||
),
|
||||
@ -207,7 +208,7 @@ class _CustomDialogState extends State<UpdateDialog> {
|
||||
// SmartDialog.dismiss();
|
||||
print(error);
|
||||
});
|
||||
// await AppInstaller.installApk(filePath, actionRequired: false);
|
||||
await AppInstaller.installApk(filePath, actionRequired: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ class FeedbackLogic extends GetxController {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading();
|
||||
upDataImage(quToken,pickedFile,CONFIG.USER_INFO_AVATAR,(result){
|
||||
uploadImage(quToken,pickedFile,CONFIG.USER_INFO_AVATAR,(result){
|
||||
SmartDialog.dismiss(force: true);
|
||||
state.imaglist.add(result);
|
||||
update();
|
||||
|
||||
@ -171,58 +171,79 @@ class HelpPage extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
Get.toNamed(AppRoutes.FeedbackActivity);
|
||||
// Handle feedback button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_feedback_write"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: const Text(
|
||||
'意见反馈',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
Container(
|
||||
height: 35.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
Get.toNamed(AppRoutes.FeedbackActivity);
|
||||
// Handle feedback button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_feedback_write"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: const Text(
|
||||
'意见反馈',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Colors.transparent, // Set this to transparent to make the container's gradient visible
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 4.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.sp),
|
||||
TextButton.icon(
|
||||
onPressed: () {
|
||||
// Handle contact service button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_service"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'联系客服',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
Container(
|
||||
height: 35.sp,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF21BEAB),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16.sp, vertical: 4.sp),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20.sp),
|
||||
child: TextButton.icon(
|
||||
onPressed: () {
|
||||
// Handle contact service button press
|
||||
},
|
||||
icon: Image.asset(
|
||||
getMineImage("im_service"),
|
||||
width: 14.sp,
|
||||
height: 14.sp,
|
||||
),
|
||||
label: Text(
|
||||
'联系客服',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14.sp,
|
||||
),
|
||||
),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: Colors.transparent, // Set this to transparent to make the container's gradient visible
|
||||
padding: EdgeInsets.symmetric(horizontal: 16.sp, vertical: 4.sp),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -4,8 +4,8 @@ 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:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../circle/view.dart';
|
||||
@ -40,6 +40,7 @@ class HomeLogic extends GetxController {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
FlutterNativeSplash.remove();
|
||||
var data = await DioManager.instance.get(url: Api.APP_VERSION);
|
||||
var bean = BaseResponse<UpdateInfo>.fromJson(
|
||||
data, (data) => UpdateInfo.fromJson(data));
|
||||
|
||||
@ -8,7 +8,7 @@ import 'package:get/get.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
HomePage({Key? key}) : super(key: key);
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
@ -23,6 +23,7 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
|
||||
return GetBuilder(builder: (HomeLogic controller) {
|
||||
return GestureDetector(
|
||||
@ -59,7 +60,7 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
controller: controller.pageController,
|
||||
onPageChanged: (int index) {
|
||||
controller.updateIndex(index);
|
||||
// controller.updateIndex(index);
|
||||
},
|
||||
children: controller.tabs,
|
||||
),
|
||||
@ -71,19 +72,25 @@ class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin
|
||||
}
|
||||
|
||||
funcItem(int index, String image, bool isSelected, HomeLogic controller) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
if (!isSelected) {
|
||||
controller.pageController.jumpToPage(index);
|
||||
controller.updateIndex(index);
|
||||
}
|
||||
},
|
||||
child: Image.asset(
|
||||
isSelected
|
||||
? getTabbarImage('${image}_selected')
|
||||
: getTabbarImage('${image}_normal'),
|
||||
width: 34.sp,
|
||||
height: 34.sp,
|
||||
return SizedBox(
|
||||
width: 80,
|
||||
|
||||
height: 36,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
if (!isSelected) {
|
||||
controller.pageController.jumpToPage(index);
|
||||
controller.updateIndex(index);
|
||||
}
|
||||
},
|
||||
child: Image.asset(
|
||||
isSelected
|
||||
? getTabbarImage('${image}_selected')
|
||||
: getTabbarImage('${image}_normal'),
|
||||
width: 34.sp,
|
||||
height: 34.sp,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:flutter_pickers/time_picker/model/pduration.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -16,6 +17,13 @@ import '../../userinfo/logic.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class Complete_materialLogic extends GetxController {
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
FlutterNativeSplash.remove();
|
||||
}
|
||||
final Complete_materialState state = Complete_materialState();
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
var type = Get.arguments ?? "";
|
||||
@ -102,15 +110,12 @@ class Complete_materialLogic extends GetxController {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading();
|
||||
upDataImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){
|
||||
uploadImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){
|
||||
SmartDialog.dismiss(force: true);
|
||||
headUrl = result;
|
||||
update();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@ -13,6 +14,12 @@ import '../../../util/SharedPreferencesHelper.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class LoginLogic extends GetxController {
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
FlutterNativeSplash.remove();
|
||||
}
|
||||
@override
|
||||
void onInit() async{
|
||||
// TODO: implement onInit
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import '../../router/app_routers.dart';
|
||||
import '../../util/SharedPreferencesHelper.dart';
|
||||
import '../../util/eventBus.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'state.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@ -12,8 +13,8 @@ class MinefragmentLogic extends GetxController {
|
||||
final MinefragmentState state = MinefragmentState();
|
||||
User? userInfoBean;
|
||||
String ageMsg = "";
|
||||
var isVip = 0;
|
||||
var like_count = 0;
|
||||
var isVip = 0.obs;
|
||||
var likeCount = 0;
|
||||
var like_me_count = 0;
|
||||
var recent_visit_count = 0;
|
||||
|
||||
@ -34,6 +35,10 @@ class MinefragmentLogic extends GetxController {
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
getMode();
|
||||
EventBusManager.on<CommentVipEvent>().listen((event) {
|
||||
isVip.value = event.vip;
|
||||
// update();
|
||||
});
|
||||
}
|
||||
|
||||
getMode() async {
|
||||
@ -41,7 +46,7 @@ class MinefragmentLogic extends GetxController {
|
||||
var bean = BaseResponse<MineResponseBean>.fromJson(
|
||||
data, (data) => MineResponseBean.fromJson(data));
|
||||
if (bean.isSuccess()) {
|
||||
like_count = bean.data.likeCount ?? 0;
|
||||
likeCount = bean.data.likeCount ?? 0;
|
||||
like_me_count = bean.data.likeMeCount ?? 0;
|
||||
recent_visit_count = bean.data.recentVisitCount ?? 0;
|
||||
joinedCircle = "${"加入了${bean.data.joininterestcount}"}个圈子";
|
||||
@ -76,10 +81,10 @@ class MinefragmentLogic extends GetxController {
|
||||
role = userInfoBean!.role;
|
||||
age = userInfoBean!.age;
|
||||
orientation = userInfoBean!.orientation;
|
||||
isVip = userInfoBean!.vip;
|
||||
isVip.value = userInfoBean!.vip;
|
||||
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setInt(SharedPreferencesHelper.VIP, isVip);
|
||||
sharedPreferences.setInt(SharedPreferencesHelper.VIP, isVip.value);
|
||||
sharedPreferences.setInt(
|
||||
SharedPreferencesHelper.USERID, userInfoBean!.id);
|
||||
});
|
||||
@ -93,9 +98,7 @@ class MinefragmentLogic extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
jumpSetUp() {
|
||||
Get.toNamed(AppRoutes.SetUpActivity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class User {
|
||||
|
||||
@ -223,7 +223,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
logic.like_count.toString(),
|
||||
logic.likeCount.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
@ -512,12 +512,21 @@ class MinefragmentPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
SizedBox(width: 6.sp),
|
||||
logic.isVip>0 ?
|
||||
Image(
|
||||
image: AssetImage(getBaseImage("vip")),
|
||||
width: 44.sp,
|
||||
height: 18.sp,
|
||||
):Container(),
|
||||
Obx(() {
|
||||
return logic.isVip.value > 0 ? Image(
|
||||
image: AssetImage(getBaseImage("vip")),
|
||||
width: 44.sp,
|
||||
height: 18.sp,
|
||||
) : Container();
|
||||
}),
|
||||
|
||||
|
||||
// logic.isVip>0 ?
|
||||
// Image(
|
||||
// image: AssetImage(getBaseImage("vip")),
|
||||
// width: 44.sp,
|
||||
// height: 18.sp,
|
||||
// ):Container(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
|
||||
// Alignment(0.52, 0.52)
|
||||
gradient: LinearGradient(
|
||||
colors: isPined
|
||||
? [Color(0xFF4B3E5E), Color(0xFF334141)]
|
||||
? [const Color(0xFF4B3E5E), const Color(0xFF334141)]
|
||||
: [Colors.transparent, Colors.transparent])),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@ -165,7 +165,7 @@ class TIMConversationItem extends TIMUIKitStatelessWidget {
|
||||
children: [
|
||||
ClipOval(
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: faceUrl,
|
||||
imageUrl: faceUrl==""?"http://qiniuyun.ikuayou.com/avatar/default/default_header.png":faceUrl,
|
||||
fit: BoxFit.cover,
|
||||
width: isDesktopScreen ? 40 : 44,
|
||||
height: isDesktopScreen ? 40 : 44,
|
||||
|
||||
@ -46,7 +46,7 @@ class MsgPage extends StatelessWidget {
|
||||
var logic = Get.find<CircleLogic>();
|
||||
String count = '0';
|
||||
if (logic != null) {
|
||||
count = (logic.statistics?['like_me_count'] ?? 0).toString();
|
||||
count = (logic.statistics.value.likeMeCount ?? 0).toString();
|
||||
}
|
||||
return Container(
|
||||
width: Get.width,
|
||||
@ -63,7 +63,7 @@ class MsgPage extends StatelessWidget {
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(width: count .length > 2 ? 45.sp : count .length > 1 ? 38.sp : 35.sp,height: 30.sp,),
|
||||
SizedBox(width: count .length > 2 ? 45.sp : count .length > 1 ? 38.sp : 35.sp,height: 30.sp,),
|
||||
Image.asset(
|
||||
getMsgImage('msg_love'),
|
||||
width: 30.sp,
|
||||
@ -105,7 +105,7 @@ class MsgPage extends StatelessWidget {
|
||||
fontSize: 18.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
shadows: const [
|
||||
Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))
|
||||
]),
|
||||
),
|
||||
|
||||
@ -82,7 +82,7 @@ class ReportLogic extends GetxController {
|
||||
return;
|
||||
}
|
||||
SmartDialog.showLoading();
|
||||
upDataImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){
|
||||
uploadImage(quToken,pickedFile!,CONFIG.USER_INFO_AVATAR,(result){
|
||||
SmartDialog.dismiss(force: true);
|
||||
state.imaglist.add(result);
|
||||
update();
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'package:circle_app/components/my_app_bar.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';
|
||||
|
||||
@ -11,7 +10,8 @@ import 'logic.dart';
|
||||
|
||||
|
||||
class SetupPage extends StatelessWidget {
|
||||
SetupPage({Key? key}) : super(key: key);
|
||||
const SetupPage({Key? key}) : super(key: key);
|
||||
final int heightView= 40;
|
||||
|
||||
|
||||
@override
|
||||
@ -55,18 +55,20 @@ class SetupPage extends StatelessWidget {
|
||||
// Spacer(),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 16.sp), // 将 @dimen/dp_16 替换为相应的值
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.AccountActivity);
|
||||
// controller.state.hearUrl
|
||||
// 将 @dimen/dp_16 替换为相应的值
|
||||
SizedBox(
|
||||
height: heightView.sp,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.AccountActivity);
|
||||
// controller.state.hearUrl
|
||||
|
||||
},
|
||||
child: _buildItemRow('账号中心', getHomeImage("icon_in")),
|
||||
},
|
||||
child: _buildItemRow('账号中心', getHomeImage("icon_in")),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16.sp),
|
||||
// _buildItemRow('隐私设置', getHomeImage("icon_in")),
|
||||
// SizedBox(height: 16.sp),
|
||||
// _buildItemRow('聊天设置', getHomeImage("icon_in")),
|
||||
@ -84,32 +86,39 @@ class SetupPage extends StatelessWidget {
|
||||
|
||||
|
||||
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.BlackActivity);
|
||||
},
|
||||
child: _buildItemRow('黑名单', getHomeImage("icon_in")),
|
||||
SizedBox(
|
||||
height: heightView.sp,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.BlackActivity);
|
||||
},
|
||||
child: _buildItemRow('黑名单', getHomeImage("icon_in")),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.sp),
|
||||
// _buildItemRow('系统权限管理', getHomeImage("icon_in")),
|
||||
// SizedBox(height: 16.sp),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
logic.startCaching();
|
||||
},
|
||||
child: _buildCacheItemRow('清除缓存', getHomeImage("icon_in"), context, logic),
|
||||
SizedBox(
|
||||
height: heightView.sp,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
logic.startCaching();
|
||||
},
|
||||
child: _buildCacheItemRow('清除缓存', getHomeImage("icon_in"), context, logic),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16.sp),
|
||||
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.AboutAppActivity);
|
||||
},
|
||||
child: _buildItemRow('关于圈子', getHomeImage("icon_in")),
|
||||
SizedBox(
|
||||
height: heightView.sp,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.AboutAppActivity);
|
||||
},
|
||||
child: _buildItemRow('关于圈子', getHomeImage("icon_in")),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../router/app_routers.dart';
|
||||
@ -12,40 +13,48 @@ import '../login/login/logic.dart';
|
||||
|
||||
class SplashLogic extends GetxController {
|
||||
final SplashState state = SplashState();
|
||||
@override
|
||||
void onInit() async{
|
||||
super.onInit();
|
||||
// await Future.delayed(Duration(seconds: 30));
|
||||
if((await getAuthorization()).isEmpty){
|
||||
pushLoginPage();
|
||||
}else{
|
||||
|
||||
@override
|
||||
void onReady() async {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
// await Future.delayed(Duration(seconds: 30));
|
||||
if ((await getAuthorization()).isEmpty) {
|
||||
pushLoginPage();
|
||||
} else {
|
||||
var data =
|
||||
await DioManager.instance.put(url: Api.refreshToken,params:{});
|
||||
var bean = BaseResponse<LoginData>.fromJson(data, (data) => LoginData.fromJson(data));
|
||||
await DioManager.instance.put(url: Api.refreshToken, params: {});
|
||||
var bean = BaseResponse<LoginData>.fromJson(
|
||||
data, (data) => LoginData.fromJson(data));
|
||||
if (bean.code == 200) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,bean.data!.Authorization.toString());
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,
|
||||
bean.data!.Authorization.toString());
|
||||
});
|
||||
|
||||
|
||||
Get.offNamed(AppRoutes.Home);
|
||||
return;
|
||||
} else if (bean.code == 30002) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,bean.data!.Authorization.toString());
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,
|
||||
bean.data!.Authorization.toString());
|
||||
});
|
||||
Get.offNamed(AppRoutes.Complete_materialPage);
|
||||
return;
|
||||
}
|
||||
showToast(bean.msg.toString());
|
||||
if(bean.code == 500){
|
||||
if (bean.code == 500) {
|
||||
await Future.delayed(Duration(seconds: 5));
|
||||
onInit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Get.toNamed(AppRoutes.Home);
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ class SplashPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<SplashLogic>(builder: (logic) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/images/base/launch_image.webp'),
|
||||
fit: BoxFit.cover,
|
||||
@ -21,7 +21,7 @@ class SplashPage extends StatelessWidget {
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Stack(
|
||||
body:true? Container(): Stack(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Positioned(
|
||||
|
||||
@ -181,7 +181,7 @@ class UserinfoLogic extends GetxController {
|
||||
}
|
||||
|
||||
SmartDialog.showLoading();
|
||||
upDataImage(quToken, pickedFile, CONFIG.USER_ALBUM_IMAGE, (result) async {
|
||||
uploadImage(quToken, pickedFile, CONFIG.USER_ALBUM_IMAGE, (result) async {
|
||||
var data = await DioManager.instance
|
||||
.post(url: Api.updataAlbum, params: {"type": 1, "url": result});
|
||||
var myAlbumBean = BaseResponse<AddAlbum>.fromJson(
|
||||
@ -189,7 +189,7 @@ class UserinfoLogic extends GetxController {
|
||||
|
||||
if (myAlbumBean.code == 200) {
|
||||
SmartDialog.dismiss();
|
||||
state.imaglist.add(AlbumListItem(
|
||||
state.imaglist.insert(0,AlbumListItem(
|
||||
id: myAlbumBean.data.id,
|
||||
type: myAlbumBean.data.type,
|
||||
url: result));
|
||||
|
||||
@ -14,10 +14,11 @@ class UserinfoPage extends StatefulWidget {
|
||||
const UserinfoPage({super.key});
|
||||
|
||||
@override
|
||||
_MyTabbedScreenState createState() => _MyTabbedScreenState();
|
||||
MyTabbedScreenState createState() => MyTabbedScreenState();
|
||||
}
|
||||
|
||||
class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProviderStateMixin {
|
||||
class MyTabbedScreenState extends State<UserinfoPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
late PageController _pageController;
|
||||
|
||||
@ -27,9 +28,8 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pageController = PageController();
|
||||
_tabController = TabController(
|
||||
length: 2, vsync: this);
|
||||
_pageController = PageController();
|
||||
_tabController = TabController(length: 2, vsync: this);
|
||||
_tabController.animation!.addListener(_handleTabChange);
|
||||
// _tabController.addListener(_handleTabChange);
|
||||
// _tabController
|
||||
@ -49,8 +49,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
final logic = Get.find<UserinfoLogic>();
|
||||
final state = Get.find<UserinfoLogic>().state;
|
||||
|
||||
@ -94,9 +92,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Widget _meInfoButton(UserinfoLogic controller) {
|
||||
if (controller.isMe) {
|
||||
return const SizedBox();
|
||||
@ -143,7 +138,8 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
final chatButton = GestureDetector(
|
||||
onTap: () {
|
||||
if (logic.userInfoBean != null) {
|
||||
pushChatPage(logic.userInfoBean!.id.toString(),logic.imId, logic.userInfoBean!.nickname);
|
||||
pushChatPage(logic.userInfoBean!.id.toString(), logic.imId,
|
||||
logic.userInfoBean!.nickname);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@ -188,7 +184,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Widget buildContent(UserinfoLogic controller) {
|
||||
final userInfoBean = controller.userInfoBean;
|
||||
final interests = userInfoBean?.interests ?? [];
|
||||
@ -210,7 +205,9 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 19.sp,),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 19.sp,
|
||||
),
|
||||
margin: EdgeInsets.only(top: 19.sp),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@ -257,7 +254,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
),
|
||||
SizedBox(
|
||||
height: 59.sp,
|
||||
|
||||
child: _buildInterestsListView(interests),
|
||||
),
|
||||
titleTab(controller),
|
||||
@ -273,16 +269,16 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInterestsListView(List<Interest> interests) {
|
||||
return ListView.builder(
|
||||
itemCount: interests.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.symmetric(vertical: 18.sp,horizontal: 19.sp),
|
||||
padding: EdgeInsets.symmetric(vertical: 18.sp, horizontal: 19.sp),
|
||||
itemBuilder: (context, index) {
|
||||
final interest = interests[index];
|
||||
return Container(
|
||||
@ -326,8 +322,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Widget titleTab(UserinfoLogic controller) {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
@ -340,8 +334,8 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
indicator: UnderlineTabIndicator(
|
||||
borderSide: BorderSide(
|
||||
color:const Color(0xFF00FFF4) ,
|
||||
borderSide: BorderSide(
|
||||
color: const Color(0xFF00FFF4),
|
||||
width: 2.sp,
|
||||
),
|
||||
insets: EdgeInsets.symmetric(horizontal: 6.0.sp),
|
||||
@ -352,13 +346,13 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
labelColor: const Color(0xFF00FFF4),
|
||||
unselectedLabelColor: const Color(0xB3FFFFFF),
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
tabs: const [
|
||||
tabs: const [
|
||||
Tab(
|
||||
text: "形象照",
|
||||
),
|
||||
Tab(text: "喊话"),
|
||||
],
|
||||
onTap: (index){
|
||||
onTap: (index) {
|
||||
_pageController.animateToPage(
|
||||
index, // 目标页面索引
|
||||
duration: const Duration(milliseconds: 300), // 动画时长
|
||||
@ -396,11 +390,11 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
child: Text(
|
||||
controller.isMe
|
||||
? controller.isEdit
|
||||
? "完成"
|
||||
: "管理"
|
||||
? "完成"
|
||||
: "管理"
|
||||
: controller.isUrgeStatus
|
||||
? "已催更"
|
||||
: "催更",
|
||||
? "已催更"
|
||||
: "催更",
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
@ -414,123 +408,141 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _imageAdapter(UserinfoLogic controller) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 19.sp),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
if (controller.isMe)
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 18.sp, bottom: 14.sp),
|
||||
child: Text(
|
||||
controller.isLikeFoMsg,
|
||||
style: const TextStyle(color: Colors.white30),
|
||||
),
|
||||
//print(controller.state.imaglist);
|
||||
return controller.state.imaglist.isEmpty
|
||||
? Column(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
const SizedBox(height: 100,),
|
||||
Image.asset(
|
||||
getBaseImage('no_result'),
|
||||
width: 200,
|
||||
// height: 11,
|
||||
),
|
||||
const SizedBox(height: 26,),
|
||||
Text(
|
||||
controller.isMe?"点击管理即可上传形象照哦~":"TA还没有发布过形象照,快去催TA更新吧~",
|
||||
style: const TextStyle(color: Colors.white30),
|
||||
),
|
||||
])
|
||||
: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 19.sp),
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
if (controller.isMe)
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 18.sp, bottom: 14.sp),
|
||||
child: Text(
|
||||
controller.isLikeFoMsg,
|
||||
style: const TextStyle(color: Colors.white30),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 58.0),
|
||||
shrinkWrap: true,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
itemCount: controller.isMe
|
||||
? controller.isEdit
|
||||
? controller.state.imaglist.length < 15
|
||||
? controller.state.imaglist.length + 1
|
||||
: controller.state.imaglist.length
|
||||
: controller.state.imaglist.length
|
||||
: controller.state.imaglist.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (controller.isMe &&
|
||||
controller.isEdit &&
|
||||
controller.state.imaglist.length < 15) {
|
||||
if (index == 0) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.getImageFile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Image(
|
||||
image: AssetImage(
|
||||
getMineImage("icon_img_add")),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
controller.state.imaglist[index - 1].url,
|
||||
controller,
|
||||
index - 1,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
controller.state.imaglist[index].url,
|
||||
controller,
|
||||
index,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.only(bottom: 58.0),
|
||||
shrinkWrap: true,
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
itemCount: controller.isMe
|
||||
? controller.isEdit
|
||||
? controller.state.imaglist.length<15
|
||||
? controller.state.imaglist.length + 1
|
||||
:controller.state.imaglist.length
|
||||
: controller.state.imaglist.length
|
||||
: controller.state.imaglist.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (controller.isMe && controller.isEdit&&controller.state.imaglist.length<15) {
|
||||
if (index == 0) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
controller.getImageFile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Image(
|
||||
image: AssetImage(getMineImage("icon_img_add")),
|
||||
if (logic.isMe)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 26.sp,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await Get.toNamed(
|
||||
AppRoutes.Complete_materialPage,
|
||||
arguments: "user",
|
||||
);
|
||||
logic.onInit();
|
||||
},
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
controller.state.imaglist[index - 1].url,
|
||||
controller,
|
||||
index - 1,
|
||||
),
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.sp,
|
||||
horizontal: 55.sp,
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
controller.state.imaglist[index].url,
|
||||
controller,
|
||||
index,
|
||||
child: const Text(
|
||||
"完善个人形象",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (logic.isMe)
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 26.sp,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
await Get.toNamed(
|
||||
AppRoutes.Complete_materialPage,
|
||||
arguments: "user",
|
||||
);
|
||||
logic.onInit();
|
||||
},
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color(0xFF06F9FA),
|
||||
Color(0xFFDC5BFD),
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.sp,
|
||||
horizontal: 55.sp,
|
||||
),
|
||||
child: const Text(
|
||||
"完善个人形象",
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInfoRow(UserinfoLogic controller) {
|
||||
@ -573,15 +585,13 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget buildUserContainer(UserinfoLogic controller) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only( left: 3.sp),
|
||||
margin: EdgeInsets.only(left: 3.sp),
|
||||
height: 58.sp,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(getMineImage("icon_user_content")),
|
||||
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
@ -606,7 +616,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Container(
|
||||
|
||||
width: 68.sp,
|
||||
height: 68.sp,
|
||||
decoration: const BoxDecoration(
|
||||
@ -627,7 +636,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildAvatar1(UserinfoLogic controller) {
|
||||
if (controller.userInfoBean == null) {
|
||||
return SizedBox(
|
||||
@ -657,7 +665,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Widget _buildImageItem(String url, UserinfoLogic controller, int index) {
|
||||
return Stack(
|
||||
children: [
|
||||
@ -704,7 +711,6 @@ class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProvider
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void _showBottomSheet(BuildContext context) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
|
||||
@ -48,7 +48,13 @@ class _HomeCallOutViewState extends State<HomeCallOutView> {
|
||||
builder: (listLogic) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
child: Container(
|
||||
child: listLogic.lists.isEmpty?Center(
|
||||
child: Image.asset(
|
||||
getBaseImage('no_result'),
|
||||
width: 200,
|
||||
// height: 11,
|
||||
),
|
||||
): Container(
|
||||
width: Get.width,
|
||||
child: Stack(
|
||||
children: [
|
||||
@ -56,7 +62,7 @@ class _HomeCallOutViewState extends State<HomeCallOutView> {
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
margin: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).padding.bottom + 56.sp,
|
||||
// bottom: MediaQuery.of(context).padding.bottom + 56.sp,
|
||||
left: 19.sp,
|
||||
right: 19.sp),
|
||||
child: RefreshIndicator(
|
||||
@ -66,6 +72,8 @@ class _HomeCallOutViewState extends State<HomeCallOutView> {
|
||||
child: listLogic.lists.isEmpty
|
||||
? loaddingWidget(true)
|
||||
: ListView.builder(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).padding.bottom + 56.sp),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: listLogic.scrollController,
|
||||
|
||||
@ -1,27 +1,34 @@
|
||||
import 'dart:io';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:circle_app/app/chat/logic.dart';
|
||||
import 'package:circle_app/app/splash/binding.dart';
|
||||
import 'package:circle_app/network/api.dart';
|
||||
import 'package:circle_app/network/dio_manager.dart';
|
||||
import 'package:circle_app/router/app_pages.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
import 'package:circle_app/util/PaymentUtils.dart';
|
||||
import 'package:circle_app/util/SharedPreferencesHelper.dart';
|
||||
import 'package:circle_app/util/device.dart';
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/business_logic/separate_models/tui_chat_separate_view_model.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
import 'app/login/login/logic.dart';
|
||||
import 'app/splash/view.dart';
|
||||
|
||||
|
||||
final CoreServicesImpl coreInstance = TIMUIKitCore.getInstance();
|
||||
final TUIChatSeparateViewModel chatSeparateViewModel = TUIChatSeparateViewModel();
|
||||
final TUIChatSeparateViewModel chatSeparateViewModel =
|
||||
TUIChatSeparateViewModel();
|
||||
|
||||
void main() {
|
||||
|
||||
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@ -29,46 +36,42 @@ int IM_SDK_APP_ID = 1400799631;
|
||||
|
||||
String IOS_APP_ID = "";
|
||||
|
||||
|
||||
|
||||
|
||||
//登录IM
|
||||
loginIM(String userId,String sig) async {
|
||||
loginIM(String userId, String sig) async {
|
||||
var info = await coreInstance.login(
|
||||
userID: userId,
|
||||
userSig:sig,);
|
||||
userSig: sig,
|
||||
);
|
||||
}
|
||||
|
||||
//退出IM
|
||||
logoutIM() async {
|
||||
final result = await coreInstance.logout();
|
||||
final result = await coreInstance.logout();
|
||||
print(result.desc + '退出IM');
|
||||
}
|
||||
|
||||
//跳转发消息页面
|
||||
pushChatPage(String userId,String imId,String userName) async {
|
||||
|
||||
pushChatPage(String userId, String imId, String userName) async {
|
||||
var con = V2TimConversation(
|
||||
conversationID: "c2c_$imId",
|
||||
userID: imId,
|
||||
showName: userName,
|
||||
type: 1);
|
||||
await createCustomMsg(userId,imId);
|
||||
Get.toNamed(AppRoutes.Chat,arguments: con);
|
||||
|
||||
conversationID: "c2c_$imId", userID: imId, showName: userName, type: 1);
|
||||
await createCustomMsg(userId, imId);
|
||||
Get.toNamed(AppRoutes.Chat, arguments: con);
|
||||
}
|
||||
|
||||
createCustomMsg(String userId,String imId) async {
|
||||
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) {
|
||||
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', );
|
||||
var data = await DioManager.instance.get(
|
||||
url: 'msg-service/user/$userId/chat/card',
|
||||
);
|
||||
if (data['code'] == 200) {
|
||||
String desc = '';
|
||||
Map<String, dynamic> info = {};
|
||||
@ -85,7 +88,8 @@ createCustomMsg(String userId,String imId) async {
|
||||
circleList.add(element['title']);
|
||||
});
|
||||
if (circleList.isNotEmpty) {
|
||||
info['both_interests'] = '你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
info['both_interests'] =
|
||||
'你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
if (desc.isEmpty) {
|
||||
desc = '你们有${circleList.length}个共同的圈子:${circleList.join('、')}';
|
||||
}
|
||||
@ -101,22 +105,20 @@ createCustomMsg(String userId,String imId) async {
|
||||
await sendCustomMsg(imId, jsonEncode(info), desc);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//发送文本消息
|
||||
sendTextMsg(String userId,{String content = '看看这次缘分匹配到哪位小可爱呢?'}) async {
|
||||
sendTextMsg(String userId, {String content = '看看这次缘分匹配到哪位小可爱呢?'}) async {
|
||||
// 创建文本消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createTextMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createTextMessage(
|
||||
text: content, // 文本信息
|
||||
);
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createTextMessage(
|
||||
text: content, // 文本信息
|
||||
);
|
||||
if (createTextMessageRes.code == 0) {
|
||||
// 文本信息创建成功
|
||||
String? id = createTextMessageRes.data?.id;
|
||||
@ -156,28 +158,30 @@ sendTextMsg(String userId,{String content = '看看这次缘分匹配到哪位
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
//发送自定义消息
|
||||
sendCustomMsg(String userId,String data, String desc) async {
|
||||
sendCustomMsg(String userId, String data, String desc) async {
|
||||
// 创建自定义消息
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
|
||||
await TencentImSDKPlugin.v2TIMManager
|
||||
.getMessageManager()
|
||||
.createCustomMessage(
|
||||
data: data,
|
||||
desc: desc,
|
||||
extension: 'cardData',
|
||||
);
|
||||
.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: '');
|
||||
.sendMessage(id: id!, receiver: userId, groupID: '');
|
||||
if (sendMessageRes.code == 0) {
|
||||
// 发送成功
|
||||
sendMessageRes.data?.customElem?.data; //自定义data
|
||||
@ -187,7 +191,6 @@ sendCustomMsg(String userId,String data, String desc) async {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MyApp extends StatefulWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@ -195,28 +198,63 @@ class MyApp extends StatefulWidget {
|
||||
State<MyApp> createState() => _MyAppState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
class _MyAppState extends State<MyApp> {
|
||||
// This widget is the root of your application.
|
||||
|
||||
final List<String> _guideList = ['bg', 'home_back'];
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
initIM();
|
||||
if( Platform.isAndroid){
|
||||
if (Platform.isAndroid) {
|
||||
initWxApi();
|
||||
}
|
||||
loadBgImage();
|
||||
super.initState();
|
||||
// getLoginStyle();
|
||||
}
|
||||
|
||||
getLoginStyle() async {
|
||||
if ((await getAuthorization()).isEmpty) {
|
||||
pushLoginPage();
|
||||
FlutterNativeSplash.remove();
|
||||
} else {
|
||||
var data =
|
||||
await DioManager.instance.put(url: Api.refreshToken, params: {});
|
||||
var bean = BaseResponse<LoginData>.fromJson(
|
||||
data, (data) => LoginData.fromJson(data));
|
||||
if (bean.code == 200) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,
|
||||
bean.data!.Authorization.toString());
|
||||
});
|
||||
FlutterNativeSplash.remove();
|
||||
Get.offNamed(AppRoutes.Home);
|
||||
|
||||
return;
|
||||
} else if (bean.code == 30002) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,
|
||||
bean.data!.Authorization.toString());
|
||||
});
|
||||
Get.offNamed(AppRoutes.Complete_materialPage);
|
||||
FlutterNativeSplash.remove();
|
||||
return;
|
||||
}
|
||||
showToast(bean.msg.toString());
|
||||
if (bean.code == 500) {
|
||||
await Future.delayed(const Duration(seconds: 5));
|
||||
getLoginStyle();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
initIM() {
|
||||
coreInstance.init(
|
||||
sdkAppID:
|
||||
IM_SDK_APP_ID, // Replace 0 with the SDKAppID of your IM application when integrating
|
||||
sdkAppID: IM_SDK_APP_ID,
|
||||
// Replace 0 with the SDKAppID of your IM application when integrating
|
||||
// language: LanguageEnum.en, // 界面语言配置,若不配置,则跟随系统语言
|
||||
loglevel: LogLevelEnum.V2TIM_LOG_DEBUG,
|
||||
onTUIKitCallbackListener: (TIMCallback callbackValue) {
|
||||
@ -247,7 +285,8 @@ class _MyAppState extends State<MyApp> {
|
||||
// loginIM();
|
||||
}
|
||||
}
|
||||
}, // [建议配置,详见此部分](https://cloud.tencent.com/document/product/269/70746#callback)
|
||||
},
|
||||
// [建议配置,详见此部分](https://cloud.tencent.com/document/product/269/70746#callback)
|
||||
listener: V2TimSDKListener(onConnectSuccess: () {
|
||||
print('IM登录成功');
|
||||
// loginIM();
|
||||
@ -255,17 +294,18 @@ class _MyAppState extends State<MyApp> {
|
||||
}
|
||||
|
||||
loadBgImage() async {
|
||||
await precacheImage(precacheImages(_guideList.first),context);
|
||||
await precacheImage(precacheImages(_guideList.last),context);
|
||||
await precacheImage(precacheImages(_guideList.first), context);
|
||||
await precacheImage(precacheImages(_guideList.last), context);
|
||||
await precacheImage(AssetImage(getBaseImage('bg')), context,size: Size(Get.width, Get.height));
|
||||
}
|
||||
|
||||
precacheImages(String image) {
|
||||
return AssetImage(getBaseImage(image));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
//填入设计稿中设备的屏幕尺寸,单位dp
|
||||
// configureDio();
|
||||
return ScreenUtilInit(
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class Api {
|
||||
static const baseUrl = kDebugMode ? 'http://192.168.3.55:2000/' : 'http://192.168.3.55:2000/';
|
||||
static const baseUrl = kDebugMode ? 'http://leyuan666.com:2000/' : 'http://192.168.3.55:2000/';
|
||||
|
||||
// 获取验证码
|
||||
static const sendCode = 'msg-service/sms/code/send';
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:tencent_cloud_chat_uikit/tencent_cloud_chat_uikit.dart';
|
||||
|
||||
class EventBusManager {
|
||||
|
||||
static EventBus? _eventBus;
|
||||
static EventBus? _eventBus;
|
||||
|
||||
static EventBus get eventBus {
|
||||
if (_eventBus == null) {
|
||||
_eventBus = EventBus();
|
||||
@ -28,7 +28,14 @@ class EventBusManager {
|
||||
}
|
||||
|
||||
|
||||
class CommentVipEvent{
|
||||
class CommentVipEvent {
|
||||
int vip = 0;
|
||||
|
||||
CommentVipEvent(this.vip);
|
||||
}
|
||||
|
||||
class SendCoustomMessage {
|
||||
|
||||
V2TimValueCallback<V2TimMsgCreateInfoResult>? createCustomMessageRes = null;
|
||||
|
||||
SendCoustomMessage(this.createCustomMessageRes);}
|
||||
@ -18,11 +18,11 @@ typedef void MyCallback(String result);
|
||||
|
||||
|
||||
//上传七牛云
|
||||
void updataQiniu(String filePath,String name,String path ,String quToken,MyCallback myCallback) {
|
||||
void uploadQiniu(String filePath,String name,String path ,String quToken,MyCallback myCallback) {
|
||||
var storage = Storage();
|
||||
DateTime now = DateTime.now();
|
||||
String yearMonth = DateFormat('yyyyMM').format(now);
|
||||
String imgPath = path +yearMonth+"/"+generateRandomString(16)+ name;
|
||||
String imgPath = "$path$yearMonth/${generateRandomString(16)}$name";
|
||||
PutController putController = PutController();
|
||||
putController.addStatusListener((StorageStatus status) {
|
||||
if (status == StorageStatus.Success) {
|
||||
@ -40,6 +40,7 @@ void updataQiniu(String filePath,String name,String path ,String quToken,MyCallb
|
||||
|
||||
storage.putFile(File(filePath), quToken,
|
||||
options: PutOptions(controller: putController, key: imgPath));
|
||||
|
||||
}
|
||||
|
||||
const List<String> jpgSuffix = ["jpg", "jpeg", "JPG", "JPEG","png", "PNG"];
|
||||
@ -50,7 +51,7 @@ bool isImageJpgOrPng(String imagePath) {
|
||||
return jpgSuffix.contains(extension) ;
|
||||
}
|
||||
//封装上传图片
|
||||
void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback myCallback) async{
|
||||
void uploadImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback myCallback) async{
|
||||
// print(quToken);
|
||||
if(quToken.isEmpty){
|
||||
|
||||
@ -70,19 +71,23 @@ void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback
|
||||
//if(isImageJpgOrPng(pickedFile.path)){
|
||||
if(false){
|
||||
CompressObject compressObject = CompressObject(
|
||||
imageFile:File(pickedFile.path), //image
|
||||
path:path, //compress to path
|
||||
quality: 80,//first compress quality, default 80
|
||||
step: 9,//compress quality step, The bigger the fast, Smaller is more accurate, default 6
|
||||
mode: CompressMode.LARGE2SMALL,//default AUTO
|
||||
imageFile:File(pickedFile.path),
|
||||
path:path,
|
||||
quality: 80,
|
||||
step: 6,
|
||||
mode: CompressMode.AUTO,
|
||||
);
|
||||
Luban.compressImage(compressObject).then((_path) {
|
||||
updataQiniu(_path.toString(),pickedFile.name,updataRoute,quToken,(result){
|
||||
uploadQiniu(_path.toString(),pickedFile.name,updataRoute,quToken,(result){
|
||||
myCallback(result);
|
||||
});
|
||||
}).catchError((error) {
|
||||
print(error);
|
||||
showToast("图片上传失败");
|
||||
SmartDialog.dismiss(force: true);
|
||||
});
|
||||
}else{
|
||||
updataQiniu(pickedFile.path,pickedFile.name,updataRoute,quToken,(result){
|
||||
uploadQiniu(pickedFile.path,pickedFile.name,updataRoute,quToken,(result){
|
||||
myCallback(result);
|
||||
|
||||
});
|
||||
|
||||
@ -79,7 +79,7 @@ dependencies:
|
||||
#时间戳
|
||||
flutter_intl: ^0.0.1
|
||||
#图片压缩
|
||||
flutter_luban: ^0.1.13
|
||||
flutter_luban: any
|
||||
#视频压缩
|
||||
video_compress: ^3.1.2
|
||||
#图片缓存
|
||||
@ -92,8 +92,10 @@ dependencies:
|
||||
fluwx: ^3.8.1+1
|
||||
#event_bus:
|
||||
event_bus: ^2.0.0
|
||||
|
||||
|
||||
#安装apk
|
||||
flutter_install_app: 1.3.0
|
||||
#闪屏页
|
||||
flutter_native_splash: 2.2.16
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user