增加无网拦截
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 197 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.7 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 40 KiB |
@ -30,7 +30,7 @@ class AboutappPage extends StatelessWidget {
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: MyAppBar(centerTitle: '关于圈子',),
|
||||
appBar: const MyAppBar(centerTitle: '关于圈子',),
|
||||
body: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
// Replace with your desired color
|
||||
@ -105,11 +105,11 @@ class AboutappPage extends StatelessWidget {
|
||||
Text(
|
||||
'用户协议',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
color: const Color(0xFFF7FAFA),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
@ -127,14 +127,14 @@ class AboutappPage extends StatelessWidget {
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
const Text(
|
||||
'隐私政策',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
@ -155,11 +155,11 @@ class AboutappPage extends StatelessWidget {
|
||||
Text(
|
||||
'版本更新',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFF7FAFA),
|
||||
color: const Color(0xFFF7FAFA),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
Container(
|
||||
width: 6.sp,
|
||||
height: 5.sp,
|
||||
@ -172,11 +172,11 @@ class AboutappPage extends StatelessWidget {
|
||||
Text(
|
||||
logic.version,
|
||||
style: TextStyle(
|
||||
color: Color(0xFFB7BECC),
|
||||
color: const Color(0xFFB7BECC),
|
||||
fontSize: 12.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
SizedBox(width: 8.sp),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
width: 24.sp,
|
||||
|
||||
@ -6,12 +6,28 @@ import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../../network/api.dart';
|
||||
import '../../../util/SharedPreferencesHelper.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class LoginLogic extends GetxController {
|
||||
@override
|
||||
void onInit() async{
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
SharedPreferences sharedPreferences =await SharedPreferences.getInstance();
|
||||
String loginPhone = await sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE)??"";
|
||||
print(loginPhone);
|
||||
phoneEditingController.text = loginPhone;
|
||||
if (GetUtils.isPhoneNumber(loginPhone)&& loginPhone.length==11) {
|
||||
isPhoto = true;
|
||||
}
|
||||
update();
|
||||
|
||||
}
|
||||
bool isPhoto = false;
|
||||
final LoginState state = LoginState();
|
||||
TextEditingController phoneEditingController = TextEditingController();
|
||||
TextEditingController codeEditingController = TextEditingController();
|
||||
@ -24,8 +40,21 @@ class LoginLogic extends GetxController {
|
||||
starDownTimer() {
|
||||
if (sendCodeBtn == false && seconds == 60) {
|
||||
getCode();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getCode() async {
|
||||
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": phoneEditingController.text});
|
||||
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
||||
showToast(bean.msg);
|
||||
if(bean.code==200){
|
||||
if(kDebugMode){
|
||||
codeEditingController.text = bean.data!.code.toString();
|
||||
update();
|
||||
}
|
||||
sendCodeBtn = true;
|
||||
t = Timer.periodic(Duration(milliseconds: 1000), (timer) {
|
||||
t = Timer.periodic(const Duration(milliseconds: 1000), (timer) {
|
||||
seconds--;
|
||||
if (seconds == 0) {
|
||||
t?.cancel(); //清除
|
||||
@ -35,18 +64,7 @@ class LoginLogic extends GetxController {
|
||||
update();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getCode() async {
|
||||
var data = await DioManager.instance.post(url: Api.sendCode, params: {"phone": phoneEditingController.text});
|
||||
var bean = BaseResponse<Data>.fromJson(data, (data) => Data.fromJson(data));
|
||||
showToast(bean.msg);
|
||||
if(kDebugMode){
|
||||
if(bean.code==200){
|
||||
codeEditingController.text = bean.data!.code.toString();
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -69,6 +87,7 @@ class LoginLogic extends GetxController {
|
||||
var bean = BaseResponse<LoginData>.fromJson(data, (data) => LoginData.fromJson(data));
|
||||
if (bean.code == 200) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.LOGINPHONE, phoneEditingController.text);
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,bean.data!.Authorization.toString());
|
||||
});
|
||||
|
||||
@ -78,6 +97,7 @@ class LoginLogic extends GetxController {
|
||||
return;
|
||||
} else if (bean.code == 30002) {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.LOGINPHONE, phoneEditingController.text);
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,bean.data!.Authorization.toString());
|
||||
});
|
||||
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:circle_app/util/util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -13,7 +15,7 @@ class LoginPage extends StatelessWidget {
|
||||
final state = Get
|
||||
.find<LoginLogic>()
|
||||
.state;
|
||||
bool isPhoto = false;
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -57,9 +59,9 @@ class LoginPage extends StatelessWidget {
|
||||
child: TextField(
|
||||
onChanged: (msg){
|
||||
if (GetUtils.isPhoneNumber(msg)&& msg.length==11) {
|
||||
isPhoto = true;
|
||||
logic.isPhoto = true;
|
||||
}else{
|
||||
isPhoto = false;
|
||||
logic.isPhoto = false;
|
||||
}
|
||||
logic.update();
|
||||
},
|
||||
@ -129,7 +131,7 @@ class LoginPage extends StatelessWidget {
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if(isPhoto){
|
||||
if(logic.isPhoto){
|
||||
logic.starDownTimer();
|
||||
}
|
||||
},
|
||||
@ -138,7 +140,7 @@ class LoginPage extends StatelessWidget {
|
||||
width: 76.sp,
|
||||
height: 29.sp,
|
||||
decoration: BoxDecoration(
|
||||
color:isPhoto ? Color(0xFF21BEAB) : Colors.white30,
|
||||
color:logic.isPhoto ? Color(0xFF21BEAB) : Colors.white30,
|
||||
borderRadius: BorderRadius.circular(
|
||||
29.sp / 2)
|
||||
),
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
@ -26,8 +25,9 @@ class MinefragmentPage extends StatelessWidget {
|
||||
.padding
|
||||
.top;
|
||||
|
||||
return GetBuilder<MinefragmentLogic>(builder: (logic) {
|
||||
return Scaffold(
|
||||
return GetBuilder<MinefragmentLogic>(
|
||||
builder: (logic) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
width: Get.width,
|
||||
height: Get.height,
|
||||
@ -63,10 +63,8 @@ class MinefragmentPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _CircleLiveView(MinefragmentLogic logic) {
|
||||
return Container(
|
||||
child: Column(
|
||||
children: [_CircleItemView(logic), _HelpItemView(), _SetUpItemView()],
|
||||
),
|
||||
return Column(
|
||||
children: [_CircleItemView(logic), _HelpItemView(), _SetUpItemView()],
|
||||
);
|
||||
}
|
||||
|
||||
@ -91,7 +89,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
height: 24.sp,
|
||||
),
|
||||
SizedBox(width: 10.sp),
|
||||
Text(
|
||||
const Text(
|
||||
"设置",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
@ -132,7 +130,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
height: 24.sp,
|
||||
),
|
||||
SizedBox(width: 10.sp),
|
||||
Text(
|
||||
const Text(
|
||||
"帮助与反馈",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
@ -172,7 +170,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
height: 24.sp,
|
||||
),
|
||||
SizedBox(width: 10.sp),
|
||||
Text(
|
||||
const Text(
|
||||
"我的圈子",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
@ -182,7 +180,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
logic.JoinedCircle,
|
||||
style: TextStyle(color: Colors.white30),
|
||||
style: const TextStyle(color: Colors.white30),
|
||||
),
|
||||
Image(
|
||||
image: AssetImage(getHomeImage("icon_in")),
|
||||
@ -211,34 +209,32 @@ class MinefragmentPage extends StatelessWidget {
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.FriendsActivity);
|
||||
},
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
logic.like_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.sp),
|
||||
Text(
|
||||
"我喜欢的",
|
||||
style: TextStyle(
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Color(0x99FF00F8),
|
||||
offset: Offset(2, 2),
|
||||
blurRadius: 3,
|
||||
),
|
||||
],
|
||||
color: Color.fromARGB(255, 247, 250, 250),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
logic.like_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 4.sp),
|
||||
Text(
|
||||
"我喜欢的",
|
||||
style: TextStyle(
|
||||
shadows: const [
|
||||
Shadow(
|
||||
color: Color(0x99FF00F8),
|
||||
offset: Offset(2, 2),
|
||||
blurRadius: 3,
|
||||
),
|
||||
],
|
||||
color: const Color.fromARGB(255, 247, 250, 250),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
@ -260,13 +256,11 @@ class MinefragmentPage extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
logic.like_me_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
Text(
|
||||
logic.like_me_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -278,14 +272,14 @@ class MinefragmentPage extends StatelessWidget {
|
||||
Text(
|
||||
"喜欢我的",
|
||||
style: TextStyle(
|
||||
shadows: [
|
||||
shadows: const [
|
||||
Shadow(
|
||||
color: Color(0x99FF00F8),
|
||||
offset: Offset(2, 2),
|
||||
blurRadius: 3,
|
||||
),
|
||||
],
|
||||
color: Color.fromARGB(255, 247, 250, 250),
|
||||
color: const Color.fromARGB(255, 247, 250, 250),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
@ -295,8 +289,8 @@ class MinefragmentPage extends StatelessWidget {
|
||||
right: 0.sp,
|
||||
top: 15.sp,
|
||||
child: Text(
|
||||
logic.like_me_count_new>0 ? "+"+logic.like_me_count_new.toString():"",
|
||||
style: TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
||||
logic.like_me_count_new>0 ? "+${logic.like_me_count_new}":"",
|
||||
style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -320,32 +314,30 @@ class MinefragmentPage extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
child: Text(
|
||||
logic.recent_visit_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
logic.recent_visit_count.toString(),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
SizedBox(
|
||||
height: 4.sp,
|
||||
width: 80.sp,
|
||||
),
|
||||
Text(
|
||||
"最近来访",
|
||||
style: TextStyle(
|
||||
shadows: [
|
||||
shadows: const [
|
||||
Shadow(
|
||||
color: Color(0x99FF00F8),
|
||||
offset: Offset(2, 2),
|
||||
blurRadius: 3,
|
||||
),
|
||||
],
|
||||
color: Color.fromARGB(255, 247, 250, 250),
|
||||
color: const Color.fromARGB(255, 247, 250, 250),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
@ -355,8 +347,8 @@ class MinefragmentPage extends StatelessWidget {
|
||||
right: 0.sp,
|
||||
top: 15.sp,
|
||||
child: Text(
|
||||
logic.recent_visit_count_new>0 ? "+"+logic.recent_visit_count_new.toString():"",
|
||||
style: TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
||||
logic.recent_visit_count_new>0 ? "+${logic.recent_visit_count_new}":"",
|
||||
style: const TextStyle(color: Color.fromRGBO(0, 255, 210, 1.0)),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -375,7 +367,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
await Get.toNamed(AppRoutes.UserInfoActivity, arguments: "");
|
||||
logic.onInit();
|
||||
},
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
width: Get.width,
|
||||
height: 65.sp,
|
||||
child: Row(
|
||||
@ -440,7 +432,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
}
|
||||
|
||||
},
|
||||
child:logic.userInfoBean==null ? Container(
|
||||
child:logic.userInfoBean==null ? SizedBox(
|
||||
width: 63.sp,
|
||||
height: 63.sp,
|
||||
): CachedNetworkImage(
|
||||
@ -464,7 +456,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
Text(
|
||||
logic.name,
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(247, 250, 250, 1.0),
|
||||
color: const Color.fromRGBO(247, 250, 250, 1.0),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
@ -473,7 +465,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
Text(
|
||||
logic.enterHomeInfoMsg,
|
||||
style: TextStyle(
|
||||
color: Color.fromRGBO(247, 250, 250, 1.0),
|
||||
color: const Color.fromRGBO(247, 250, 250, 1.0),
|
||||
fontSize: 16.sp,
|
||||
),
|
||||
),
|
||||
@ -495,7 +487,7 @@ class MinefragmentPage extends StatelessWidget {
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(17),
|
||||
gradient: LinearGradient(
|
||||
gradient: const LinearGradient(
|
||||
colors: [
|
||||
Color.fromRGBO(141, 255, 248, 1.0),
|
||||
Color.fromRGBO(181, 211, 255, 1.0),
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/app/circle/logic.dart';
|
||||
import 'package:circle_app/app/circle/state.dart';
|
||||
import 'package:circle_app/app/circle/widgets/list_logic.dart';
|
||||
import 'package:circle_app/app/circle/widgets/video_item.dart';
|
||||
import 'package:circle_app/app/userinfo/widgets/home_call_out_logic.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import '../../network/api.dart';
|
||||
import '../../network/dio_manager.dart';
|
||||
import '../../util/util.dart';
|
||||
import 'state.dart';
|
||||
|
||||
class VisitorlistLogic extends GetxController {
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
import 'package:circle_app/app/home/binding.dart';
|
||||
import 'package:circle_app/app/home/view.dart';
|
||||
|
||||
import 'package:circle_app/app/splash/binding.dart';
|
||||
import 'package:circle_app/router/app_pages.dart';
|
||||
import 'package:circle_app/router/app_routers.dart';
|
||||
|
||||
@ -6,6 +6,7 @@ import 'package:dio/dio.dart';
|
||||
|
||||
import '../util/device.dart';
|
||||
import 'api.dart';
|
||||
import 'package:connectivity/connectivity.dart';
|
||||
|
||||
const String baseUrl = Api.baseUrl;
|
||||
|
||||
@ -43,6 +44,7 @@ class DioManager {
|
||||
receiveTimeout: Duration(seconds: 30000000000),
|
||||
));
|
||||
_dio!.interceptors.add(LogInterceptor(responseBody: true));
|
||||
// _dio!.interceptors.add(ConnectivityInterceptor());
|
||||
}
|
||||
|
||||
Future download(String urlPath,String savePath,ProgressCallback progressCallback)async{
|
||||
@ -153,6 +155,13 @@ class DioManager {
|
||||
DioMethod.delete: 'delete',
|
||||
DioMethod.put: 'put'
|
||||
};
|
||||
var connectivityResult = await Connectivity().checkConnectivity();
|
||||
|
||||
if(connectivityResult == ConnectivityResult.none){
|
||||
// showToast("");
|
||||
return {'code': 404, 'msg': '请检查网络连接是否正常'};
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Response response;
|
||||
@ -308,6 +317,22 @@ class BaseResponse<T> {
|
||||
|
||||
|
||||
}
|
||||
class ConnectivityInterceptor extends Interceptor {
|
||||
@override
|
||||
Future<void> onRequest(
|
||||
RequestOptions options, RequestInterceptorHandler handler) async {
|
||||
if (!await isInternetAvailable()) {
|
||||
showToast("请检查网络连接是否正常");
|
||||
}
|
||||
return handler.next(options);
|
||||
}
|
||||
|
||||
Future<bool> isInternetAvailable() async {
|
||||
var connectivityResult = await Connectivity().checkConnectivity();
|
||||
return connectivityResult != ConnectivityResult.none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class QnTokenData {
|
||||
final String token;
|
||||
|
||||
@ -11,6 +11,9 @@ class SharedPreferencesHelper {
|
||||
static const AVATAR = 'avatar';
|
||||
static const NAME = 'name';
|
||||
|
||||
static const LOGINPHONE = 'loginPhone';
|
||||
|
||||
|
||||
static SharedPreferencesHelper? _instance;
|
||||
static SharedPreferences? _preferences;
|
||||
|
||||
@ -65,4 +68,5 @@ class SharedPreferencesHelper {
|
||||
final prefs = preferences;
|
||||
prefs?.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,9 +14,8 @@ import 'package:video_compress/video_compress.dart';
|
||||
|
||||
import 'SharedPreferencesHelper.dart';
|
||||
|
||||
class Util {
|
||||
class Util {}
|
||||
|
||||
}
|
||||
//获取图片
|
||||
String getBaseImage(String image) {
|
||||
return '${Values.base_images}${image}.png';
|
||||
@ -50,8 +49,6 @@ String getCircleImage(String image) {
|
||||
return '${Values.circle_images}${image}.png';
|
||||
}
|
||||
|
||||
|
||||
|
||||
///弹窗文本提示 msg: 提示内容
|
||||
showToast(String msg) {
|
||||
Fluttertoast.showToast(
|
||||
@ -61,17 +58,23 @@ showToast(String msg) {
|
||||
timeInSecForIosWeb: 1,
|
||||
backgroundColor: Colors.black54,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0
|
||||
);
|
||||
fontSize: 16.0);
|
||||
}
|
||||
|
||||
loaddingWidget(bool isMore) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
child: isMore ? const CircularProgressIndicator(color: Color(0xFF07FAFB),) : Container(
|
||||
margin:EdgeInsets.only(top: 4.sp,bottom: 4.sp),
|
||||
child: Text('--到底了--',style: TextStyle(color: Colors.white,fontSize: 13.sp),
|
||||
),),
|
||||
child: isMore
|
||||
? const CircularProgressIndicator(
|
||||
color: Color(0xFF07FAFB),
|
||||
)
|
||||
: Container(
|
||||
margin: EdgeInsets.only(top: 4.sp, bottom: 4.sp),
|
||||
child: Text(
|
||||
'--到底了--',
|
||||
style: TextStyle(color: Colors.white, fontSize: 13.sp),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -81,9 +84,17 @@ noResultWidget() {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(getBaseImage('no_result'),width: 200.sp,),
|
||||
SizedBox(height: 8.sp,),
|
||||
Text('正在等待被填充~',style: TextStyle(color: Color(0xffdbdbdb),fontSize: 15.sp),),
|
||||
Image.asset(
|
||||
getBaseImage('no_result'),
|
||||
width: 200.sp,
|
||||
),
|
||||
SizedBox(
|
||||
height: 8.sp,
|
||||
),
|
||||
Text(
|
||||
'正在等待被填充~',
|
||||
style: TextStyle(color: Color(0xffdbdbdb), fontSize: 15.sp),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -95,11 +106,12 @@ double calculateTextHeight(String value, fontSize, FontWeight fontWeight,
|
||||
value = filterText(value);
|
||||
TextPainter painter = TextPainter(
|
||||
|
||||
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
|
||||
///AUTO:华为手机如果不指定locale的时候,该方法算出来的文字高度是比系统计算偏小的。
|
||||
locale: WidgetsBinding.instance!.window.locale,
|
||||
maxLines: maxLines,
|
||||
textDirection: TextDirection.ltr,
|
||||
textScaleFactor: 1, //字体缩放大小
|
||||
textScaleFactor: 1,
|
||||
//字体缩放大小
|
||||
text: TextSpan(
|
||||
text: value,
|
||||
style: TextStyle(
|
||||
@ -121,7 +133,6 @@ String filterText(String text) {
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
String convertToTenThousand(int number) {
|
||||
if (number >= 10000) {
|
||||
double result = number / 10000;
|
||||
@ -130,15 +141,19 @@ String convertToTenThousand(int number) {
|
||||
return number.toString();
|
||||
}
|
||||
}
|
||||
pushLoginPage() async{
|
||||
|
||||
pushLoginPage() async {
|
||||
logoutIM();
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
String loginPhone = sharedPreferences.getString(SharedPreferencesHelper.LOGINPHONE);
|
||||
print(loginPhone);
|
||||
sharedPreferences.clear();
|
||||
sharedPreferences.setString(SharedPreferencesHelper.LOGINPHONE, loginPhone);
|
||||
});
|
||||
|
||||
|
||||
Get.offAllNamed(AppRoutes.Login);
|
||||
}
|
||||
|
||||
String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
||||
String filteredString = input;
|
||||
for (String word in sensitiveWords) {
|
||||
@ -148,9 +163,8 @@ String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
||||
return filteredString;
|
||||
}
|
||||
|
||||
String getAgeCOntent (int gender,int age,int role,int orientation){
|
||||
return "${getGenderContent(gender)}.${age}.${getRoleContent(role)}.${getOrientationContent(orientation)}";
|
||||
|
||||
String getAgeCOntent(int gender, int age, int role, int orientation) {
|
||||
return "${getGenderContent(gender)}.${age}.${getRoleContent(role)}.${getOrientationContent(orientation)}";
|
||||
}
|
||||
|
||||
String getGenderContent(int number) {
|
||||
@ -171,6 +185,7 @@ String getGenderContent(int number) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
String getOrientationContent(int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -191,6 +206,7 @@ String getOrientationContent(int number) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
String getRoleContent(int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
@ -210,14 +226,15 @@ String getRoleContent(int number) {
|
||||
|
||||
typedef void MyCallback(String path);
|
||||
|
||||
Future<void> compressVideo(String inputPath, String outputPath,MyCallback myCallback) async {
|
||||
Future<void> compressVideo(
|
||||
String inputPath, String outputPath, MyCallback myCallback) async {
|
||||
final info = await VideoCompress.compressVideo(
|
||||
inputPath,
|
||||
quality: VideoQuality.MediumQuality,
|
||||
deleteOrigin: false,
|
||||
);
|
||||
|
||||
if (info != null&&null!=info.path) {
|
||||
if (info != null && null != info.path) {
|
||||
print(info.path);
|
||||
myCallback(info.path!);
|
||||
} else {
|
||||
@ -225,7 +242,6 @@ Future<void> compressVideo(String inputPath, String outputPath,MyCallback myCall
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取应用程序的文档目录路径
|
||||
Future<String> getApplicationDocumentsDirectoryPath() async {
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
@ -249,14 +265,21 @@ Future<String> getLibraryDirectoryPath() async {
|
||||
final directory = await getLibraryDirectory();
|
||||
return directory.path;
|
||||
}
|
||||
|
||||
//跳转到用户协议
|
||||
navigateToUserAgreement(){
|
||||
Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"用户协议","url":"https://docs.qq.com/doc/DZVV1SkttZGlPUW1H"});
|
||||
navigateToUserAgreement() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "用户协议",
|
||||
"url": "https://docs.qq.com/doc/DZVV1SkttZGlPUW1H"
|
||||
});
|
||||
}
|
||||
|
||||
//跳转到隐私政策
|
||||
navigateToPrivacyPolicy(){
|
||||
Get.toNamed(AppRoutes.WebViewActivity,arguments: {'title':"隐私协议","url":"https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1"});
|
||||
navigateToPrivacyPolicy() {
|
||||
Get.toNamed(AppRoutes.WebViewActivity, arguments: {
|
||||
'title': "隐私协议",
|
||||
"url": "https://docs.qq.com/doc/DZXhvcXV6b1RNTUx1"
|
||||
});
|
||||
}
|
||||
|
||||
//发布内容规范
|
||||
|
||||
@ -86,6 +86,9 @@ dependencies:
|
||||
cached_network_image: ^3.2.3
|
||||
#安装apk
|
||||
flutter_install_app: 1.3.0
|
||||
#网络拦截
|
||||
connectivity: ^3.0.6
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||