opt: pages

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-04 10:44:21 +08:00
parent 14f2c34d21
commit 9cf74c0db6
5 changed files with 288 additions and 248 deletions

View File

@@ -332,52 +332,64 @@ class _CreatePanelState extends State<CreatePanel> {
appBar: PreferredSize(
preferredSize: Size.fromHeight(66),
child: Padding(
padding: const EdgeInsets.only(top: 16, bottom: 16),
child: Row(
padding: const EdgeInsets.all(16),
child: Stack(
children: [
const SizedBox(width: 16),
SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: '返回',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor: WidgetStateProperty.resolveWith(
(states) {
return Theme.of(context).colorScheme.secondaryContainer;
},
Positioned(
top: 0,
left: 0,
bottom: 0,
child: SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: '返回',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor: WidgetStateProperty.resolveWith(
(states) {
return Theme.of(context)
.colorScheme
.secondaryContainer;
},
),
),
onPressed: Get.back,
icon: Icon(
Icons.arrow_back_outlined,
size: 18,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
),
onPressed: Get.back,
icon: Icon(
Icons.arrow_back_outlined,
size: 18,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
),
),
const Spacer(),
const Text(
'发布动态',
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
const Spacer(),
Obx(
() => FilledButton.tonal(
onPressed: _isEnablePub.value ? _onCreate : null,
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
child: Text(_publishTime == null ? '发布' : '定时发布'),
Center(
child: const Text(
'发布动态',
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
),
Positioned(
top: 0,
right: 0,
child: Obx(
() => FilledButton.tonal(
onPressed: _isEnablePub.value ? _onCreate : null,
style: FilledButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
child: Text(_publishTime == null ? '发布' : '定时发布'),
),
),
),
const SizedBox(width: 16),
],
),
),
@@ -520,78 +532,6 @@ class _CreatePanelState extends State<CreatePanel> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PopupMenuButton(
enabled: _publishTime == null,
initialValue: _isPrivate,
onSelected: (value) {
setState(() {
_isPrivate = value;
});
},
itemBuilder: (context) => List.generate(
2,
(index) => PopupMenuItem<bool>(
value: index == 0 ? false : true,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
size: 19,
index == 0
? Icons.visibility
: Icons.visibility_off,
),
const SizedBox(width: 4),
Text(index == 0 ? '所有人可见' : '仅自己可见'),
],
),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
size: 19,
_isPrivate
? Icons.visibility_off
: Icons.visibility,
color: _publishTime == null
? _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
),
const SizedBox(width: 4),
Text(
_isPrivate ? '仅自己可见' : '所有人可见',
style: TextStyle(
height: 1,
color: _publishTime == null
? _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context)
.colorScheme
.primary
: Theme.of(context).colorScheme.outline,
),
strutStyle: StrutStyle(leading: 0, height: 1),
),
Icon(
size: 20,
Icons.keyboard_arrow_right,
color: _publishTime == null
? _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
),
],
),
),
),
const SizedBox(height: 5),
PopupMenuButton(
initialValue: _replyOption,
onSelected: (item) {
@@ -627,7 +567,7 @@ class _CreatePanelState extends State<CreatePanel> {
_replyOption.iconData,
color: _replyOption == ReplyOption.close
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
: Theme.of(context).colorScheme.secondary,
),
const SizedBox(width: 4),
Text(
@@ -636,7 +576,7 @@ class _CreatePanelState extends State<CreatePanel> {
height: 1,
color: _replyOption == ReplyOption.close
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
: Theme.of(context).colorScheme.secondary,
),
strutStyle: StrutStyle(leading: 0, height: 1),
),
@@ -645,7 +585,73 @@ class _CreatePanelState extends State<CreatePanel> {
Icons.keyboard_arrow_right,
color: _replyOption == ReplyOption.close
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
: Theme.of(context).colorScheme.secondary,
),
],
),
),
),
const SizedBox(height: 5),
PopupMenuButton(
initialValue: _isPrivate,
onSelected: (value) {
setState(() {
_isPrivate = value;
});
},
itemBuilder: (context) => List.generate(
2,
(index) => PopupMenuItem<bool>(
enabled: _publishTime != null && index == 1
? false
: true,
value: index == 0 ? false : true,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
size: 19,
index == 0
? Icons.visibility
: Icons.visibility_off,
),
const SizedBox(width: 4),
Text(index == 0 ? '所有人可见' : '仅自己可见'),
],
),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
size: 19,
_isPrivate
? Icons.visibility_off
: Icons.visibility,
color: _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.secondary,
),
const SizedBox(width: 4),
Text(
_isPrivate ? '仅自己可见' : '所有人可见',
style: TextStyle(
height: 1,
color: _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.secondary,
),
strutStyle: StrutStyle(leading: 0, height: 1),
),
Icon(
size: 20,
Icons.keyboard_arrow_right,
color: _isPrivate
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.secondary,
),
],
),

