mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 08:36:17 +08:00
show space setting
opt switch anonymity Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:PiliPlus/http/user.dart';
|
||||
import 'package:PiliPlus/http/video.dart';
|
||||
import 'package:PiliPlus/models/common/member/tab_type.dart';
|
||||
import 'package:PiliPlus/models_new/space/space/data.dart';
|
||||
import 'package:PiliPlus/models_new/space/space/setting.dart';
|
||||
import 'package:PiliPlus/models_new/space/space/tab2.dart';
|
||||
import 'package:PiliPlus/pages/common/common_data_controller.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
@@ -36,6 +37,7 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
||||
RxInt relation = 0.obs;
|
||||
bool get isFollow => relation.value != 0 && relation.value != 128;
|
||||
|
||||
SpaceSetting? spaceSetting;
|
||||
List<SpaceTab2>? tab2;
|
||||
late List<Tab> tabs;
|
||||
TabController? tabController;
|
||||
@@ -122,6 +124,9 @@ class MemberController extends CommonDataController<SpaceData, SpaceData?>
|
||||
);
|
||||
}
|
||||
}
|
||||
if (mid == accountService.mid) {
|
||||
spaceSetting = data.setting;
|
||||
}
|
||||
loadingState.value = response;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ class _MemberHomeState extends State<MemberHome>
|
||||
|
||||
Widget _buildBody(LoadingState<SpaceData?> loadingState) {
|
||||
final isVertical = context.orientation == Orientation.portrait;
|
||||
final setting = _ctr.spaceSetting;
|
||||
final color = Theme.of(context).colorScheme.outline;
|
||||
return switch (loadingState) {
|
||||
Loading() => loadingWidget,
|
||||
Success(response: final res) => res != null
|
||||
@@ -50,6 +52,7 @@ class _MemberHomeState extends State<MemberHome>
|
||||
slivers: [
|
||||
if (res.archive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '视频',
|
||||
param: 'contribute',
|
||||
param1: 'video',
|
||||
@@ -82,9 +85,11 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.favourite2?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '收藏',
|
||||
param: 'favorite',
|
||||
count: res.favourite2!.count!,
|
||||
visible: setting?.favVideo == 1,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
@@ -97,9 +102,11 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.coinArchive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '最近投币的视频',
|
||||
param: 'coinArchive',
|
||||
count: res.coinArchive!.count!,
|
||||
visible: setting?.coinsVideo == 1,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -128,9 +135,11 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.likeArchive?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '最近点赞的视频',
|
||||
param: 'likeArchive',
|
||||
count: res.likeArchive!.count!,
|
||||
visible: setting?.likesVideo == 1,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -159,6 +168,7 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.article?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '图文',
|
||||
param: 'contribute',
|
||||
param1: 'opus',
|
||||
@@ -178,6 +188,7 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.audios?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '音频',
|
||||
param: 'contribute',
|
||||
param1: 'audio',
|
||||
@@ -187,9 +198,11 @@ class _MemberHomeState extends State<MemberHome>
|
||||
],
|
||||
if (res.season?.item?.isNotEmpty == true) ...[
|
||||
_videoHeader(
|
||||
color,
|
||||
title: '追番',
|
||||
param: 'bangumi',
|
||||
count: res.season!.count!,
|
||||
visible: setting?.bangumi == 1,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -228,13 +241,14 @@ class _MemberHomeState extends State<MemberHome>
|
||||
};
|
||||
}
|
||||
|
||||
Widget _videoHeader({
|
||||
Widget _videoHeader(
|
||||
Color color, {
|
||||
required String title,
|
||||
required String param,
|
||||
String? param1,
|
||||
required int count,
|
||||
bool? visible,
|
||||
}) {
|
||||
final color = Theme.of(context).colorScheme.outline;
|
||||
return SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
@@ -249,6 +263,20 @@ class _MemberHomeState extends State<MemberHome>
|
||||
text: count.toString(),
|
||||
style: TextStyle(fontSize: 13, color: color),
|
||||
),
|
||||
if (visible != null)
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Icon(
|
||||
visible == true
|
||||
? Icons.visibility
|
||||
: Icons.visibility_off,
|
||||
size: 17,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -92,6 +92,7 @@ class MineController extends GetxController {
|
||||
}
|
||||
anonymity.value = !anonymity.value;
|
||||
if (anonymity.value) {
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.show<bool>(
|
||||
clickMaskDismiss: false,
|
||||
usePenetrate: true,
|
||||
@@ -99,8 +100,10 @@ class MineController extends GetxController {
|
||||
alignment: Alignment.bottomCenter,
|
||||
builder: (context) {
|
||||
final theme = Theme.of(context);
|
||||
final style =
|
||||
TextStyle(color: theme.colorScheme.onSecondaryContainer);
|
||||
return ColoredBox(
|
||||
color: theme.colorScheme.primaryContainer,
|
||||
color: theme.colorScheme.secondaryContainer,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 15,
|
||||
@@ -110,10 +113,11 @@ class MineController extends GetxController {
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
const Icon(MdiIcons.incognito),
|
||||
const Icon(MdiIcons.incognito, size: 20),
|
||||
const SizedBox(width: 10),
|
||||
Text('已进入无痕模式', style: theme.textTheme.titleMedium)
|
||||
],
|
||||
@@ -123,8 +127,9 @@ class MineController extends GetxController {
|
||||
'搜索、观看视频/直播不携带身份信息(包含大会员)\n'
|
||||
'不产生查询或播放记录\n'
|
||||
'点赞等其它操作不受影响\n'
|
||||
'(前往隐私设置了解详情)',
|
||||
style: theme.textTheme.bodySmall),
|
||||
'(前往隐私设置了解详情)',
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
@@ -133,24 +138,15 @@ class MineController extends GetxController {
|
||||
SmartDialog.dismiss(result: true);
|
||||
SmartDialog.showToast('已设为永久无痕模式');
|
||||
},
|
||||
child: Text(
|
||||
'保存为永久',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.primary,
|
||||
child: Text('保存为永久', style: style),
|
||||
),
|
||||
)),
|
||||
const SizedBox(width: 10),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
SmartDialog.dismiss();
|
||||
SmartDialog.showToast('已设为临时无痕模式');
|
||||
},
|
||||
child: Text(
|
||||
'仅本次(默认)',
|
||||
style: TextStyle(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
child: Text('仅本次(默认)', style: style),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -160,12 +156,16 @@ class MineController extends GetxController {
|
||||
);
|
||||
},
|
||||
).then((res) {
|
||||
if (res == false) {
|
||||
return;
|
||||
}
|
||||
res == true
|
||||
? Accounts.set(AccountType.heartbeat, AnonymousAccount())
|
||||
: Accounts.accountMode[AccountType.heartbeat] = AnonymousAccount();
|
||||
});
|
||||
} else {
|
||||
Accounts.set(AccountType.heartbeat, Accounts.main);
|
||||
SmartDialog.dismiss(result: false);
|
||||
SmartDialog.show(
|
||||
clickMaskDismiss: false,
|
||||
usePenetrate: true,
|
||||
@@ -185,7 +185,7 @@ class MineController extends GetxController {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const Icon(MdiIcons.incognitoOff),
|
||||
const Icon(MdiIcons.incognitoOff, size: 20),
|
||||
const SizedBox(width: 10),
|
||||
Text('已退出无痕模式', style: theme.textTheme.titleMedium),
|
||||
],
|
||||
|
||||
@@ -59,7 +59,7 @@ class ThemeUtils {
|
||||
actionTextColor: colorScheme.primary,
|
||||
backgroundColor: colorScheme.secondaryContainer,
|
||||
closeIconColor: colorScheme.secondary,
|
||||
contentTextStyle: TextStyle(color: colorScheme.secondary),
|
||||
contentTextStyle: TextStyle(color: colorScheme.onSecondaryContainer),
|
||||
elevation: 20,
|
||||
),
|
||||
popupMenuTheme: PopupMenuThemeData(
|
||||
|
||||
Reference in New Issue
Block a user