android的闪屏 logo name 修改bug 新增计算距离方法 修改清除缓存 没有清除本地存储的文件 上传图片不走压缩

This commit is contained in:
YangYuhao 2023-07-26 11:49:09 +08:00
parent 7f4b634f31
commit 532103fc5b
44 changed files with 274 additions and 32 deletions

View File

@ -28,7 +28,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:label="circle_app"
android:label="微乐园"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

@ -1,12 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<item>
<!-- 设置背景颜色 -->
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
android:src="@mipmap/launch_back" />
</item>
<!-- <item-->
<!-- android:top="141dp"-->
<!-- android:left="37dp"-->
<!-- android:width="100dp"-->
<!-- android:height="100dp"-->
<!-- >-->
<!-- <bitmap-->
<!-- android:src="@mipmap/logo" />-->
<!-- </item>-->
<!-- <item-->
<!-- android:top="141dp"-->
<!-- android:left="157dp"-->
<!-- android:width="100dp"-->
<!-- android:height="100dp"-->
<!-- >-->
<!-- <bitmap-->
<!-- android:src="@mipmap/logo" />-->
<!-- </item>-->
<!-- <item-->
<!-- android:top="191dp"-->
<!-- android:left="157dp"-->
<!-- android:width="100dp"-->
<!-- android:height="100dp"-->
<!-- >-->
<!-- <bitmap-->
<!-- android:src="@mipmap/logo" />-->
<!-- </item>-->
<!-- <item-->
<!-- android:bottom="100dp"-->
<!-- android:width="100dp"-->
<!-- android:height="100dp"-->
<!-- android:gravity="bottom|center_horizontal"-->
<!-- >-->
<!-- <bitmap-->
<!-- android:src="@mipmap/logo" />-->
<!-- </item>-->
</layer-list>

View File

