mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: color alpha
`withOpacity` -> `withValues` Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -171,13 +171,13 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
|
||||
width: 46,
|
||||
height: 46,
|
||||
decoration: BoxDecoration(
|
||||
color: e['color'].withOpacity(0.8),
|
||||
color: e['color'].withValues(alpha: 0.8),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: ctr.currentColor.value == index
|
||||
? Colors.black
|
||||
: e['color'].withOpacity(0.8),
|
||||
: e['color'].withValues(alpha: 0.8),
|
||||
),
|
||||
),
|
||||
child: AnimatedOpacity(
|
||||
|
||||
@@ -72,7 +72,7 @@ class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withOpacity(0.3))),
|
||||
.withValues(alpha: 0.3))),
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
),
|
||||
child: Row(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:PiliPalaX/utils/extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -208,6 +209,7 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
style: subTitleStyle,
|
||||
),
|
||||
onTap: () async {
|
||||
const List<int> defDurations = [0, 30, 60, 90, 120];
|
||||
int? result = await showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
@@ -216,18 +218,8 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
value: minDurationForRcmd,
|
||||
values: [
|
||||
...[
|
||||
0,
|
||||
30,
|
||||
60,
|
||||
90,
|
||||
120,
|
||||
if (![
|
||||
0,
|
||||
30,
|
||||
60,
|
||||
90,
|
||||
120,
|
||||
].contains(minDurationForRcmd))
|
||||
...defDurations,
|
||||
if (defDurations.contains(minDurationForRcmd).not)
|
||||
minDurationForRcmd,
|
||||
]..sort(),
|
||||
-1
|
||||
@@ -240,21 +232,26 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
},
|
||||
);
|
||||
if (result != null) {
|
||||
void updateDuration(int value) {
|
||||
minDurationForRcmd = value;
|
||||
setting.put(SettingBoxKey.minDurationForRcmd, value);
|
||||
RecommendFilter.update();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
if (result == -1 && context.mounted) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
String initialValue =
|
||||
result == -1 ? '' : minDurationForRcmd.toString();
|
||||
String duration = '';
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'自定义时长',
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
content: TextFormField(
|
||||
content: TextField(
|
||||
autofocus: true,
|
||||
initialValue: initialValue,
|
||||
onChanged: (value) => initialValue = value,
|
||||
onChanged: (value) => duration = value,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r'\d+')),
|
||||
@@ -273,26 +270,16 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
int result = int.tryParse(initialValue) ?? 0;
|
||||
minDurationForRcmd = result;
|
||||
setting.put(
|
||||
SettingBoxKey.minDurationForRcmd, result);
|
||||
RecommendFilter.update();
|
||||
setState(() {});
|
||||
updateDuration(int.tryParse(duration) ?? 0);
|
||||
},
|
||||
child: Text(
|
||||
'确定',
|
||||
),
|
||||
child: const Text('确定'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
minDurationForRcmd = result;
|
||||
setting.put(SettingBoxKey.minDurationForRcmd, result);
|
||||
RecommendFilter.update();
|
||||
setState(() {});
|
||||
updateDuration(result);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -351,8 +338,10 @@ class _RecommendSettingState extends State<RecommendSetting> {
|
||||
'* 设定较严苛的条件可导致推荐项数锐减或多次请求,请酌情选择。\n'
|
||||
'* 后续可能会增加更多过滤条件,敬请期待。',
|
||||
style: Theme.of(context).textTheme.labelSmall!.copyWith(
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline.withOpacity(0.7)),
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.outline
|
||||
.withValues(alpha: 0.7)),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -362,14 +362,14 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
||||
Widget get _divider => SliverToBoxAdapter(
|
||||
child: Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.1),
|
||||
color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.1),
|
||||
),
|
||||
);
|
||||
|
||||
Widget get _dividerL => SliverToBoxAdapter(
|
||||
child: Divider(
|
||||
thickness: 16,
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.1),
|
||||
color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.1),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -529,7 +529,8 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
|
||||
),
|
||||
separatorBuilder: (context, index) => Divider(
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.outline.withOpacity(0.1),
|
||||
color:
|
||||
Theme.of(context).colorScheme.outline.withValues(alpha: 0.1),
|
||||
),
|
||||
),
|
||||
_dividerL,
|
||||
|
||||
Reference in New Issue
Block a user