View File

@@ -286,49 +286,66 @@ class _RepostPanelState extends State<RepostPanel> {
],
),
if (_isMax)
Row(
children: [
const SizedBox(width: 16),
SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: '返回',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor:
WidgetStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.secondaryContainer;
}),
),
onPressed: Get.back,
icon: Icon(
Icons.arrow_back_outlined,
size: 18,
color: Theme.of(context).colorScheme.onSecondaryContainer,
SizedBox(
height: 34,
child: Stack(
children: [
Positioned(
left: 16,
top: 0,
child: SizedBox(
width: 34,
height: 34,
child: IconButton(
tooltip: '返回',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor:
WidgetStateProperty.resolveWith((states) {
return Theme.of(context)
.colorScheme
.secondaryContainer;
}),
),
onPressed: Get.back,
icon: Icon(
Icons.arrow_back_outlined,
size: 18,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
),
),
),
),
),
const Spacer(),
const Text(
'转发动态',
style: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
const Spacer(),
FilledButton.tonal(
onPressed: _onRepost,
style: FilledButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
Center(
child: const Text(
'转发动态',
style:
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
),
),
child: const Text('转发'),
),
const SizedBox(width: 16),
],
Positioned(
right: 16,
top: 0,
child: FilledButton.tonal(
onPressed: _onRepost,
style: FilledButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
padding: const EdgeInsets.symmetric(
horizontal: 20,
vertical: 10,
),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -2,
),
),
child: const Text('转发'),
),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),

View File

