Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-05-21 11:48:42 +08:00
parent 1efd62803a
commit ac60ac417b
130 changed files with 1631 additions and 2132 deletions

View File

@@ -358,6 +358,54 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
),
);
void onSelectColor(int index) {
showDialog(
context: context,
builder: (context) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 16),
title: Text.rich(
TextSpan(
children: [
const TextSpan(
text: 'Color Picker ',
style: TextStyle(fontSize: 15),
),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
style: const TextStyle(fontSize: 13, height: 1),
),
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: const TextStyle(fontSize: 13, height: 1),
),
],
),
),
content: SlideColorPicker(
color: _blockColor[index],
callback: (Color? color) {
_blockColor[index] = color ?? _blockSettings[index].first.color;
setting.put(
SettingBoxKey.blockColor,
_blockColor
.map((item) => item.value.toRadixString(16).substring(2))
.toList());
setState(() {});
},
),
),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
@@ -402,55 +450,7 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
itemBuilder: (context, index) => ListTile(
dense: true,
enabled: _blockSettings[index].second != SkipType.disable,
onTap: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 16),
title: Text.rich(
TextSpan(
children: [
const TextSpan(
text: 'Color Picker ',
style: TextStyle(fontSize: 15),
),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
style: const TextStyle(fontSize: 13, height: 1),
),
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: const TextStyle(fontSize: 13, height: 1),
),
],
),
),
content: SlideColorPicker(
color: _blockColor[index],
callback: (Color? color) {
_blockColor[index] =
color ?? _blockSettings[index].first.color;
setting.put(
SettingBoxKey.blockColor,
_blockColor
.map((item) =>
item.value.toRadixString(16).substring(2))
.toList());
setState(() {});
},
),
),
);
},
onTap: () => onSelectColor(index),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [