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