@ -1,12 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item>
<item>
<bitmap
android:width="120dp"
android:height="120dp"
android:gravity="top"
android:src="@mipmap/icon_img"
/>
</item>
</layer-list>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -32,7 +32,7 @@ class Call_outPage extends StatelessWidget {
resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
appBar: MyAppBar(
centerTitle: '世界喊话',
centerTitle: '圈内喊话',
actionWdiget: Image.asset(
getCircleImage('push'),
width: 54.sp,

View File

@ -136,7 +136,7 @@ class User {
String? nickname;
int? orientation;
int? role;
int? vip;
int vip = 0;
User(
{this.avatar,
@ -149,7 +149,7 @@ class User {
this.nickname,
this.orientation,
this.role,
this.vip});
this.vip=0});
User.fromJson(Map<String, dynamic> json) {
avatar = json['avatar'];

View File

@ -633,7 +633,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
SizedBox(
width: 8.sp,
),
lists.user!.vip! == 0
lists.user!.vip==null|| lists.user!.vip! == 0
? Container()
: Image.asset(
getCircleImage('vip'),
@ -661,8 +661,8 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
Color(0xffB5D3FF)
])),
child: Text(
getAgeCOntent(lists.user!.gender!, lists.user!.age!,
lists.user!.role!, lists.user!.orientation!),
getAgeCOntent(lists.user!.gender??0, lists.user!.age??0,
lists.user!.role??0, lists.user!.orientation??0),
// '${genderList[lists.user!.gender!]}.${lists.user!.age}.${roleList[lists.user!.role!]}.${orientationList[lists.user!.orientation!]}',
style: TextStyle(
color: Colors.black,
@ -928,7 +928,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
SizedBox(
width: 8.sp,
),
lists.user!.vip! == 0
lists.user!.vip==null|| lists.user!.vip! == 0
? Container()
: Image.asset(
getCircleImage('vip'),
@ -957,8 +957,8 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
Color(0xffB5D3FF)
])),
child: Text(
getAgeCOntent(lists.user!.gender!, lists.user!.age!,
lists.user!.role!, lists.user!.orientation!),
getAgeCOntent(lists.user!.gender??0, lists.user!.age??0,
lists.user!.role??0, lists.user!.orientation??0),
style: TextStyle(
color: Colors.black,
fontSize: 12.sp,

View File

@ -44,7 +44,7 @@ class HomeLogic extends GetxController {
var bean = BaseResponse<UpdateInfo>.fromJson(
data, (data) => UpdateInfo.fromJson(data));
if(bean.isSuccess()&&bean.data.update==1){
showReportDialog(Get.context!,bean.data.constraint==0,bean.data);
// showReportDialog(Get.context!,bean.data.constraint==0,bean.data);
}

View File

@ -121,6 +121,9 @@ class Complete_materialLogic extends GetxController {
if (state.textEditingController.text.isEmpty) {
showToast('请输入您的昵称');
return;
} else if(state.textEditingController.text.length<2){
showToast('昵称不能低于两个字');
return;
} else if(state.textEditingController.text.length>6){
showToast('昵称最多输入6个字');
return;

View File

@ -34,6 +34,12 @@ class LoginPage extends StatelessWidget {
width: Get.width,
height: Get.height,
),
Positioned(
left: 0,
right: 0,
top: 180.sp,
child: Image.asset(getBaseImage("ic_launcher"),width: 120.sp,height: 120.sp,)),
Container(
width: Get.width,
height: Get.height,

View File

@ -15,9 +15,11 @@ class SplashLogic extends GetxController {
@override
void onInit() async{
super.onInit();
// await Future.delayed(Duration(seconds: 30));
if((await getAuthorization()).isEmpty){
pushLoginPage();
}else{
var data =
await DioManager.instance.put(url: Api.refreshToken,params:{});
var bean = BaseResponse<LoginData>.fromJson(data, (data) => LoginData.fromJson(data));

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../../util/util.dart';
@ -14,15 +15,89 @@ class SplashPage extends StatelessWidget {
return Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(getBaseImage("home_back")),
image: AssetImage('assets/images/base/launch_image.webp'),
fit: BoxFit.cover,
),
),
child: Scaffold(
backgroundColor: Colors.transparent,
body: Container(),),
body: Stack(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Positioned(
top: 117.sp,
left: 37.sp,
child: Row(children: [
Center(
child: Image.asset(getBaseImage("ic_launcher"),width: 100.sp,height: 100.sp,),
),
Column(children: [
Center(
child: Image.asset(getLoginImage("icon_logo_name"),width: 203.sp,),
),
Center(
child: Text(
'小众圈子的快乐家园',
style: TextStyle(
color: const Color(0xCCFFFFFF),
fontSize: 20.sp,
// shadows: [
// Shadow(
// color: Color(0xFFC92BFF),
// offset: Offset(0, 1.2),
// blurRadius: 3.0,
// ),
// ],
),
),
),
],)
],)),
Positioned(
bottom: 74.sp,
left: 0,
right: 0,
child: Center(
child: Text(
'总有一个小众圈子适合你',
style: TextStyle(
fontSize: 24.sp,
color: Color(0xFF02FCFB), // Set the default text color
),
),
),
),
],),),
);
});
}
}
class GradientText extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ShaderMask(
shaderCallback: (Rect bounds) {
return LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Color(0xFF0AEBED), Color(0xFFE62CFF)],
).createShader(bounds);
},
child: Text(
'总有一个小众圈子适合你',
style: TextStyle(
fontSize: 24,
color: Color(0xFF02FCFB), // Set the default text color
),
),
);
}
}

View File