@@ -451,32 +451,89 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
),
);
},
title: Text.rich(
TextSpan(
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: MediaQuery.textScalerOf(context).scale(15),
width: 10,
alignment: Alignment.center,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
),
style: TextStyle(fontSize: 14),
),
title: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text.rich(
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: TextStyle(fontSize: 14),
children: [
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
height: MediaQuery.textScalerOf(context).scale(15),
width: 10,
alignment: Alignment.center,
child: Container(
height: 10,
width: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: _blockColor[index],
),
),
),
style: TextStyle(fontSize: 14),
),
TextSpan(
text: ' ${_blockSettings[index].first.title}',
style: TextStyle(fontSize: 14),
),
],
),
],
),
),
PopupMenuButton(
initialValue: _blockSettings[index].second,
onSelected: (item) async {
_blockSettings[index].second = item;
await setting.put(
SettingBoxKey.blockSettings,
_blockSettings
.map((item) => item.second.index)
.toList());
setState(() {});
},
itemBuilder: (context) => SkipType.values
.map((item) => PopupMenuItem<SkipType>(
value: item,
child: Text(item.title),
))
.toList(),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_blockSettings[index].second.title,
style: TextStyle(
height: 1,
fontSize: 14,
color: _blockSettings[index].second ==
SkipType.disable
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.7)
: Theme.of(context).colorScheme.secondary,
),
strutStyle: StrutStyle(height: 1, leading: 0),
),
Icon(
MdiIcons.unfoldMoreHorizontal,
size: MediaQuery.textScalerOf(context).scale(14),
color:
_blockSettings[index].second == SkipType.disable
? Theme.of(context)
.colorScheme
.outline
.withOpacity(0.7)
: Theme.of(context).colorScheme.secondary,
),
],
),
),
),
],
),
subtitle: Text(
_blockSettings[index].first.description,
@@ -487,48 +544,6 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
: Theme.of(context).colorScheme.outline,
),
),
trailing: PopupMenuButton(
initialValue: _blockSettings[index].second,
onSelected: (item) async {
_blockSettings[index].second = item;
await setting.put(SettingBoxKey.blockSettings,
_blockSettings.map((item) => item.second.index).toList());
setState(() {});
},
itemBuilder: (context) => SkipType.values
.map((item) => PopupMenuItem<SkipType>(
value: item,
child: Text(item.title),
))
.toList(),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
_blockSettings[index].second.title,
style: TextStyle(
height: 1,
fontSize: 14,
color:
_blockSettings[index].second == SkipType.disable
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
),
strutStyle: StrutStyle(height: 1, leading: 0),
),
Icon(
MdiIcons.unfoldMoreHorizontal,
size: MediaQuery.textScalerOf(context).scale(14),
color: _blockSettings[index].second == SkipType.disable
? Theme.of(context).colorScheme.error
: Theme.of(context).colorScheme.primary,
),
],
),
),
),
),
separatorBuilder: (context, index) => Divider(
height: 1,

View File

@@ -7,6 +7,7 @@ import 'package:PiliPalaX/models/common/dynamics_type.dart';
import 'package:PiliPalaX/models/common/nav_bar_config.dart';
import 'package:PiliPalaX/models/common/rcmd_type.dart';
import 'package:PiliPalaX/models/common/reply_sort_type.dart';
import 'package:PiliPalaX/models/common/theme_type.dart';
import 'package:PiliPalaX/models/common/up_panel_position.dart';
import 'package:PiliPalaX/models/video/play/CDN.dart';
import 'package:PiliPalaX/models/video/play/quality.dart';
@@ -348,31 +349,32 @@ List<SettingsModel> get styleSettings => [
),
),
),
// SettingsModel(
// settingsType: SettingsType.normal,
// onTap: (setState) async {
// ThemeType? result = await showDialog(
// context: Get.context!,
// builder: (context) {
// return SelectDialog<ThemeType>(
// title: '主题模式',
// value: GStorage.themeType,
// values: ThemeType.values.map(
// (e) {
// return {'title': e.description, 'value': e};
// },
// ).toList());
// },
// );
// if (result != null) {
// GStorage.setting.put(SettingBoxKey.themeMode, result.index);
// Get.forceAppUpdate();
// }
// },
// leading: const Icon(Icons.flashlight_on_outlined),
// title: '主题模式',
// getSubtitle: () => '当前模式:${GStorage.themeType.description}',
// ),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) async {
ThemeType? result = await showDialog(
context: Get.context!,
builder: (context) {
return SelectDialog<ThemeType>(
title: '主题模式',
value: GStorage.themeType,
values: ThemeType.values.map(
(e) {
return {'title': e.description, 'value': e};
},
).toList());
},
);
if (result != null) {
GStorage.setting.put(SettingBoxKey.themeMode, result.index);
Get.put(ColorSelectController()).themeType.value = result;
Get.forceAppUpdate();
}
},
leading: const Icon(Icons.flashlight_on_outlined),
title: '主题模式',
getSubtitle: () => '当前模式:${GStorage.themeType.description}',
),
SettingsModel(
settingsType: SettingsType.normal,
onTap: (setState) => Get.toNamed('/colorSetting'),

View File

@@ -1538,7 +1538,7 @@ class VideoDetailController extends GetxController
fontSize: 14,
color: Theme.of(context)
.colorScheme
.primary,
.secondary,
),
strutStyle: StrutStyle(
height: 1,
@@ -1554,7 +1554,7 @@ class VideoDetailController extends GetxController
.scale(14),
color: Theme.of(context)
.colorScheme
.primary,
.secondary,
),
],
),
@@ -1605,7 +1605,7 @@ class VideoDetailController extends GetxController
fontSize: 14,
color: Theme.of(context)
.colorScheme
.primary,
.secondary,
),
strutStyle: StrutStyle(
height: 1,
@@ -1621,7 +1621,7 @@ class VideoDetailController extends GetxController
.scale(14),
color: Theme.of(context)
.colorScheme
.primary,
.secondary,
),
],
),