删除打包后带入的本地目录和切换图标功能

This commit is contained in:
谢宇宁
2026-11-09 20:29:13 +07:00
parent b29916a6bb
commit f39c8eef17
45 changed files with 116 additions and 445 deletions
-2
View File
@@ -20,6 +20,4 @@ extension ImageLoad on String {
String get mineImgPath => 'assets/images/mine/$this';
//启动页
String get launchPath => 'assets/images/launch/$this';
//app icon
String get appImgPath => 'assets/images/app_icon/$this';
}
-36
View File
@@ -1,8 +1,6 @@
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:hgdj/assets_tool/images.dart';
import 'package:hgdj/hj_page/pre_sale/pre_sale_provider.dart';
import 'package:hgdj/hj_utils/api_service/vid_service.dart';
import 'package:hgdj/hj_utils/light_model.dart';
@@ -11,10 +9,8 @@ import 'package:hgdj/tools_base/global_store/store.dart';
import 'package:hgdj/tools_base/loading/loading_helper.dart';
import 'package:hgdj/tools_base/toast.dart';
import 'package:hgdj/tools_base/widget/common_alert.dart';
import 'package:hgdj/track_event_manager/device_service.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../../config/config.dart';
import '../../hj_model/user/user_info_model.dart';
import '../main_page/provider/msg_provider.dart';
import '../web_page/h5_page.dart';
@@ -30,14 +26,6 @@ import 'mine_share/mine_share_page.dart';
import 'more_question/mine_feedback_page.dart';
import 'welfare/welfare_home_page.dart';
//图标
class IconBean {
String image;
String name;
IconBean(this.image, this.name);
}
class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
RefreshController? refreshCtr;
@@ -54,25 +42,6 @@ class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
"我的消息",
];
List<IconBean> iconList = [
IconBean('ic_launcher.webp'.commonImgPath, Config.appName),
IconBean('icon_1.webp'.appImgPath, "爱音乐"),
IconBean('icon_2.webp'.appImgPath, "爱阅读"),
IconBean('icon_3.webp'.appImgPath, "支付宝"),
IconBean('icon_4.webp'.appImgPath, "哔哩哔哩"),
IconBean('icon_5.webp'.appImgPath, "饼干大作战"),
IconBean('icon_6.webp'.appImgPath, "美食借鉴"),
IconBean('icon_7.webp'.appImgPath, "我的世界"),
IconBean('icon_8.webp'.appImgPath, "神选之战"),
IconBean('icon_9.webp'.appImgPath, "随心无线"),
IconBean('icon_10.webp'.appImgPath, "特轩小说"),
IconBean('icon_11.webp'.appImgPath, "天天麻将"),
IconBean('icon_12.webp'.appImgPath, "途游"),
IconBean('icon_13.webp'.appImgPath, "微信"),
IconBean('icon_14.webp'.appImgPath, "问道"),
IconBean('icon_15.webp'.appImgPath, "英语图书角"),
];
@override
void onReady() async {
super.onReady();
@@ -198,9 +167,4 @@ class MineMainLogic extends GetxController with GetTickerProviderStateMixin {
popGesture: true);
}
changeIcon(int index) async {
if (!await CommonAlert.show(content: '您确定要更换图标吗?')) return;
const platform = MethodChannel(DeviceInfoService.requestChannel);
platform.invokeMethod('changeIcon', {"iconIndex": index});
}
}
-61
View File
@@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -167,66 +166,6 @@ class HomeMinePage extends StatelessWidget {
);
},
),
// iOS 换图标需弹系统弹窗且要预置图标资源,暂不支持,仅 Android 显示该入口
if (!Platform.isIOS) ...[
Padding(
padding: EdgeInsets.only(left: 12, top: 10, right: 12),
child: Row(
children: [
Text(
'设置桌面图标',
style: TextStyle(
color: Color(0xffEFEFEF),
fontSize: 14,
fontWeight: FontWeight.w500),
),
Spacer(),
InkWell(
enableFeedback: false,
onTap: () => logic.changeIcon(0),
child: Text(
'恢复默认',
style: TextStyle(
color: Color(0xff989898),
fontSize: 12,
fontWeight: FontWeight.w400),
),
),
],
),
),
11.sizeBoxH,
SizedBox(
height: 76,
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
separatorBuilder: (_, __) => 7.sizeBoxW,
itemCount: logic.iconList.length,
itemBuilder: (BuildContext context, int index) {
final data = logic.iconList[index];
return InkWell(
enableFeedback: false,
onTap: () => logic.changeIcon(index),
child: Column(
children: [
Image.asset(data.image, width: 54),
4.sizeBoxH,
Text(
data.name,
style: TextStyle(
color: Colors.white.withValues(alpha: 0.9),
fontSize: 12,
),
)
],
),
);
},
),
),
10.sizeBoxH,
],
],
),
),
@@ -82,8 +82,6 @@ class DeviceInfoService {
/// note_this:不要修改这个值
static const iosBundleId = "yinse_opera";
static const naticeChannel = 'com.yinse/device'; //原生通道(设备/视频/编解码信息)
static const requestChannel =
'com.yinse/request'; //原生系统桥(现只剩换启动图标 changeIcon)
/// 外部调用入口
static Future<void> init() async {