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