diff --git a/circle_app/android/app/src/main/kotlin/com/leyuan/app/MainActivity.kt b/circle_app/android/app/src/main/kotlin/com/leyuan/app/MainActivity.kt index 1a8300a..859ebb3 100644 --- a/circle_app/android/app/src/main/kotlin/com/leyuan/app/MainActivity.kt +++ b/circle_app/android/app/src/main/kotlin/com/leyuan/app/MainActivity.kt @@ -1,6 +1,13 @@ package com.leyuan.app +import android.os.Bundle +import android.os.PersistableBundle +import android.util.Log import io.flutter.embedding.android.FlutterActivity class MainActivity: FlutterActivity() { + override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) { + super.onCreate(savedInstanceState, persistentState) + Log.e("tag","11111111111") + } } diff --git a/circle_app/assets/images/base/ic_launcher.png b/circle_app/assets/images/base/ic_launcher.png new file mode 100644 index 0000000..5b179e0 Binary files /dev/null and b/circle_app/assets/images/base/ic_launcher.png differ diff --git a/circle_app/assets/images/base/icon_login.png b/circle_app/assets/images/base/icon_login.png deleted file mode 100644 index 75d4218..0000000 Binary files a/circle_app/assets/images/base/icon_login.png and /dev/null differ diff --git a/circle_app/lib/app/aboutapp/logic.dart b/circle_app/lib/app/aboutapp/logic.dart index 4c3100e..2aa683d 100644 --- a/circle_app/lib/app/aboutapp/logic.dart +++ b/circle_app/lib/app/aboutapp/logic.dart @@ -1,10 +1,16 @@ // import 'package:flutter_install_app/flutter_install_app.dart'; import 'package:dio/dio.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + // import 'package:flutter_install_app/flutter_install_app.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; +import '../../network/api.dart'; +import '../../network/dio_manager.dart'; import '../../util/util.dart'; +import '../dialog/UpdateDialog.dart'; import 'state.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -14,7 +20,6 @@ class AboutappLogic extends GetxController { @override void onInit() { - // TODO: implement onInit super.onInit(); getVersion(); // getAppVersion(); @@ -27,23 +32,27 @@ class AboutappLogic extends GetxController { return version; } - updataApk() async { - SmartDialog.showLoading(); - var filePath = await getApplicationSupportDirectoryPath(); - filePath = filePath+"kuayou.apk"; - // var data = await DioManager.instance - // .download("https://xidi-official-website.oss-cn-shenzhen.aliyuncs.com/%E8%B7%A8%E5%8F%8B_2.3.4.apk", filePath, (received, total) { - // double progress = received / total * 100; - // print('Download progress: $progress%'); - // }) - // .then((value) => - // print(value)) - // .catchError((error) { - // SmartDialog.dismiss(); - // print(error); - // }); - // await AppInstaller.installApk(filePath, actionRequired: false); + getUpVersion() async { + var data = await DioManager.instance.get(url: Api.APP_VERSION); + var bean = BaseResponse.fromJson( + data, (data) => UpdateInfo.fromJson(data)); + if (bean.isSuccess() && bean.data.update == 1) { + showReportDialog(Get.context!, bean.data.constraint == 0, bean.data); + } + } + void showReportDialog( + BuildContext context, bool isDismiss, UpdateInfo updateInfo) { + showDialog( + context: context, + barrierDismissible: isDismiss, + builder: (BuildContext context) { + return UpdateDialog( + isDismiss: isDismiss, + updateInfo: updateInfo, + ); + }, + ); } Future getAppVersion() async { diff --git a/circle_app/lib/app/aboutapp/view.dart b/circle_app/lib/app/aboutapp/view.dart index ec4cd03..136cd67 100644 --- a/circle_app/lib/app/aboutapp/view.dart +++ b/circle_app/lib/app/aboutapp/view.dart @@ -4,6 +4,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../components/my_app_bar.dart'; +import '../../network/dio_manager.dart'; +import '../dialog/UpdateDialog.dart'; import 'logic.dart'; @@ -43,7 +45,7 @@ class AboutappPage extends StatelessWidget { // showToast("13"); }, child:Image.asset( - getBaseImage("icon_login"), // Replace with your image path + getBaseImage("ic_launcher"), // Replace with your image path width: 100.sp, height: 100.sp, fit: BoxFit.contain, @@ -146,7 +148,7 @@ class AboutappPage extends StatelessWidget { GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ - logic.updataApk(); + logic.getUpVersion(); }, child: Row( children: [ diff --git a/circle_app/lib/app/blacklist/view.dart b/circle_app/lib/app/blacklist/view.dart index fa52d99..f9713ac 100644 --- a/circle_app/lib/app/blacklist/view.dart +++ b/circle_app/lib/app/blacklist/view.dart @@ -100,8 +100,8 @@ class BlacklistPage extends StatelessWidget { children: [ Text( item.nickname, - style: const TextStyle(color: Colors.white70, - fontSize: 12, + style: TextStyle(color: Colors.white70, + fontSize: 12.sp, fontWeight: FontWeight.bold), ), SizedBox(width: 4.sp), @@ -116,6 +116,8 @@ class BlacklistPage extends StatelessWidget { width: 150.sp, child: Text( item.signature, + overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 + maxLines: 1, style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), ), ), diff --git a/circle_app/lib/app/call_out/logic.dart b/circle_app/lib/app/call_out/logic.dart index d0dcf61..fa30c90 100644 --- a/circle_app/lib/app/call_out/logic.dart +++ b/circle_app/lib/app/call_out/logic.dart @@ -155,7 +155,9 @@ class Call_outLogic extends GetxController { if (beandata.isSuccess()) { showToast(beandata.msg); final logic = Get.put(CircleLogic()); + logic.setCircle(numbers[0].id); logic.refresh(); + logic.update(); // Navigator.pop(Get.context!, numbers); Get.back(); } else if (beandata.code == 30503) { diff --git a/circle_app/lib/app/circle/logic.dart b/circle_app/lib/app/circle/logic.dart index 6a07c7c..a45ba00 100644 --- a/circle_app/lib/app/circle/logic.dart +++ b/circle_app/lib/app/circle/logic.dart @@ -44,7 +44,7 @@ class CircleLogic extends GetxController { outCircle(String interest_id, bool isStatus) async { var data = await DioManager.instance.post( - url: Api.outCrrcle + interest_id + "/join", + url: "${Api.outCrrcle}$interest_id/join", params: {"status": isStatus ? "0" : "1"}); var bean = BaseResponse.fromJson(data, (data) => data); if (bean.code == 200) { @@ -57,6 +57,15 @@ class CircleLogic extends GetxController { showToast(bean.msg); } + + setCircle(String circleId){ + circle.lists.forEach((element) { + if (element.id.toString() == circleId.toString()) { + element.isJoin = true; + } + }); + } + //访问我的圈子人数 loadCirclePeopleData() async { var data = await DioManager.instance diff --git a/circle_app/lib/app/dialog/UpdateDialog.dart b/circle_app/lib/app/dialog/UpdateDialog.dart new file mode 100644 index 0000000..571e906 --- /dev/null +++ b/circle_app/lib/app/dialog/UpdateDialog.dart @@ -0,0 +1,226 @@ +import 'dart:io'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:url_launcher/url_launcher.dart'; + +import '../../main.dart'; +import '../../network/dio_manager.dart'; +import '../../util/util.dart'; + +class UpdateDialog extends StatefulWidget { + final bool isDismiss; + final UpdateInfo updateInfo; + + UpdateDialog({required this.isDismiss, required this.updateInfo}); + + @override + _CustomDialogState createState() => _CustomDialogState(); +} + +class _CustomDialogState extends State { + double progress = 0; + bool isDownload = false; + + void incrementCounter() { + setState(() { + progress = progress + 0.1; + }); + } + + void setDownloadUi() { + setState(() { + isDownload = true; + }); + } + + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () async { + return widget.isDismiss; + }, + child: Dialog( + backgroundColor: Colors.transparent, + child: Container( + height: 277.sp, + padding: const EdgeInsets.all(1.0), + child: Stack( + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const LinearGradient( + colors: [Color(0xFFDD3DF4), Color(0xFF30FFD9)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.all(1.sp), + decoration: BoxDecoration( + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(10.0), + gradient: const LinearGradient( + colors: [Color(0xFF4C3E5F), Color(0xFF324140)], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), + ), + ), + Container( + margin: EdgeInsets.only(top: 24.sp), + child: Column( + children: [ + Center( + child: Text( + "发现新版本", + style: TextStyle(color: Colors.white, fontSize: 16.sp), + ), + ), + Container( + margin: EdgeInsets.only(top: 14.sp), + alignment: Alignment.center, + child: Image( + image: AssetImage(getBaseImage("ic_launcher")), + width: 70.sp, + height: 70.sp, + ), + ), + Container( + margin: EdgeInsets.only( + top: 12.sp, left: 14.sp, right: 14.sp), + alignment: Alignment.center, + child: Text( + widget.updateInfo.updateInfo, + textAlign: TextAlign.center, + style: TextStyle( + color: const Color(0xCCF7FAFA), fontSize: 16.sp), + ), + ), + isDownload + ? GestureDetector( + onTap: () async { + if (Platform.isIOS) { + final String appStoreUrl = 'https://apps.apple.com/app/id$iOSAPPid'; // App Store链接示例 + if (await canLaunch(appStoreUrl)) { + await launch(appStoreUrl); + } else { + throw 'Could not open App Store.'; + } + } else { + updataApk(widget.updateInfo.downloadUrl); + } + + //incrementCounter(); + }, + child: Container( + margin: EdgeInsets.only(top: 24.sp), + child: CircularProgressIndicator( + value: progress, + backgroundColor: Colors.grey, + valueColor: const AlwaysStoppedAnimation( + Colors.blue), + strokeWidth: 4.0.sp, + ), + ), + ) + : GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setDownloadUi(); + + //Navigator.pop(context); + // logic.setBlock(); + }, + child: Container( + width: 200.sp, + margin: EdgeInsets.only(top: 24.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + begin: Alignment.centerLeft, + end: Alignment.centerRight, + ), + ), + padding: EdgeInsets.only( + top: 10.sp, + bottom: 10.sp, + left: 52.sp, + right: 52.sp), + child: Center( + child: Text( + "立即更新", + style: TextStyle( + color: Colors.white, + fontSize: 12.sp, + ), + ), + ), + ), + ) + ], + ), + ) + ], + ), + ), + ), + ); + } +} + +updataApk(String downloadUrl) async { + //SmartDialog.showLoading(); + var filePath = await getApplicationSupportDirectoryPath(); + filePath = filePath + "kuayou.apk"; + var data = await DioManager.instance + .download( + "https://xidi-official-website.oss-cn-shenzhen.aliyuncs.com/%E8%B7%A8%E5%8F%8B_2.3.4.apk", + filePath, (received, total) { + double progress = received / total * 100; + print('Download progress: $progress%'); + }) + .then((value) => print(value)) + .catchError((error) { + // SmartDialog.dismiss(); + print(error); + }); + //await AppInstaller.installApk(filePath, actionRequired: false); +} + +class UpdateInfo { + final String version; //最新版本号 + final int update; //是否要更新 + final int constraint; //是否强制 + final String publishTime; + final String downloadUrl; + final String updateInfo; + + UpdateInfo({ + required this.version, + required this.update, + required this.constraint, + required this.publishTime, + required this.downloadUrl, + required this.updateInfo, + }); + + factory UpdateInfo.fromJson(Map json) { + return UpdateInfo( + version: json['version'], + update: json['update'], + constraint: json['constraint'], + publishTime: json['publish_time'], + downloadUrl: json['download_url'], + updateInfo: json['update_info'], + ); + } +} diff --git a/circle_app/lib/app/friendslist/view.dart b/circle_app/lib/app/friendslist/view.dart index b5e385a..c7810ca 100644 --- a/circle_app/lib/app/friendslist/view.dart +++ b/circle_app/lib/app/friendslist/view.dart @@ -110,9 +110,11 @@ class FriendslistPage extends StatelessWidget { SizedBox(height: 8.sp), SizedBox( - width: 150.sp, + width: 200.sp, child: Text( item.signature, + overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 + maxLines: 1, style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), ), ), diff --git a/circle_app/lib/app/help/view.dart b/circle_app/lib/app/help/view.dart index f70660e..0cc8739 100644 --- a/circle_app/lib/app/help/view.dart +++ b/circle_app/lib/app/help/view.dart @@ -47,7 +47,7 @@ class HelpPage extends StatelessWidget { child: Text( '04-10 19:51', style: TextStyle( - color: Color(0xFFB7BECC), + color: const Color(0xFFB7BECC), fontSize: 12.sp, ), ), @@ -165,7 +165,7 @@ class HelpPage extends StatelessWidget { ], ), ), - Spacer(), + const Spacer(), Padding( padding: EdgeInsets.only(bottom: 30.sp), child: Row( @@ -189,7 +189,7 @@ class HelpPage extends StatelessWidget { ), ), style: TextButton.styleFrom( - backgroundColor: Color(0xFF21BEAB), + backgroundColor: const Color(0xFF21BEAB), padding: EdgeInsets.symmetric( horizontal: 16.sp, vertical: 4.sp), shape: RoundedRectangleBorder( @@ -215,7 +215,7 @@ class HelpPage extends StatelessWidget { ), ), style: TextButton.styleFrom( - backgroundColor: Color(0xFF21BEAB), + backgroundColor: const Color(0xFF21BEAB), padding: EdgeInsets.symmetric( horizontal: 16.sp, vertical: 4.sp), shape: RoundedRectangleBorder( diff --git a/circle_app/lib/app/home/logic.dart b/circle_app/lib/app/home/logic.dart index af525fa..734a957 100644 --- a/circle_app/lib/app/home/logic.dart +++ b/circle_app/lib/app/home/logic.dart @@ -6,9 +6,11 @@ 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_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../circle/view.dart'; +import '../dialog/UpdateDialog.dart'; import '../minefragment/view.dart'; import '../msg/view.dart'; import 'state.dart'; @@ -34,6 +36,33 @@ class HomeLogic extends GetxController { tabs.add(MinefragmentPage()); } + @override + void onReady() async{ + // TODO: implement onReady + super.onReady(); + + var data = await DioManager.instance.get(url: Api.APP_VERSION); + var bean = BaseResponse.fromJson( + data, (data) => UpdateInfo.fromJson(data)); + if(bean.isSuccess()&&bean.data.update==1){ + showReportDialog(Get.context!,bean.data.constraint==0,bean.data); + } + + + + + } + + void showReportDialog(BuildContext context,bool isDismiss,UpdateInfo updateInfo) { + showDialog( + context: context, + barrierDismissible: isDismiss, + builder: (BuildContext context) { + return UpdateDialog(isDismiss: isDismiss,updateInfo : updateInfo,); + } + ); + } + void getIMData() async { // _coreInstance.; diff --git a/circle_app/lib/app/home/view.dart b/circle_app/lib/app/home/view.dart index 6ba32d4..e4ad9da 100644 --- a/circle_app/lib/app/home/view.dart +++ b/circle_app/lib/app/home/view.dart @@ -23,9 +23,11 @@ class _HomePageState extends State with AutomaticKeepAliveClientMixin @override Widget build(BuildContext context) { + return GetBuilder(builder: (HomeLogic controller) { return GestureDetector( onTap: () { + controller.onReady(); // Get.toNamed(AppRoutes.Complete_materialPage); }, child: ExitAppConfirmation(child: Stack(children: [ diff --git a/circle_app/lib/app/likelist/view.dart b/circle_app/lib/app/likelist/view.dart index e35a8a0..9c6382d 100644 --- a/circle_app/lib/app/likelist/view.dart +++ b/circle_app/lib/app/likelist/view.dart @@ -27,7 +27,7 @@ class LikelistPage extends StatelessWidget { ), child: Scaffold( backgroundColor: Colors.transparent, - appBar: MyAppBar( + appBar: const MyAppBar( centerTitle: "喜欢我的", ), body: SafeArea( @@ -117,17 +117,19 @@ class LikelistPage extends StatelessWidget { ], ), SizedBox(height: 8.sp), - Container( - width: 150.sp, + SizedBox( + width: 200.sp, child: Text( item.user.signature, - style: TextStyle(fontSize: 12.sp, color: Color(0xFFB7BECC)), + overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 + maxLines: 1, + style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), ), ), ], ), // Pla - Spacer(), + const Spacer(), GestureDetector( onTap: () { logic.setLike(index); @@ -136,7 +138,7 @@ class LikelistPage extends StatelessWidget { width: 75.sp, height: 28.sp, decoration: BoxDecoration( - color: Color(0xFFFF4D7C), + color: const Color(0xFFFF4D7C), borderRadius: BorderRadius.circular(14), ), child: Center( @@ -162,7 +164,7 @@ class LikelistPage extends StatelessWidget { Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(17.sp), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [ Color.fromRGBO(141, 255, 248, 1.0), Color.fromRGBO(181, 211, 255, 1.0), diff --git a/circle_app/lib/app/myfeedbacklist/view.dart b/circle_app/lib/app/myfeedbacklist/view.dart index 2945418..9422274 100644 --- a/circle_app/lib/app/myfeedbacklist/view.dart +++ b/circle_app/lib/app/myfeedbacklist/view.dart @@ -83,6 +83,8 @@ class MyfeedbacklistPage extends StatelessWidget { SizedBox( height: 120.sp, child: GridView.builder( + scrollDirection: Axis.vertical, + physics: const NeverScrollableScrollPhysics(), gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, // 每行显示的项目数量 ), diff --git a/circle_app/lib/app/userinfo/logic.dart b/circle_app/lib/app/userinfo/logic.dart index dcb5306..c3c802b 100644 --- a/circle_app/lib/app/userinfo/logic.dart +++ b/circle_app/lib/app/userinfo/logic.dart @@ -31,108 +31,93 @@ class UserinfoLogic extends GetxController { bool isShowAlbum = true; bool isLike = false; final startTime = DateTime.now(); + SharedPreferences? sharedPreferences; @override void onInit() async { super.onInit(); SmartDialog.showLoading(); - if (userId != '') { - SharedPreferences sharedPreferences = - await SharedPreferences.getInstance(); - if (sharedPreferences.getInt(SharedPreferencesHelper.USERID) != 0 && - sharedPreferences.getInt(SharedPreferencesHelper.USERID).toString() == - userId) { - userId = ''; - } + + sharedPreferences = await SharedPreferences.getInstance(); + int? sharedUserId = sharedPreferences!.getInt(SharedPreferencesHelper.USERID); + + if (userId.isNotEmpty && sharedUserId != null && sharedUserId.toString() == userId) { + userId = ''; } + state.imaglist.clear(); - if (userId == '') { - isMe = true; - var data = await DioManager.instance.get(url: Api.getUserInfo); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - if (bean.isSuccess()) { - isLikeFoMsg = - "${bean.data.imageUrgeCount}位圈友感兴趣,其中${bean.data.likeMeCount}位已催您更新"; - userInfoBean = bean.data.user; - isVip = userInfoBean!.vip; - //访问自己强制在线 - userInfoBean!.isOnline = true; - onLineCity = userInfoBean!.isOnline ? "在线" : "离线"; - isOnline = userInfoBean!.isOnline; - if (userInfoBean!.city != null) { - onLineCity = "$onLineCity·${userInfoBean!.city}"; - } - ageMsg = getAgeCOntent(userInfoBean!.gender, userInfoBean!.age, - userInfoBean!.role, userInfoBean!.orientation); - } else { - showToast(bean.msg); - } - - var myAlbumData = await DioManager.instance.get( - url: Api.getMyAlbum, - ); - var myAlbumBean = BaseResponse.fromJson(myAlbumData, - (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - if (myAlbumBean.isSuccess()) { - myAlbumBean.data.lists.forEach((element) { - state.imaglist.add(element); - }); - } + if (userId.isEmpty) { + fetchUserInfo(Api.getUserInfo); + fetchMyAlbum(Api.getMyAlbum); } else { - isMe = false; - var data = await DioManager.instance - .get(url: "${Api.getUserInfoTA + userId}/home"); - var bean = BaseResponse.fromJson( - data, (data) => ResponseBean.fromJson(data)); - if (bean.isSuccess()) { - isLike = bean.data.isFollow; - isLikeFoMsg = - "${bean.data.imageUrgeCount}位圈友感兴趣,其中${bean.data.likeMeCount}位已催您更新"; - userInfoBean = bean.data!.user; - isVip = userInfoBean!.vip; - imId = bean.data.accountId; - onLineCity = userInfoBean!.isOnline == true ? "在线" : "离线"; - if (userInfoBean!.city != null) { - onLineCity = "$onLineCity·${userInfoBean!.city}"; - } + fetchUserInfo("${Api.getUserInfoTA + userId}/home"); + fetchMyAlbum("${Api.getTaAlbum + userId}/albums"); + fetchUrgeStatus("${Api.getUrgeStatus + userId}/urge/album/status"); + } + SmartDialog.dismiss(); + fetchQnToken(Api.getqiniuToken); + } - ageMsg = getAgeCOntent(userInfoBean!.gender, userInfoBean!.age, - userInfoBean!.role, userInfoBean!.orientation); - } else { - showToast(bean.msg); + Future fetchUserInfo(String url) async { + var data = await DioManager.instance.get(url: url); + var bean = BaseResponse.fromJson( + data, (data) => ResponseBean.fromJson(data)); + + if (bean.isSuccess()) { + isMe = userId.isEmpty; + isLike = bean.data.isFollow; + isLikeFoMsg = "${bean.data.imageUrgeCount}位圈友感兴趣,其中${bean.data.likeMeCount}位已催您更新"; + userInfoBean = bean.data.user; + isVip = userInfoBean?.vip ?? 0; + imId = bean.data.accountId; + if (isMe) { + isOnline = true; + }else{ + isOnline = userInfoBean!.isOnline; } - - var myAlbumData = await DioManager.instance - .get(url: "${Api.getTaAlbum + userId}/albums"); - var myAlbumBean = BaseResponse.fromJson(myAlbumData, - (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); - if (myAlbumBean.isSuccess()) { - myAlbumBean.data.lists.forEach((element) { - state.imaglist.add(AlbumListItem( - id: element.id, type: element.type, url: element.url)); - }); + onLineCity = isOnline ? "在线" : "离线"; + if (userInfoBean?.city != null) { + onLineCity = "$onLineCity·${userInfoBean!.city}"; + }else{ + onLineCity = "$onLineCity·外星"; } - - var urgedata = await DioManager.instance - .get(url: "${Api.getUrgeStatus + userId}/urge/album/status"); - var urgeBean = BaseResponse.fromJson( - urgedata, (urgedata) => UrgentStatus.fromJson(urgedata)); - //if(urgedata.isSuccess()){ - isUrgeStatus = urgeBean.data.isUrgent; - //} + ageMsg = getAgeCOntent(userInfoBean!.gender, userInfoBean!.age, userInfoBean!.role, userInfoBean!.orientation); + } else { + showToast(bean.msg); } update(); - SmartDialog.dismiss(); - var data = - await DioManager.instance.get(url: Api.getqiniuToken, params: {}); + } + + Future fetchMyAlbum(String url) async { + var myAlbumData = await DioManager.instance.get(url: url); + var myAlbumBean = BaseResponse.fromJson( + myAlbumData, (myAlbumData) => AlbumResponseBean.fromJson(myAlbumData)); + + if (myAlbumBean.isSuccess()) { + state.imaglist.addAll(myAlbumBean.data.lists); + } + update(); + } + + Future fetchUrgeStatus(String url) async { + var urgedata = await DioManager.instance.get(url: url); + var urgeBean = BaseResponse.fromJson( + urgedata, (urgedata) => UrgentStatus.fromJson(urgedata)); + isUrgeStatus = urgeBean.data?.isUrgent ?? false; + update(); + } + + Future fetchQnToken(String url) async { + var data = await DioManager.instance.get(url: url, params: {}); var bean = BaseResponse.fromJson( data, (data) => QnTokenData.fromJson(data)); if (bean.isSuccess()) { - quToken = bean.data!.token.toString(); + quToken = bean.data?.token.toString() ?? ''; } + } + urgeChange() async { var data = await DioManager.instance .post(url: "${Api.urgeAlbum + userId}/urge/album"); diff --git a/circle_app/lib/app/userinfo/view.dart b/circle_app/lib/app/userinfo/view.dart index daec3e6..e6fd327 100644 --- a/circle_app/lib/app/userinfo/view.dart +++ b/circle_app/lib/app/userinfo/view.dart @@ -1,6 +1,4 @@ - import 'package:cached_network_image/cached_network_image.dart'; -import 'package:circle_app/app/chat/logic.dart'; import 'package:circle_app/app/userinfo/widgets/home_call_out.dart'; import 'package:circle_app/main.dart'; import 'package:flutter/material.dart'; @@ -22,6 +20,7 @@ class UserinfoPage extends StatefulWidget { class _MyTabbedScreenState extends State with SingleTickerProviderStateMixin { late TabController _tabController; + late PageController _pageController; ScrollController scrollController = ScrollController(); bool isShowBlackTitle = false; @@ -29,8 +28,9 @@ class _MyTabbedScreenState extends State @override void initState() { super.initState(); + _pageController = PageController(); _tabController = TabController( - length: 2, vsync: this, animationDuration: const Duration(milliseconds: 200)); + length: 2, vsync: this); _tabController.animation!.addListener(_handleTabChange); // _tabController.addListener(_handleTabChange); // _tabController @@ -144,10 +144,6 @@ class _MyTabbedScreenState extends State final chatButton = GestureDetector( onTap: () { if (logic.userInfoBean != null) { - - - - pushChatPage(logic.userInfoBean!.id.toString(),logic.imId, logic.userInfoBean!.nickname); } }, @@ -199,131 +195,144 @@ class _MyTabbedScreenState extends State final interests = userInfoBean?.interests ?? []; return Container( - padding: EdgeInsets.symmetric(horizontal: 19.sp, vertical: 14.sp), + padding: EdgeInsets.symmetric(vertical: 14.sp), child: Column( children: [ - Row( - children: [ - _imagelistView(controller), - Expanded( - child: buildUserContainer(controller), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - userInfoBean?.nickname ?? "", - style: const TextStyle( - color: Color.fromRGBO(247, 250, 250, 1.0), - fontSize: 14, - ), - ), - SizedBox(width: 8.sp), - _buildInfoRow(controller), - ], - ), - Row( - children: [ - Container( - margin: EdgeInsets.only(right: 5.sp), - width: 5.sp, - height: 5.sp, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: logic.isOnline - ? const Color(0xFF00FFF4) - : const Color(0xFF787575), - ), - ), - Text( - controller.onLineCity, - style: TextStyle( - fontSize: 12, - color: logic.isOnline - ? const Color(0xFF00FFF4) - : const Color(0xFF787575), - ), - ), - ], - ), - ], - ), - SizedBox( - height: 59.sp, - child: ListView.builder( - itemCount: interests.length, - scrollDirection: Axis.horizontal, - padding: EdgeInsets.symmetric(vertical: 18.sp), - itemBuilder: (context, index) { - final interest = interests[index]; - return Container( - margin: EdgeInsets.only(right: 11.sp), - child: Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - gradient: const LinearGradient( - colors: [ - Color(0xFF06F9FA), - Color(0xFFDC5BFD), - ], - ), - color: const Color(0xFF392D53), - ), - child: Container( - margin: EdgeInsets.all(0.2.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(17.0), - color: const Color(0xFF392D53), - ), - child: Padding( - padding: EdgeInsets.only( - top: 2.sp, - bottom: 2.sp, - left: 15.sp, - right: 15.sp, - ), - child: Center( - child: Text( - interest.title, - style: const TextStyle( - fontSize: 11.0, - color: Colors.white, - ), - ), - ), - ), - ), - ), - ); - }, - ), - ), - titleTab(controller), - Expanded( - child: TabBarView( - controller: _tabController, + Container( + padding: EdgeInsets.symmetric(horizontal: 19.sp), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - _imageAdapter(controller), - Container( - margin: EdgeInsets.only(bottom: 26.sp), - child: HomeCallOutView(controller.userId), + _imagelistView(controller), + Expanded( + child: buildUserContainer(controller), ), ], ), ), + Container( + padding: EdgeInsets.symmetric(horizontal: 19.sp,), + margin: EdgeInsets.only(top: 19.sp), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Text( + userInfoBean?.nickname ?? "", + style: const TextStyle( + color: Color.fromRGBO(247, 250, 250, 1.0), + fontSize: 14, + ), + ), + SizedBox(width: 8.sp), + _buildInfoRow(controller), + ], + ), + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5.sp), + width: 5.sp, + height: 5.sp, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: logic.isOnline + ? const Color(0xFF00FFF4) + : const Color(0xFF787575), + ), + ), + Text( + controller.onLineCity, + style: TextStyle( + fontSize: 12.sp, + color: logic.isOnline + ? const Color(0xFF00FFF4) + : const Color(0xFF787575), + ), + ), + ], + ), + ], + ), + ), + SizedBox( + height: 59.sp, + + child: _buildInterestsListView(interests), + ), + titleTab(controller), + Expanded( + child: PageView( + controller: _pageController, + onPageChanged: (index) { + _tabController.animateTo(index); + }, + children: [ + _imageAdapter(controller), + HomeCallOutView(controller.userId), + ], + ), + ), + ], ), ); } + Widget _buildInterestsListView(List interests) { + return ListView.builder( + itemCount: interests.length, + scrollDirection: Axis.horizontal, + padding: EdgeInsets.symmetric(vertical: 18.sp,horizontal: 19.sp), + itemBuilder: (context, index) { + final interest = interests[index]; + return Container( + margin: EdgeInsets.only(right: 11.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + gradient: const LinearGradient( + colors: [ + Color(0xFF06F9FA), + Color(0xFFDC5BFD), + ], + ), + color: const Color(0xFF392D53), + ), + child: Container( + margin: EdgeInsets.all(0.2.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(17.0), + color: const Color(0xFF392D53), + ), + child: Padding( + padding: EdgeInsets.only( + top: 2.sp, + bottom: 2.sp, + left: 15.sp, + right: 15.sp, + ), + child: Center( + child: Text( + interest.title, + style: const TextStyle( + fontSize: 11.0, + color: Colors.white, + ), + ), + ), + ), + ), + ); + }, + ); + } + Widget titleTab(UserinfoLogic controller) { return Container( alignment: Alignment.centerLeft, + padding: EdgeInsets.symmetric(horizontal: 10.sp), height: 27.sp, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -331,17 +340,32 @@ class _MyTabbedScreenState extends State TabBar( isScrollable: true, controller: _tabController, + indicator: UnderlineTabIndicator( + borderSide: BorderSide( + color:const Color(0xFF00FFF4) , + width: 2.sp, + ), + insets: EdgeInsets.symmetric(horizontal: 6.0.sp), + borderRadius: BorderRadius.circular(18.0), + ), indicatorColor: const Color(0xFF00FFF4), indicatorWeight: 2.sp, labelColor: const Color(0xFF00FFF4), unselectedLabelColor: const Color(0xB3FFFFFF), indicatorSize: TabBarIndicatorSize.label, - tabs: const [ + tabs: const [ Tab( text: "形象照", ), Tab(text: "喊话"), ], + onTap: (index){ + _pageController.animateToPage( + index, // 目标页面索引 + duration: const Duration(milliseconds: 300), // 动画时长 + curve: Curves.ease, // 动画曲线 + ); + }, ), GestureDetector( onTap: () { @@ -393,22 +417,23 @@ class _MyTabbedScreenState extends State Widget _imageAdapter(UserinfoLogic controller) { - return 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), + 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), + ), ), - ), - Expanded( - child: Container( - margin: const EdgeInsets.only(bottom: 58.0), + Expanded( child: GridView.builder( + padding: const EdgeInsets.only(bottom: 58.0), shrinkWrap: true, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, @@ -461,51 +486,51 @@ class _MyTabbedScreenState extends State }, ), ), - ), - ], - ), - if (logic.isMe) - Positioned( - left: 0, - right: 0, - bottom: 26.sp, - child: GestureDetector( - onTap: () async { - var data = 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, + ], + ), + 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, + padding: EdgeInsets.symmetric( + vertical: 10.sp, + horizontal: 55.sp, + ), + child: const Text( + "完善个人形象", + style: TextStyle( + color: Colors.white, + fontSize: 12, + ), ), ), ), ), ), - ), - ], + ], + ), ); } @@ -552,11 +577,12 @@ class _MyTabbedScreenState extends State Widget buildUserContainer(UserinfoLogic controller) { return Container( - margin: EdgeInsets.symmetric(horizontal: 1.sp, vertical: 14.sp), + margin: EdgeInsets.only( left: 3.sp), height: 58.sp, decoration: BoxDecoration( image: DecorationImage( image: AssetImage(getMineImage("icon_user_content")), + fit: BoxFit.fill, ), ), @@ -581,6 +607,7 @@ class _MyTabbedScreenState extends State alignment: Alignment.center, children: [ Container( + width: 68.sp, height: 68.sp, decoration: const BoxDecoration( diff --git a/circle_app/lib/app/userinfo/widgets/home_call_out.dart b/circle_app/lib/app/userinfo/widgets/home_call_out.dart index b091bd0..872deeb 100644 --- a/circle_app/lib/app/userinfo/widgets/home_call_out.dart +++ b/circle_app/lib/app/userinfo/widgets/home_call_out.dart @@ -1,4 +1,3 @@ - import 'package:cached_network_image/cached_network_image.dart'; import 'package:circle_app/app/circle/state.dart'; import 'package:circle_app/app/circle/widgets/video_item.dart'; @@ -16,6 +15,7 @@ class HomeCallOutView extends StatefulWidget { // Get.lazyPut(() => ListLogic()); String userId; + HomeCallOutView(this.userId, {super.key}); @override @@ -23,7 +23,6 @@ class HomeCallOutView extends StatefulWidget { } class _HomeCallOutViewState extends State { - HomeCallOutLogic? listsLg; @override @@ -56,7 +55,10 @@ class _HomeCallOutViewState extends State { Container( height: Get.height, width: Get.width, - margin: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom + 30.sp), + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).padding.bottom + 56.sp, + left: 19.sp, + right: 19.sp), child: RefreshIndicator( onRefresh: () async { listLogic.refreshData(); @@ -78,9 +80,12 @@ class _HomeCallOutViewState extends State { } } else { return Container( - margin: EdgeInsets.only(top: listLogic.callOutMore ? 0 : 10.sp), - child: loaddingWidget( - listLogic.callOutMore), + margin: EdgeInsets.only( + top: listLogic.callOutMore + ? 0 + : 10.sp), + child: + loaddingWidget(listLogic.callOutMore), ); } }), @@ -100,7 +105,6 @@ class _HomeCallOutViewState extends State { maxLines: 2, ); - double picHeight = 0.0; int type = 0; @@ -121,216 +125,238 @@ class _HomeCallOutViewState extends State { } } double titleHeight = textWidth(lists.interest!['title']); - double widgetHeight = 115.sp + contentHeight(lists.content!) + (picHeight > 0 ? picHeight + 5 : 0); + double widgetHeight = 115.sp + + contentHeight(lists.content!) + + (picHeight > 0 ? picHeight + 5 : 0); - return Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - height: widgetHeight, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('pic_bg'), - ))), - child: Stack(children: [ - Positioned( - left: 0, - top: 2.sp, - child: Image.asset(getCircleImage('vip_say')), - height: 18.sp, + return Column( + children: [ + Container( + margin: EdgeInsets.only(top: 14.sp,bottom: 10.sp), + alignment: Alignment.centerLeft, + child: Text( + lists.create_time.toString(), + style: TextStyle(color: Colors.white, fontSize: 12.sp), ), - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('location'), - width: titleHeight + 15.sp, - height: 20.sp, - fit: BoxFit.fitWidth, - ), - Text( - lists.interest!['title'], - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - ), - Container( - height: widgetHeight, + ), + Container( + margin: EdgeInsets.only(top: 10.sp), width: Get.width, - padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), - child: Column( - children: [ - Container( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: Stack( - alignment: Alignment.center, + height: widgetHeight, + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('pic_bg'), + ))), + child: Stack(children: [ + Positioned( + left: 0, + top: 2.sp, + child: Image.asset(getCircleImage('vip_say')), + height: 18.sp, + ), + Positioned( + right: 2.sp, + top: 2.sp, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('location'), + width: titleHeight + 15.sp, + height: 20.sp, + fit: BoxFit.fitWidth, + ), + Text( + lists.interest!['title'], + style: TextStyle(color: Colors.white, fontSize: 12.sp), + ) + ], + ), + ), + Container( + height: widgetHeight, + width: Get.width, + padding: EdgeInsets.only(top: 12.sp, left: 12.sp, right: 12.sp), + child: Column( + children: [ + Container( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), GestureDetector( - onTap: () { - listsLg?.pushMsgPage(lists, lists.id.toString()); - }, - child: ClipOval( - child: Image.network( - lists.user!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.fill, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, ), - ), - ) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + GestureDetector( + onTap: () { + listsLg?.pushMsgPage( + lists, lists.id.toString()); + }, + child: ClipOval( + child: Image.network( + lists.user!.avatar!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + ), + ), + ) + ], + )), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname!, - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + Row( + children: [ + Text( + lists.user!.nickname!, + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8.sp, + ), + lists.user!.vip! == 0 + ? Container() + : Image.asset( + getCircleImage('vip'), + width: 36.sp, + ) + ], ), SizedBox( - width: 8.sp, + height: 4.sp, + ), + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: EdgeInsets.only( + left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: + BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender!, + lists.user!.age!, + lists.user!.role!, + lists.user!.orientation!), + + // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', + style: TextStyle( + color: Colors.black, + fontSize: 10.sp, + ), + ), + ) + ], ), - lists.user!.vip! == 0 - ? Container() - : Image.asset( - getCircleImage('vip'), - width: 36.sp, - ) ], ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - - child: Text( - getAgeCOntent(lists.user!.gender!, lists.user!.age!, - lists.user!.role!, lists.user!.orientation!), - - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + Container( + height: picHeight, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 140.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0]!.url!)) + : GridView.builder( + itemCount: lists.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: 1.0 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + errorWidget: (context, url, error) => + Icon(Icons.error), + fit: BoxFit.cover, ), ), - ) - ], + ); + }), + ), + Container( + width: Get.width, + margin: EdgeInsets.only(top: 4.sp), + alignment: Alignment.centerLeft, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + lists.create_time!, + style: TextStyle( + color: Colors.white, fontSize: 12.sp), ), + widget.userId.isNotEmpty + ? Container() + : GestureDetector( + onTap: () { + showTipPiker(lists.id!.toString(), + listsLg!.lists.indexOf(lists)); + }, + child: Image.asset( + getCircleImage('delete'), + width: 14.sp, + )) ], - ), - )), - ], - ), + )) + ], ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - Container( - height: picHeight, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0]!.url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget - ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - Icon(Icons.error), - fit: BoxFit.cover, - ), - ), - ); - }), - ), - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp), - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - lists.create_time!, - style: - TextStyle(color: Colors.white, fontSize: 12.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showTipPiker(lists.id!.toString(), listsLg!.lists.indexOf(lists)); - }, - child: Image.asset(getCircleImage('delete'),width: 14.sp,)) - ], - )) - ], - ), - ) - ])); + ) + ])), + ], + ); } ///普通图文喊话 @@ -363,215 +389,236 @@ class _HomeCallOutViewState extends State { double titleHeight = textWidth(lists.interest!['title']); - return Container( - margin: EdgeInsets.only(top: 10.sp), - width: Get.width, - height: picHeight > 0 ? 105.sp + contentHeight(lists.content!) + picHeight : 100.sp + contentHeight(lists.content!), - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage( - getCircleImage('normal_bg'), - ))), - child: Stack( - children: [ - Positioned( - right: 2.sp, - top: 2.sp, - child: Stack( - alignment: Alignment.center, - children: [ - Image.asset( - getCircleImage('location'), - width: titleHeight + 15.sp, - height: 20.sp, - fit: BoxFit.fitWidth, - ), - Text( - lists.interest!['title'], - style: TextStyle(color: Colors.white, fontSize: 12.sp), - ) - ], - ), - // height: 18.sp, + return Column( + children: [ + Container( + margin: EdgeInsets.only(top: 14.sp,bottom: 10.sp), + alignment: Alignment.centerLeft, + child: Text( + lists.create_time.toString(), + style: TextStyle(color: Colors.white, fontSize: 12.sp), ), - Container( - // height: 130.sp + contentHeight(lists.content!) + picHeight, - width: Get.width, - // color: Colors.blue, - padding: EdgeInsets.only(left: 12.sp, right: 12.sp), - child: Column( - children: [ - Container( - height: 72.sp, - child: Row( - // mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: Stack( - alignment: Alignment.center, + ), + Container( + margin: EdgeInsets.only(top: 10.sp), + width: Get.width, + height: picHeight > 0 + ? 105.sp + contentHeight(lists.content!) + picHeight + : 100.sp + contentHeight(lists.content!), + decoration: BoxDecoration( + image: DecorationImage( + fit: BoxFit.fill, + image: AssetImage( + getCircleImage('normal_bg'), + ))), + child: Stack( + children: [ + Positioned( + right: 2.sp, + top: 2.sp, + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('location'), + width: titleHeight + 15.sp, + height: 20.sp, + fit: BoxFit.fitWidth, + ), + Text( + lists.interest!['title'], + style: TextStyle(color: Colors.white, fontSize: 12.sp), + ) + ], + ), + // height: 18.sp, + ), + Container( + // height: 130.sp + contentHeight(lists.content!) + picHeight, + width: Get.width, + // color: Colors.blue, + padding: EdgeInsets.only(left: 12.sp, right: 12.sp), + child: Column( + children: [ + Container( + height: 72.sp, + child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Image.asset( - getCircleImage('avatar_bg'), - width: 42.sp, - ), GestureDetector( - onTap: () {}, - child: ClipOval( - child: Image.network( - lists.user!.avatar!, - width: 40.sp, - height: 40.sp, - fit: BoxFit.fill, - ), - )) - ], - )), - Expanded( - child: Container( - padding: EdgeInsets.only(left: 8.sp, top: 12.sp), - alignment: Alignment.centerLeft, - height: 72.sp, - child: Column( - children: [ - Row( + child: Stack( + alignment: Alignment.center, + children: [ + Image.asset( + getCircleImage('avatar_bg'), + width: 42.sp, + ), + GestureDetector( + onTap: () {}, + child: ClipOval( + child: Image.network( + lists.user!.avatar!, + width: 40.sp, + height: 40.sp, + fit: BoxFit.cover, + ), + )) + ], + )), + Expanded( + child: Container( + padding: EdgeInsets.only(left: 8.sp, top: 12.sp), + alignment: Alignment.centerLeft, + height: 72.sp, + child: Column( children: [ - Text( - lists.user!.nickname! ?? '', - style: TextStyle( - color: Colors.white, - fontSize: 18.sp, - fontWeight: FontWeight.w600), + Row( + children: [ + Text( + lists.user!.nickname! ?? '', + style: TextStyle( + color: Colors.white, + fontSize: 18.sp, + fontWeight: FontWeight.w600), + ), + SizedBox( + width: 8.sp, + ), + lists.user!.vip! == 0 + ? Container() + : Image.asset( + getCircleImage('vip'), + width: 36.sp, + ) + ], ), SizedBox( - width: 8.sp, + height: 4.sp, ), - lists.user!.vip! == 0 - ? Container() - : Image.asset( - getCircleImage('vip'), - width: 36.sp, - ) - ], - ), - SizedBox( - height: 4.sp, - ), - Row( - children: [ - Container( - alignment: Alignment.center, - height: 18.sp, - padding: - EdgeInsets.only(left: 6.sp, right: 6.sp), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(9.sp), - gradient: const LinearGradient( - begin: Alignment(0.25, 0.5), - end: Alignment(0.75, 0.5), - colors: [ - Color(0xff8DFFF8), - Color(0xffB5D3FF) - ])), - child: Text( - getAgeCOntent(lists.user!.gender!, lists.user!.age!, - lists.user!.role!, lists.user!.orientation!), - // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', - style: TextStyle( - color: Colors.black, - fontSize: 12.sp, - ), - ), - ) - ], - ), - ], - ), - )), - ], - ), - ), - Container( - alignment: Alignment.topLeft, - // margin: EdgeInsets.only(top: 4.sp), - child: descText, - ), - picHeight > 0 - ? Container( - height: picHeight, - alignment: Alignment.centerLeft, - margin: EdgeInsets.only(top: 5.sp), - child: picHeight == 140.sp - ? ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: VideoItemWidget(lists.album![0].url!)) - : GridView.builder( - itemCount: lists.album!.length, - physics: const NeverScrollableScrollPhysics(), - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, //横轴三个子widget - crossAxisSpacing: 8.sp, - mainAxisSpacing: 8.sp, - childAspectRatio: 1.0 //宽高比为1时,子widget + Row( + children: [ + Container( + alignment: Alignment.center, + height: 18.sp, + padding: + EdgeInsets.only(left: 6.sp, right: 6.sp), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(9.sp), + gradient: const LinearGradient( + begin: Alignment(0.25, 0.5), + end: Alignment(0.75, 0.5), + colors: [ + Color(0xff8DFFF8), + Color(0xffB5D3FF) + ])), + child: Text( + getAgeCOntent( + lists.user!.gender!, + lists.user!.age!, + lists.user!.role!, + lists.user!.orientation!), + // '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}', + style: TextStyle( + color: Colors.black, + fontSize: 12.sp, ), - itemBuilder: (contentxt, currentIndex) { - Album album = lists.album![currentIndex]; - if (album.type == 2) { - return ClipRRect( - borderRadius: - BorderRadius.circular(6.sp), - child: VideoItemWidget(album.url!)); - } - return GestureDetector( - onTap: () { - var imgList = []; - for (var element in lists.album!) { - imgList.add(element.url!); - } - Get.toNamed(AppRoutes.Swiper, arguments: { - 'imaglist': imgList, - 'index': currentIndex - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.sp), - child: CachedNetworkImage( - imageUrl: album.url!, - errorWidget: (context, url, error) => - Icon(Icons.error), - fit: BoxFit.cover, ), - ), - ); - })) - : Container(), - Container( - width: Get.width, - margin: EdgeInsets.only(top: 4.sp), - alignment: Alignment.centerLeft, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - lists.create_time!, - style: - TextStyle(color: Colors.white, fontSize: 12.sp), - ), - widget.userId.isNotEmpty - ? Container() - : GestureDetector( - onTap: () { - showTipPiker(lists.id!.toString(), listsLg!.lists.indexOf(lists)); - }, - child: Image.asset(getCircleImage('delete'),width: 14.sp,)) - ], - )) - ], - ), - ) - ], - ), + ) + ], + ), + ], + ), + )), + ], + ), + ), + Container( + alignment: Alignment.topLeft, + // margin: EdgeInsets.only(top: 4.sp), + child: descText, + ), + picHeight > 0 + ? Container( + height: picHeight, + alignment: Alignment.centerLeft, + margin: EdgeInsets.only(top: 5.sp), + child: picHeight == 140.sp + ? ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: VideoItemWidget(lists.album![0].url!)) + : GridView.builder( + itemCount: lists.album!.length, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: + SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, //横轴三个子widget + crossAxisSpacing: 8.sp, + mainAxisSpacing: 8.sp, + childAspectRatio: 1.0 //宽高比为1时,子widget + ), + itemBuilder: (contentxt, currentIndex) { + Album album = lists.album![currentIndex]; + if (album.type == 2) { + return ClipRRect( + borderRadius: + BorderRadius.circular(6.sp), + child: VideoItemWidget(album.url!)); + } + return GestureDetector( + onTap: () { + var imgList = []; + for (var element in lists.album!) { + imgList.add(element.url!); + } + Get.toNamed(AppRoutes.Swiper, arguments: { + 'imaglist': imgList, + 'index': currentIndex + }); + }, + child: ClipRRect( + borderRadius: BorderRadius.circular(6.sp), + child: CachedNetworkImage( + imageUrl: album.url!, + errorWidget: (context, url, error) => + Icon(Icons.error), + fit: BoxFit.cover, + ), + ), + ); + })) + : Container(), + Container( + width: Get.width, + margin: EdgeInsets.only(top: 4.sp), + alignment: Alignment.centerLeft, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + lists.create_time!, + style: + TextStyle(color: Colors.white, fontSize: 12.sp), + ), + widget.userId.isNotEmpty + ? Container() + : GestureDetector( + onTap: () { + showTipPiker(lists.id!.toString(), + listsLg!.lists.indexOf(lists)); + }, + child: Image.asset( + getCircleImage('delete'), + width: 14.sp, + )) + ], + )) + ], + ), + ) + ], + ), + ), + ], ); } @@ -604,11 +651,12 @@ class _HomeCallOutViewState extends State { double textWidth(value) { TextPainter painter = TextPainter( - ///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。 + ///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。 locale: WidgetsBinding.instance!.window.locale, maxLines: 1, textDirection: TextDirection.ltr, - textScaleFactor: 1, //字体缩放大小 + textScaleFactor: 1, + //字体缩放大小 text: TextSpan( text: value, style: TextStyle( @@ -618,38 +666,40 @@ class _HomeCallOutViewState extends State { return painter.width; } - showTipPiker(String callOutId,int index) { + showTipPiker(String callOutId, int index) { return Get.bottomSheet( - Scaffold( - backgroundColor: Colors.transparent, - body: CupertinoAlertDialog( - content: SingleChildScrollView( - child: ListBody( - children: const [ - Text("是否要删除该喊话?"), - ], - ), + Scaffold( + backgroundColor: Colors.transparent, + body: CupertinoAlertDialog( + content: SingleChildScrollView( + child: ListBody( + children: const [ + Text("是否要删除该喊话?"), + ], ), - actions: [ - CupertinoDialogAction( - child: const Text("确定",style: TextStyle(color: Colors.red),), - onPressed: () { - Get.back(); - listsLg?.removeData(callOutId,index); - }, - ), - CupertinoDialogAction( - child: const Text("取消"), - onPressed: () { - Get.back(); - }, - ), - ], ), + actions: [ + CupertinoDialogAction( + child: const Text( + "确定", + style: TextStyle(color: Colors.red), + ), + onPressed: () { + Get.back(); + listsLg?.removeData(callOutId, index); + }, + ), + CupertinoDialogAction( + child: const Text("取消"), + onPressed: () { + Get.back(); + }, + ), + ], ), + ), isScrollControlled: true, enableDrag: false, - ); } } diff --git a/circle_app/lib/app/visitorlist/view.dart b/circle_app/lib/app/visitorlist/view.dart index 6670ebf..59f0dae 100644 --- a/circle_app/lib/app/visitorlist/view.dart +++ b/circle_app/lib/app/visitorlist/view.dart @@ -108,30 +108,29 @@ class VisitorlistPage extends StatelessWidget { // Placeholder image ], ), - SizedBox(height: 8.sp), - Container( - width: 150.sp, + SizedBox( + width: 200.sp, child: Text( item.user.signature, - style: TextStyle(fontSize: 12.sp, color: Color(0xFFB7BECC)), + overflow: TextOverflow.ellipsis, // 超出部分使用省略号表示 + maxLines: 1, + style: TextStyle(fontSize: 12.sp, color: const Color(0xFFB7BECC)), ), ), ], ), // Pla - Spacer(), + const Spacer(), GestureDetector(onTap: (){ pushChatPage(item.user.id.toString(),item.accountId, item.user.nickname); - - }, child: Container( width: 60.sp, height: 28.sp, decoration: BoxDecoration( - color: Color(0xFFFF4D7C), - borderRadius: BorderRadius.circular(14), + color: const Color(0xFFFF4D7C), + borderRadius: BorderRadius.circular(14.sp), ), child: Center( child: Text("私聊", style: TextStyle(fontSize: 14.sp, color: Colors.white)), diff --git a/circle_app/lib/main.dart b/circle_app/lib/main.dart index b94f53d..8c4a5c0 100644 --- a/circle_app/lib/main.dart +++ b/circle_app/lib/main.dart @@ -25,6 +25,12 @@ void main() { runApp(const MyApp()); } +int IMsdkAppID = 1400799631; + +String iOSAPPid = ""; + + + //登录IM loginIM(String userId,String sig) async { @@ -210,7 +216,7 @@ class _MyAppState extends State { initIM() { coreInstance.init( sdkAppID: - 1400799631, // Replace 0 with the SDKAppID of your IM application when integrating + IMsdkAppID, // Replace 0 with the SDKAppID of your IM application when integrating // language: LanguageEnum.en, // 界面语言配置,若不配置,则跟随系统语言 loglevel: LogLevelEnum.V2TIM_LOG_DEBUG, onTUIKitCallbackListener: (TIMCallback callbackValue) { diff --git a/circle_app/lib/network/api.dart b/circle_app/lib/network/api.dart index 9adf271..715ea30 100644 --- a/circle_app/lib/network/api.dart +++ b/circle_app/lib/network/api.dart @@ -60,6 +60,10 @@ class Api { + + //版本信息 + static const APP_VERSION = 'user-service/app/version'; + //入圈出圈 static const outCrrcle = 'up-service/interest/'; diff --git a/circle_app/lib/network/dio_manager.dart b/circle_app/lib/network/dio_manager.dart index 5d1b6d2..0612d96 100644 --- a/circle_app/lib/network/dio_manager.dart +++ b/circle_app/lib/network/dio_manager.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:circle_app/util/util.dart'; import 'package:dio/dio.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import '../util/device.dart'; import 'api.dart'; @@ -347,3 +348,5 @@ class QnTokenData { ); } } + +