@ -17,8 +17,7 @@ class UserinfoPage extends StatefulWidget {
_MyTabbedScreenState createState() => _MyTabbedScreenState();
}
class _MyTabbedScreenState extends State<UserinfoPage>
with SingleTickerProviderStateMixin {
class _MyTabbedScreenState extends State<UserinfoPage> with SingleTickerProviderStateMixin {
late TabController _tabController;
late PageController _pageController;

View File

@ -13,13 +13,40 @@ class CacheUtil {
//
print(file.path);
});*/
print('临时目录大小: ' + value.toString());
return _renderSize(value);
var filePath = await getApplicationSupportDirectoryPath();
Directory directory = Directory(filePath); //
int totalSize = 0;
if (directory.existsSync()) {
await for (var entity in directory.list(recursive: true)) {
if (entity is File) {
totalSize += await entity.length();
}
}
}
if(totalSize<600000){
return _renderSize(value);
}
print('临时目录大小: ' + value.toString()+"\\\\"+totalSize.toString());
return _renderSize(value+totalSize);
} catch (err) {
print(err);
}
}
getDirectorySize(Directory directory) async {
int totalSize = 0;
if (directory.existsSync()) {
await for (var entity in directory.list(recursive: true)) {
if (entity is File) {
totalSize += await entity.length();
}
}
}
return totalSize;
}
///
static Future<Null> delDir(FileSystemEntity file) async {
try {
@ -79,7 +106,21 @@ class CacheUtil {
final _tempDir = await getTemporaryDirectory();
double value = await _getTotalSizeOfFilesInDir(_tempDir);
print("$value");
if (value.toInt() <= 0) {
var filePath = await getApplicationSupportDirectoryPath();
Directory directory = Directory(filePath); //
int totalSize = 0;
if (directory.existsSync()) {
await for (var entity in directory.list(recursive: true)) {
if (entity is File) {
totalSize += await entity.length();
}
}
}
if (value.toInt() <= 0&&totalSize<=0) {
showToast("暂无缓存");
// Get.back();
@ -87,9 +128,23 @@ class CacheUtil {
// Get.back();
//showToast("正在清理中···");
SmartDialog.showLoading(msg: "正在清理中···");
Future.delayed(Duration(seconds: 2), () async {
var filePath = await getApplicationSupportDirectoryPath();
Future.delayed(const Duration(seconds: 0), () async {
//
await delDir(_tempDir);
// File(filePath).delete();
if (await directory.exists()) {
await for (var entity in directory.list(recursive: false)) {
if (entity is File) {
await entity.delete();
}
}
}
await loadCache();
SmartDialog.dismiss();
showToast("清理缓存成功");

View File

@ -12,8 +12,8 @@ import 'package:fluwx/fluwx.dart' as fluwx;
//
void initWxApi() {
fluwx.registerWxApi(
appId: "wx6c6f4c89465dac4b",
universalLink: "dcc5bd5012a417eb585684700fbd1307",
appId: "wxab2387c2198f01e1",
universalLink: "https://www.leyuan666.com/",
);
}
@ -46,6 +46,7 @@ Future<void> openWxPay(PaymentData data, WxPayCallback callback) async {
showToast("微信支付成功");
callback(true, null);
} else {
print(event.errStr);
showToast(event.errStr ?? "微信支付失败");
callback(false, event.errStr);
}

View File

@ -0,0 +1,50 @@
import 'dart:math';
double calculateLineDistance(LatLng var0, LatLng var1) {
if (var0 != null && var1 != null) {
try {
double var2 = var0.longitude;
double var4 = var0.latitude;
double var6 = var1.longitude;
double var8 = var1.latitude;
var2 *= 0.01745329251994329;
var4 *= 0.01745329251994329;
var6 *= 0.01745329251994329;
var8 *= 0.01745329251994329;
double var10 = sin(var2);
double var12 = sin(var4);
double var14 = cos(var2);
double var16 = cos(var4);
double var18 = sin(var6);
double var20 = sin(var8);
double var22 = cos(var6);
double var24 = cos(var8);
List<double> var28 = [0, 0, 0];
List<double> var29 = [0, 0, 0];
var28[0] = var16 * var14;
var28[1] = var16 * var10;
var28[2] = var12;
var29[0] = var24 * var22;
var29[1] = var24 * var18;
var29[2] = var20;
return (asin(sqrt((var28[0] - var29[0]) * (var28[0] - var29[0]) + (var28[1] - var29[1]) * (var28[1] - var29[1]) + (var28[2] - var29[2]) * (var28[2] - var29[2])) / 2.0) * 1.27420015798544E7).toDouble();
} catch (e) {
print(e.toString());
return 0.0;
}
} else {
try {
throw Exception("非法坐标值");
} catch (e) {
print(e.toString());
return 0.0;
}
}
}
class LatLng {
double longitude;
double latitude;
LatLng(this.longitude, this.latitude);
}

View File

@ -67,7 +67,8 @@ void upDataImage(String quToken ,XFile pickedFile,String updataRoute,MyCallback
}
}
var path = await getApplicationSupportDirectoryPath();
if(isImageJpgOrPng(pickedFile.path)){
//if(isImageJpgOrPng(pickedFile.path)){
if(false){
CompressObject compressObject = CompressObject(
imageFile:File(pickedFile.path), //image
path:path, //compress to path