* opt: marquee

* fix: bangumi seek

* opt: post panel

* opt: remove deprecated code

* opt: singleton dynController

* fix: music scheme

* feat: MemberVideo jump keep position

* tweak
This commit is contained in:
My-Responsitories
2025-09-04 20:29:02 +08:00
committed by GitHub
parent e8a674ca2a
commit 172389b12b
51 changed files with 1314 additions and 1227 deletions

View File

@@ -4,7 +4,6 @@ import 'dart:math' show pi, max;
import 'package:PiliPlus/common/widgets/image/custom_grid_view.dart'
show ImageModel;
import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
import 'package:PiliPlus/common/widgets/radio_widget.dart';
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
import 'package:PiliPlus/grpc/reply.dart';
import 'package:PiliPlus/http/fav.dart';
@@ -25,7 +24,6 @@ import 'package:PiliPlus/pages/setting/widgets/slide_dialog.dart';
import 'package:PiliPlus/pages/video/reply/widgets/reply_item_grpc.dart';
import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/cache_manage.dart';
import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/feed_back.dart';
import 'package:PiliPlus/utils/image_util.dart';
import 'package:PiliPlus/utils/storage.dart';
@@ -799,7 +797,7 @@ List<SettingsModel> get extraSettings => [
final res = await FavHttp.allFavFolders(Accounts.main.mid);
if (res.isSuccess) {
final list = res.data.list;
if (list.isNullOrEmpty) {
if (list == null || list.isEmpty) {
return;
}
final quickFavId = Pref.quickFavId;
@@ -809,22 +807,22 @@ List<SettingsModel> get extraSettings => [
title: const Text('选择默认收藏夹'),
contentPadding: const EdgeInsets.only(top: 5, bottom: 18),
content: SingleChildScrollView(
child: Builder(
builder: (context) => Column(
children: List.generate(list!.length, (index) {
final item = list[index];
return RadioWidget(
padding: const EdgeInsets.only(left: 14),
title: item.title,
groupValue: quickFavId,
child: RadioGroup(
onChanged: (value) {
Get.back();
GStorage.setting.put(SettingBoxKey.quickFavId, value);
SmartDialog.showToast('设置成功');
},
groupValue: quickFavId,
child: Column(
children: list.map((item) {
return RadioListTile(
toggleable: true,
dense: true,
title: Text(item.title),
value: item.id,
onChanged: (value) {
Get.back();
GStorage.setting.put(SettingBoxKey.quickFavId, value);
SmartDialog.showToast('设置成功');
},
);
}),
}).toList(),
),
),
),

View File

@@ -577,7 +577,7 @@ List<SettingsModel> get styleSettings => [
leading: const Icon(Icons.color_lens_outlined),
title: '应用主题',
getSubtitle: () =>
'当前主题:${Get.put(ColorSelectController()).type.value == 0 ? '动态取色' : '指定颜色'}',
'当前主题:${Get.put(ColorSelectController()).dynamicColor.value ? '动态取色' : '指定颜色'}',
),
SettingsModel(
settingsType: SettingsType.normal,

View File

@@ -98,13 +98,13 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
),
Obx(
() => ListTile(
enabled: ctr.type.value != 0,
enabled: !ctr.dynamicColor.value,
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text('调色板风格'),
PopupMenuButton(
enabled: ctr.type.value != 0,
enabled: !ctr.dynamicColor.value,
initialValue: _dynamicSchemeVariant,
onSelected: (item) {
_dynamicSchemeVariant = item;
@@ -130,7 +130,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
style: TextStyle(
height: 1,
fontSize: 13,
color: ctr.type.value == 0
color: ctr.dynamicColor.value
? theme.colorScheme.outline.withValues(
alpha: 0.8,
)
@@ -141,7 +141,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
Icon(
size: 20,
Icons.keyboard_arrow_right,
color: ctr.type.value == 0
color: ctr.dynamicColor.value
? theme.colorScheme.outline.withValues(
alpha: 0.8,
)
@@ -164,27 +164,14 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
),
),
Obx(
() => RadioListTile(
value: 0,
() => CheckboxListTile(
title: const Text('动态取色'),
groupValue: ctr.type.value,
onChanged: (dynamic val) {
controlAffinity: ListTileControlAffinity.leading,
value: ctr.dynamicColor.value,
onChanged: (val) {
ctr
..type.value = 0
..setting.put(SettingBoxKey.dynamicColor, true);
Get.forceAppUpdate();
},
),
),
Obx(
() => RadioListTile(
value: 1,
title: const Text('指定颜色'),
groupValue: ctr.type.value,
onChanged: (dynamic val) {
ctr
..type.value = 1
..setting.put(SettingBoxKey.dynamicColor, false);
..dynamicColor.value = val!
..setting.put(SettingBoxKey.dynamicColor, val);
Get.forceAppUpdate();
},
),
@@ -196,78 +183,79 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
alignment: Alignment.topCenter,
duration: const Duration(milliseconds: 200),
child: Obx(
() => SizedBox(
height: ctr.type.value == 0 ? 0 : null,
child: Padding(
padding: const EdgeInsets.all(12),
child: Wrap(
alignment: WrapAlignment.center,
spacing: 22,
runSpacing: 18,
children: colorThemeTypes.indexed.map(
(e) {
final index = e.$1;
final item = e.$2;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
ctr
..currentColor.value = index
..setting.put(SettingBoxKey.customColor, index);
Get.forceAppUpdate();
() => ctr.dynamicColor.value
? const SizedBox.shrink(key: ValueKey(false))
: Padding(
key: const ValueKey(true),
padding: const EdgeInsets.all(12),
child: Wrap(
alignment: WrapAlignment.center,
spacing: 22,
runSpacing: 18,
children: colorThemeTypes.indexed.map(
(e) {
final index = e.$1;
final item = e.$2;
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
ctr
..currentColor.value = index
..setting.put(
SettingBoxKey.customColor,
index,
);
Get.forceAppUpdate();
},
child: Column(
spacing: 3,
children: [
ColorPalette(
color: item.color,
selected: ctr.currentColor.value == index,
),
Text(
item.label,
style: TextStyle(
fontSize: 12,
color: ctr.currentColor.value != index
? theme.colorScheme.outline
: null,
),
),
],
),
);
},
child: Column(
spacing: 3,
children: [
ColorPalette(
color: item.color,
selected: ctr.currentColor.value == index,
),
Text(
item.label,
style: TextStyle(
fontSize: 12,
color: ctr.currentColor.value != index
? theme.colorScheme.outline
: null,
),
),
],
),
);
},
).toList(),
),
),
),
).toList(),
),
),
),
),
),
...[
Padding(
padding: padding,
child: IgnorePointer(
child: Container(
height: size.height / 2,
width: size.width,
color: theme.colorScheme.surface,
child: const HomePage(),
),
Padding(
padding: padding,
child: IgnorePointer(
child: Container(
height: size.height / 2,
width: size.width,
color: theme.colorScheme.surface,
child: const HomePage(),
),
),
IgnorePointer(
child: NavigationBar(
destinations: NavigationBarType.values
.map(
(item) => NavigationDestination(
icon: item.icon,
label: item.label,
),
)
.toList(),
),
),
IgnorePointer(
child: NavigationBar(
destinations: NavigationBarType.values
.map(
(item) => NavigationDestination(
icon: item.icon,
label: item.label,
),
)
.toList(),
),
],
),
],
),
);
@@ -276,7 +264,6 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
class ColorSelectController extends GetxController {
final RxBool dynamicColor = Pref.dynamicColor.obs;
late final RxInt type = (dynamicColor.value ? 0 : 1).obs;
final RxInt currentColor = Pref.customColor.obs;
final RxDouble currentTextScale = Pref.defaultTextScale.obs;
final Rx<ThemeType> themeType = Pref.themeType.obs;

View File

@@ -75,28 +75,30 @@ class _SetDisplayModeState extends State<SetDisplayMode> {
),
),
Expanded(
child: ListView.builder(
itemCount: modes.length,
itemBuilder: (context, index) {
final DisplayMode mode = modes[index];
return RadioListTile<DisplayMode>(
value: mode,
title: mode == DisplayMode.auto
? const Text('自动')
: Text('$mode${mode == active ? ' [系统]' : ''}'),
groupValue: preferred,
onChanged: (DisplayMode? newMode) {
FlutterDisplayMode.setPreferredMode(
newMode!,
).whenComplete(
() => Future.delayed(
const Duration(milliseconds: 100),
fetchAll,
),
);
},
child: RadioGroup(
onChanged: (DisplayMode? newMode) {
FlutterDisplayMode.setPreferredMode(
newMode!,
).whenComplete(
() => Future.delayed(
const Duration(milliseconds: 100),
fetchAll,
),
);
},
groupValue: preferred,
child: ListView.builder(
itemCount: modes.length,
itemBuilder: (context, index) {
final DisplayMode mode = modes[index];
return RadioListTile<DisplayMode>(
value: mode,
title: mode == DisplayMode.auto
? const Text('自动')
: Text('$mode${mode == active ? ' [系统]' : ''}'),
);
},
),
),
),
],

View File

@@ -40,12 +40,12 @@ class _SlideColorPickerState extends State<SlideColorPicker> {
super.dispose();
}
String get _convert => Color.fromARGB(
255,
String get _convert => Color.fromRGBO(
_r,
_g,
_b,
).value.toRadixString(16).substring(2).toUpperCase();
1,
).toARGB32().toRadixString(16).substring(2).toUpperCase();
Widget _slider({
required String title,

View File

@@ -33,24 +33,26 @@ class SelectDialog<T> extends StatelessWidget {
title: Text(title),
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: List.generate(
values.length,
(index) {
final item = values[index];
return RadioListTile<T>(
dense: true,
value: item.$1,
title: Text(
item.$2,
style: titleMedium,
),
subtitle: subtitleBuilder?.call(context, index),
groupValue: value,
onChanged: Navigator.of(context).pop,
);
},
child: RadioGroup<T>(
onChanged: Navigator.of(context).pop,
groupValue: value,
child: Column(
mainAxisSize: MainAxisSize.min,
children: List.generate(
values.length,
(index) {
final item = values[index];
return RadioListTile<T>(
dense: true,
value: item.$1,
title: Text(
item.$2,
style: titleMedium,
),
subtitle: subtitleBuilder?.call(context, index),
);
},
),
),
),
),