mod: lint

mod: tweaks

opt: publish page

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-04 11:37:13 +08:00
parent 2cfad80214
commit caa58e9d7d
313 changed files with 2751 additions and 2789 deletions

View File

@@ -9,7 +9,7 @@ class ExtraSetting extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: showAppBar == false ? null : AppBar(title: Text('其它设置')),
appBar: showAppBar == false ? null : AppBar(title: const Text('其它设置')),
body: ListView(
children: [
...extraSettings.map((item) => item.widget),

View File

@@ -121,7 +121,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
? theme.colorScheme.outline.withOpacity(0.8)
: theme.colorScheme.secondary,
),
strutStyle: StrutStyle(leading: 0, height: 1),
strutStyle: const StrutStyle(leading: 0, height: 1),
),
Icon(
size: 20,
@@ -138,11 +138,11 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
leading: Container(
width: 40,
alignment: Alignment.center,
child: Icon(Icons.palette_outlined),
child: const Icon(Icons.palette_outlined),
),
subtitle: Text(
_dynamicSchemeVariant.description,
style: TextStyle(fontSize: 12),
style: const TextStyle(fontSize: 12),
),
),
),
@@ -202,7 +202,8 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
height: 46,
decoration: BoxDecoration(
color: e['color'].withOpacity(0.8),
borderRadius: BorderRadius.circular(50),
borderRadius: const BorderRadius.all(
Radius.circular(50)),
border: Border.all(
width: 2,
color: ctr.currentColor.value == index

View File

@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
@@ -39,8 +38,9 @@ class _SetDisplayModeState extends State<SetDisplayMode> {
@override
void dispose() {
controller.removeListener(listener);
controller.dispose();
controller
..removeListener(listener)
..dispose();
super.dispose();
}

View File

@@ -27,10 +27,11 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
setting.get(SettingBoxKey.defaultTextScale, defaultValue: 1.0);
}
setFontSize() {
void setFontSize() {
setting.put(SettingBoxKey.defaultTextScale, currentSize);
Get.back(result: currentSize);
Get.forceAppUpdate();
Get
..back(result: currentSize)
..forceAppUpdate();
}
@override
@@ -62,7 +63,7 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
),
Container(
width: double.infinity,
padding: EdgeInsets.all(20),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
border: Border(
top: BorderSide(

View File

@@ -27,14 +27,14 @@ class _LogsPageState extends State<LogsPage> {
@override
void dispose() {
if (latestLog != null) {
if (DateTime.now().difference(latestLog!) >= Duration(days: 14)) {
if (DateTime.now().difference(latestLog!) >= const Duration(days: 14)) {
clearLogs();
}
}
super.dispose();
}
void getPath() async {
Future<void> getPath() async {
logsPath = await getLogsPath();
fileContent = await logsPath.readAsString();
logsContent = await parseLogs(fileContent);
@@ -82,7 +82,7 @@ class _LogsPageState extends State<LogsPage> {
return result.reversed.toList();
}
void copyLogs() async {
Future<void> copyLogs() async {
await Utils.copyText('```\n$fileContent\n```', needToast: false);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
@@ -91,7 +91,7 @@ class _LogsPageState extends State<LogsPage> {
}
}
void clearLogsHandle() async {
Future<void> clearLogsHandle() async {
if (await clearLogs()) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
@@ -174,8 +174,7 @@ class _LogsPageState extends State<LogsPage> {
TextButton.icon(
style: TextButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
visualDensity:
VisualDensity(horizontal: -2, vertical: -2),
visualDensity: VisualDensity.compact,
),
onPressed: () async {
await Utils.copyText('```\n${log['body']}\n```',

View File

@@ -85,11 +85,12 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
const SizedBox(height: 12),
TextField(
autofocus: true,
keyboardType: TextInputType.numberWithOptions(decimal: true),
decoration: InputDecoration(
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
decoration: const InputDecoration(
labelText: '自定义倍速',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6.0),
borderRadius: BorderRadius.all(Radius.circular(6)),
),
),
onChanged: (value) {
@@ -114,8 +115,9 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
SmartDialog.showToast('该倍速已存在');
} else {
Get.back();
speedList.add(customSpeed!);
speedList.sort();
speedList
..add(customSpeed!)
..sort();
await video.put(VideoBoxKey.speedsList, speedList);
setState(() {});
}
@@ -166,7 +168,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
}
//
void menuAction(index, id) async {
Future<void> menuAction(index, id) async {
double speed = speedList[index];
// 设置
if (id == 1) {
@@ -205,7 +207,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
speedList = GStorage.speedList;
setState(() {});
},
child: Text('重置'),
child: const Text('重置'),
),
const SizedBox(width: 16),
],

View File

@@ -89,10 +89,10 @@ class _SlideColorPickerState extends State<SlideColorPicker> {
FilteringTextInputFormatter.allow(RegExp('[0-9a-fA-F]')),
],
controller: _textController,
decoration: InputDecoration(
decoration: const InputDecoration(
isDense: true,
prefixText: '#',
contentPadding: const EdgeInsets.all(0),
contentPadding: EdgeInsets.zero,
),
onChanged: (value) {
_textController.text = value.toUpperCase();
@@ -147,9 +147,7 @@ class _SlideColorPickerState extends State<SlideColorPicker> {
Get.back();
widget.callback(null);
},
child: Text(
'重置',
),
child: const Text('重置'),
),
],
const Spacer(),

View File

@@ -9,7 +9,7 @@ class StyleSetting extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: showAppBar == false ? null : AppBar(title: Text('外观设置')),
appBar: showAppBar == false ? null : AppBar(title: const Text('外观设置')),
body: ListView(
children: [
...styleSettings.map((item) => item.widget),

View File

@@ -16,7 +16,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'widgets/multi_select_dialog.dart';
import 'package:PiliPlus/pages/setting/widgets/multi_select_dialog.dart';
class _SettingsModel {
final String name;
@@ -45,37 +45,37 @@ class _SettingPageState extends State<SettingPage> {
bool get _isPortrait => context.orientation == Orientation.portrait;
final List<_SettingsModel> _items = [
_SettingsModel(
const _SettingsModel(
name: 'privacySetting',
title: '隐私设置',
subtitle: '黑名单、无痕模式',
icon: Icons.privacy_tip_outlined,
),
_SettingsModel(
const _SettingsModel(
name: 'recommendSetting',
title: '推荐流设置',
subtitle: '推荐来源web/app、刷新保留内容、过滤器',
icon: Icons.explore_outlined,
),
_SettingsModel(
const _SettingsModel(
name: 'videoSetting',
title: '音视频设置',
subtitle: '画质、音质、解码、缓冲、音频输出等',
icon: Icons.video_settings_outlined,
),
_SettingsModel(
const _SettingsModel(
name: 'playSetting',
title: '播放器设置',
subtitle: '双击/长按、全屏、后台播放、弹幕、字幕、底部进度条等',
icon: Icons.touch_app_outlined,
),
_SettingsModel(
const _SettingsModel(
name: 'styleSetting',
title: '外观设置',
subtitle: '横屏适配(平板)、侧栏、列宽、首页、动态红点、主题、字号、图片、帧率等',
icon: Icons.style_outlined,
),
_SettingsModel(
const _SettingsModel(
name: 'extraSetting',
title: '其它设置',
subtitle: '震动、搜索、收藏、ai、评论、动态、代理、更新检查等',
@@ -86,7 +86,7 @@ class _SettingPageState extends State<SettingPage> {
title: 'WebDAV 设置',
icon: MdiIcons.databaseCogOutline,
),
_SettingsModel(
const _SettingsModel(
name: 'about',
title: '关于',
icon: Icons.info_outline,
@@ -137,14 +137,17 @@ class _SettingPageState extends State<SettingPage> {
removeLeft: true,
removeTop: true,
child: switch (_type) {
'privacySetting' => PrivacySetting(showAppBar: false),
'recommendSetting' => RecommendSetting(showAppBar: false),
'videoSetting' => VideoSetting(showAppBar: false),
'playSetting' => PlaySetting(showAppBar: false),
'styleSetting' => StyleSetting(showAppBar: false),
'extraSetting' => ExtraSetting(showAppBar: false),
'webdavSetting' => WebDavSettingPage(showAppBar: false),
'about' => AboutPage(showAppBar: false),
'privacySetting' =>
const PrivacySetting(showAppBar: false),
'recommendSetting' =>
const RecommendSetting(showAppBar: false),
'videoSetting' => const VideoSetting(showAppBar: false),
'playSetting' => const PlaySetting(showAppBar: false),
'styleSetting' => const StyleSetting(showAppBar: false),
'extraSetting' => const ExtraSetting(showAppBar: false),
'webdavSetting' =>
const WebDavSettingPage(showAppBar: false),
'about' => const AboutPage(showAppBar: false),
_ => const SizedBox.shrink(),
},
),
@@ -220,7 +223,7 @@ class _SettingPageState extends State<SettingPage> {
builder: (context) {
return MultiSelectDialog<LoginAccount>(
title: '选择要登出的账号uid',
initValues: Iterable.empty(),
initValues: const Iterable.empty(),
values: {for (var i in Accounts.account.values) i: i.mid.toString()},
);
},
@@ -287,11 +290,11 @@ class _SettingPageState extends State<SettingPage> {
),
child: InkWell(
onTap: () => Get.toNamed('/settingsSearch'),
borderRadius: BorderRadius.circular(50),
borderRadius: const BorderRadius.all(Radius.circular(50)),
child: Ink(
padding: const EdgeInsets.symmetric(vertical: 6),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
borderRadius: const BorderRadius.all(Radius.circular(50)),
color: theme.colorScheme.onInverseSurface,
),
child: Center(

View File

@@ -31,6 +31,7 @@ import 'package:PiliPlus/pages/setting/widgets/normal_item.dart';
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
import 'package:PiliPlus/pages/setting/widgets/slide_dialog.dart';
import 'package:PiliPlus/pages/setting/widgets/switch_item.dart';
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
import 'package:PiliPlus/plugin/pl_player/models/bottom_progress_behavior.dart';
import 'package:PiliPlus/plugin/pl_player/models/fullscreen_mode.dart';
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
@@ -332,9 +333,8 @@ List<SettingsModel> get styleSettings => [
},
);
if (result != null) {
MainController mainController = Get.put(MainController());
mainController.dynamicBadgeMode =
DynamicBadgeMode.values[result.index];
MainController mainController = Get.put(MainController())
..dynamicBadgeMode = DynamicBadgeMode.values[result.index];
if (mainController.dynamicBadgeMode != DynamicBadgeMode.hidden) {
mainController.getUnreadDynamic();
}
@@ -364,8 +364,8 @@ List<SettingsModel> get styleSettings => [
},
);
if (result != null) {
MainController mainController = Get.put(MainController());
mainController.msgBadgeMode = DynamicBadgeMode.values[result.index];
MainController mainController = Get.put(MainController())
..msgBadgeMode = DynamicBadgeMode.values[result.index];
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
mainController.queryUnreadMsg();
} else {
@@ -395,8 +395,8 @@ List<SettingsModel> get styleSettings => [
},
);
if (result != null) {
MainController mainController = Get.put(MainController());
mainController.msgUnReadTypes = result;
MainController mainController = Get.put(MainController())
..msgUnReadTypes = result;
if (mainController.msgBadgeMode != DynamicBadgeMode.hidden) {
mainController.queryUnreadMsg();
}
@@ -624,7 +624,7 @@ List<SettingsModel> get styleSettings => [
autofocus: index == 0,
initialValue: springDescription[index],
keyboardType:
TextInputType.numberWithOptions(decimal: true),
const TextInputType.numberWithOptions(decimal: true),
onChanged: (value) {
springDescription[index] = value;
},
@@ -929,7 +929,7 @@ List<SettingsModel> get playSettings => [
title: '默认全屏方向',
leading: const Icon(Icons.open_with_outlined),
getSubtitle: () =>
'当前全屏方向:${FullScreenModeCode.fromCode(GStorage.defaultFullScreenMode)!.description}',
'当前全屏方向:${FullScreenModeCode.fromCode(GStorage.defaultFullScreenMode).description}',
onTap: (setState) async {
int? result = await showDialog(
context: Get.context!,
@@ -953,7 +953,7 @@ List<SettingsModel> get playSettings => [
title: '底部进度条展示',
leading: const Icon(Icons.border_bottom_outlined),
getSubtitle: () =>
'当前展示方式:${BtmProgresBehaviorCode.fromCode(GStorage.defaultBtmProgressBehavior)!.description}',
'当前展示方式:${BtmProgresBehaviorCode.fromCode(GStorage.defaultBtmProgressBehavior).description}',
onTap: (setState) async {
int? result = await showDialog(
context: Get.context!,
@@ -1031,7 +1031,7 @@ List<SettingsModel> get videoSettings => [
String? result = await showDialog(
context: Get.context!,
builder: (context) {
return CdnSelectDialog();
return const CdnSelectDialog();
},
);
if (result != null) {
@@ -1377,8 +1377,8 @@ List<SettingsModel> get recommendSettings => [
defaultVal: true,
onChanged: (value) {
try {
RcmdController ctr = Get.find<RcmdController>();
ctr.savedRcmdTip = value;
RcmdController ctr = Get.find<RcmdController>()
..savedRcmdTip = value;
if (value.not) {
ctr.lastRefreshAt = null;
}
@@ -1537,14 +1537,14 @@ List<SettingsModel> get extraSettings => [
content: TextFormField(
autofocus: true,
initialValue: dynamicPeriod.toString(),
keyboardType: TextInputType.numberWithOptions(),
keyboardType: TextInputType.number,
onChanged: (value) {
dynamicPeriod = int.tryParse(value) ?? 5;
},
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'\d+')),
],
decoration: InputDecoration(suffixText: 'min'),
decoration: const InputDecoration(suffixText: 'min'),
),
actions: [
TextButton(
@@ -1650,14 +1650,14 @@ List<SettingsModel> get extraSettings => [
content: TextFormField(
autofocus: true,
initialValue: replyLengthLimit,
keyboardType: TextInputType.numberWithOptions(),
keyboardType: TextInputType.number,
onChanged: (value) {
replyLengthLimit = value;
},
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'\d+')),
],
decoration: InputDecoration(suffixText: ''),
decoration: const InputDecoration(suffixText: ''),
),
actions: [
TextButton(
@@ -1708,7 +1708,8 @@ List<SettingsModel> get extraSettings => [
content: TextFormField(
autofocus: true,
initialValue: danmakuLineHeight,
keyboardType: TextInputType.numberWithOptions(decimal: true),
keyboardType:
const TextInputType.numberWithOptions(decimal: true),
onChanged: (value) {
danmakuLineHeight = value;
},
@@ -2078,7 +2079,7 @@ List<SettingsModel> get extraSettings => [
settingsType: SettingsType.sw1tch,
title: '使用「哔哩发评反诈」检查评论',
subtitle: '仅对Android生效',
leading: Icon(
leading: const Icon(
FontAwesomeIcons.b,
size: 22,
),
@@ -2185,6 +2186,7 @@ List<SettingsModel> get extraSettings => [
enableFeedback: true,
setKey: SettingBoxKey.feedBackEnable,
onChanged: (value) {
enableFeedback = value;
feedBack();
},
leading: const Icon(Icons.vibration_outlined),
@@ -2233,6 +2235,9 @@ List<SettingsModel> get extraSettings => [
leading: const Icon(Icons.search_outlined),
setKey: SettingBoxKey.enableWordRe,
defaultVal: false,
onChanged: (value) {
ReplyItemGrpc.enableWordRe = value;
},
),
SettingsModel(
settingsType: SettingsType.sw1tch,
@@ -2418,8 +2423,8 @@ List<SettingsModel> get extraSettings => [
labelText: systemProxyHost != ''
? systemProxyHost
: '请输入Host使用 . 分割',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6.0),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
hintText: systemProxyHost,
),
@@ -2434,8 +2439,8 @@ List<SettingsModel> get extraSettings => [
isDense: true,
labelText:
systemProxyPort != '' ? systemProxyPort : '请输入Port',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(6.0),
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
hintText: systemProxyPort,
),
@@ -2503,7 +2508,7 @@ List<SettingsModel> get extraSettings => [
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r'[\d\.]+')),
],
decoration: InputDecoration(suffixText: 'MB'),
decoration: const InputDecoration(suffixText: 'MB'),
),
actions: [
TextButton(

View File

@@ -57,7 +57,7 @@ class _MultiSelectDialogState<T> extends State<MultiSelectDialog<T>> {
),
);
}),
actionsPadding: EdgeInsets.only(left: 16, right: 16, bottom: 12),
actionsPadding: const EdgeInsets.only(left: 16, right: 16, bottom: 12),
actions: [
TextButton(
onPressed: Get.back,

View File

@@ -59,7 +59,7 @@ class _SetSwitchItemState extends State<SetSwitchItem> {
setVal();
}
void switchChange(ThemeData theme, value) async {
Future<void> switchChange(ThemeData theme, value) async {
if (widget.setKey == SettingBoxKey.badCertificateCallback &&
(value ?? !val)) {
showDialog(