Merge branch 'main' into feature-sponsorBlock

This commit is contained in:
guozhigq
2024-11-23 00:05:30 +08:00
144 changed files with 884 additions and 802 deletions

View File

@ -12,7 +12,6 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
<queries>
<intent>
@ -20,7 +19,6 @@
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<queries>
<!-- If your app checks for http support -->
<intent>
@ -34,7 +32,6 @@
<data android:scheme="https" />
</intent>
</queries>
<application
android:label="PiliPala"
android:name="${applicationName}"
@ -144,102 +141,55 @@
<data android:scheme="bilibili" android:host="assistant" />
<data android:scheme="bilibili" android:host="feedback" />
<data android:scheme="bilibili" android:host="auth" android:path="/launch" />
<data android:scheme="http" android:host="live.bilibili.com"
android:pathPattern="/live/.*" />
<data android:scheme="https" android:host="live.bilibili.com"
android:pathPattern="/live/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.tv"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="www.bilibili.tv"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="www.bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/mobile/video/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/mobile/video/.*" />
<data android:scheme="http" android:host="m.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="m.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/story/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/story/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/bangumi/i/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/bangumi/i/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/mobile/bangumi/i/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/mobile/bangumi/i/.*" />
<data android:scheme="http" android:host="bangumi.bilibili.com"
android:pathPattern="/.*" />
<data android:scheme="https" android:host="bangumi.bilibili.com"
android:pathPattern="/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/bangumi/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/bangumi/.*" />
<data android:scheme="http" android:host="m.bilibili.com"
android:pathPattern="/bangumi/.*" />
<data android:scheme="https" android:host="m.bilibili.com"
android:pathPattern="/bangumi/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/cheese/play/ss.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/cheese/play/ss.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/cheese/play/ep.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/cheese/play/ep.*" />
<data android:scheme="http" android:host="m.bilibili.com"
android:pathPattern="/bangumi/play/ss.*" />
<data android:scheme="https" android:host="m.bilibili.com"
android:pathPattern="/cheese/play/ss.*" />
<data android:scheme="http" android:host="m.bilibili.com"
android:pathPattern="/cheese/play/ep.*" />
<data android:scheme="https" android:host="m.bilibili.com"
android:pathPattern="/cheese/play/ep.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/read/cv.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/read/cv.*" />
<data android:scheme="http" android:host="www.bilibili.com" android:path="/review/" />
<data android:scheme="https" android:host="www.bilibili.com" android:path="/review/" />
<data android:scheme="http" android:host="bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="www.bilibili.cn"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/video/.*" />
<data android:scheme="http" android:host="www.bilibili.com"
android:pathPattern="/mobile/video/.*" />
<data android:scheme="https" android:host="www.bilibili.com"
android:pathPattern="/mobile/video/.*" />
<data android:scheme="https" android:host="b23.tv"
android:pathPattern="/*" />
<data android:scheme="https" android:host="space.bilibili.com"
android:pathPattern="/*" />
</intent-filter>
</activity>
<service
@ -251,7 +201,6 @@
<action android:name="android.media.browse.MediaBrowserService" />
</intent-filter>
</service>
<receiver
android:name="com.ryanheise.audioservice.MediaButtonReceiver"
android:exported="true"

View File

@ -1,8 +1,6 @@
PODS:
- app_links (0.0.2):
- Flutter
- appscheme (1.0.4):
- Flutter
- audio_service (0.0.1):
- Flutter
- audio_session (0.0.1):
@ -71,7 +69,6 @@ PODS:
DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- appscheme (from `.symlinks/plugins/appscheme/ios`)
- audio_service (from `.symlinks/plugins/audio_service/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
@ -110,8 +107,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
appscheme:
:path: ".symlinks/plugins/appscheme/ios"
audio_service:
:path: ".symlinks/plugins/audio_service/ios"
audio_session:
@ -171,7 +166,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d

View File

@ -105,7 +105,8 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
List<ScrollController>? _listScrollControllerList;
final String heroTag = Get.arguments['heroTag'];
VideoDetailController? _videoDetailController;
late RxInt isSubscribe = (-1).obs;
RxInt isSubscribe = (-1).obs;
bool isVisible = false;
@override
void initState() {
@ -224,6 +225,13 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
}
}
// 更改展开状态
void _changeVisible() {
setState(() {
isVisible = !isVisible;
});
}
@override
void dispose() {
try {
@ -255,7 +263,9 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
UgcSeasonBuild(
ugcSeason: widget.ugcSeason!,
isSubscribe: isSubscribe,
isVisible: isVisible,
changeFucCall: _changeSubscribeStatus,
changeVisible: _changeVisible,
),
],
Expanded(
@ -325,7 +335,10 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
Widget buildTabBar() {
return Column(
children: [
TabBar(
// 背景色
Container(
color: Theme.of(context).colorScheme.surface,
child: TabBar(
controller: tabController,
isScrollable: true,
indicatorSize: TabBarIndicatorSize.label,
@ -339,6 +352,7 @@ class _PagesBottomSheetState extends State<PagesBottomSheet>
}).toList()
],
),
),
Expanded(
child: TabBarView(
controller: tabController,
@ -394,17 +408,29 @@ class TitleBar extends StatelessWidget {
toolbarHeight: 45,
automaticallyImplyLeading: false,
centerTitle: false,
title: Text(
elevation: 1,
scrolledUnderElevation: 1,
title: Padding(
padding: const EdgeInsets.only(left: 12),
child: Text(
title,
style: Theme.of(context).textTheme.titleMedium,
),
),
actions: !isFullScreen
? [
IconButton(
SizedBox(
width: 35,
height: 35,
child: IconButton(
icon: const Icon(Icons.close, size: 20),
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () => Navigator.pop(context),
),
const SizedBox(width: 14),
),
const SizedBox(width: 8),
]
: null,
);
@ -465,7 +491,7 @@ class EpisodeListItem extends StatelessWidget {
dense: false,
leading: isCurrentIndex
? Image.asset(
'assets/images/live.gif',
'assets/images/live.png',
color: primary,
height: 12,
)
@ -678,46 +704,52 @@ class EpisodeGridItem extends StatelessWidget {
class UgcSeasonBuild extends StatelessWidget {
final UgcSeason ugcSeason;
final RxInt isSubscribe;
final bool isVisible;
final Function changeFucCall;
final Function changeVisible;
const UgcSeasonBuild({
Key? key,
required this.ugcSeason,
required this.isSubscribe,
required this.isVisible,
required this.changeFucCall,
required this.changeVisible,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final ThemeData t = Theme.of(context);
final Color outline = t.colorScheme.outline;
return Container(
final ThemeData theme = Theme.of(context);
final Color outline = theme.colorScheme.outline;
final Color surface = theme.colorScheme.surface;
final Color primary = theme.colorScheme.primary;
final Color onPrimary = theme.colorScheme.onPrimary;
final Color onInverseSurface = theme.colorScheme.onInverseSurface;
final TextStyle titleMedium = theme.textTheme.titleMedium!;
final TextStyle labelMedium = theme.textTheme.labelMedium!;
final Color dividerColor = theme.dividerColor.withOpacity(0.1);
return isVisible
? Container(
padding: const EdgeInsets.fromLTRB(12, 0, 12, 0),
color: Theme.of(context).colorScheme.surface,
color: surface,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Divider(
height: 1,
thickness: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
),
Divider(height: 1, thickness: 1, color: dividerColor),
const SizedBox(height: 10),
Text(
'合集:${ugcSeason.title}',
style: Theme.of(context).textTheme.titleMedium,
overflow: TextOverflow.ellipsis,
),
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
const SizedBox(height: 4),
Row(
children: [
Expanded(
child: Text(ugcSeason.intro ?? '',
style: TextStyle(
color: Theme.of(context).colorScheme.outline)),
child: Text(
'合集:${ugcSeason.title}',
style: titleMedium,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 10),
Obx(
() => isSubscribe.value == -1
? const SizedBox(height: 32)
@ -726,47 +758,79 @@ class UgcSeasonBuild extends StatelessWidget {
child: FilledButton.tonal(
onPressed: () => changeFucCall.call(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(
left: 8,
right: 8,
),
padding:
const EdgeInsets.only(left: 8, right: 8),
foregroundColor: isSubscribe.value == 1
? outline
: t.colorScheme.onPrimary,
: onPrimary,
backgroundColor: isSubscribe.value == 1
? t.colorScheme.onInverseSurface
: t.colorScheme.primary, // 设置按钮背景色
? onInverseSurface
: primary,
),
child: Text(isSubscribe.value == 1 ? '已订阅' : '订阅'),
child:
Text(isSubscribe.value == 1 ? '已订阅' : '订阅'),
),
),
),
const SizedBox(width: 6),
],
),
if (ugcSeason.intro != null && ugcSeason.intro != '') ...[
const SizedBox(height: 4),
Text(
ugcSeason.intro!,
style: TextStyle(color: outline, fontSize: 12),
),
],
const SizedBox(height: 4),
Text.rich(
TextSpan(
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,
color: Theme.of(context).colorScheme.outline,
),
fontSize: labelMedium.fontSize, color: outline),
children: [
TextSpan(text: '${Utils.numFormat(ugcSeason.stat!.view)}播放'),
TextSpan(
text: '${Utils.numFormat(ugcSeason.stat!.view)}播放'),
const TextSpan(text: ' · '),
TextSpan(text: '${Utils.numFormat(ugcSeason.stat!.danmaku)}弹幕'),
TextSpan(
text:
'${Utils.numFormat(ugcSeason.stat!.danmaku)}弹幕'),
],
),
),
const SizedBox(height: 14),
Divider(
height: 1,
thickness: 1,
color: Theme.of(context).dividerColor.withOpacity(0.1),
Align(
alignment: Alignment.center,
child: Material(
color: surface,
child: InkWell(
onTap: () => changeVisible.call(),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 0),
child: Text(
'收起简介',
style: TextStyle(color: primary, fontSize: 12),
),
),
),
),
),
Divider(height: 1, thickness: 1, color: dividerColor),
],
),
)
: Align(
alignment: Alignment.center,
child: InkWell(
onTap: () => changeVisible.call(),
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
child: Text(
'展开简介',
style: TextStyle(color: primary, fontSize: 12),
),
),
),
);
}
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/utils/storage.dart';
Box<dynamic> setting = GStrorage.setting;
Box<dynamic> setting = GStorage.setting;
class CustomToast extends StatelessWidget {
const CustomToast({super.key, required this.msg});

View File

@ -6,7 +6,7 @@ import 'package:pilipala/utils/global_data_cache.dart';
import '../../utils/storage.dart';
import '../constants.dart';
Box<dynamic> setting = GStrorage.setting;
Box<dynamic> setting = GStorage.setting;
class NetworkImgLayer extends StatelessWidget {
const NetworkImgLayer({
@ -48,7 +48,7 @@ class NetworkImgLayer extends StatelessWidget {
Widget build(BuildContext context) {
int defaultImgQuality = 10;
try {
defaultImgQuality = GlobalDataCache().imgQuality;
defaultImgQuality = GlobalDataCache.imgQuality;
} catch (_) {}
if (src == '' || src == null) {

View File

@ -619,4 +619,7 @@ class Api {
/// 获取空降区间
static const String getSkipSegments =
'${HttpString.sponsorBlockBaseUrl}/api/skipSegments';
/// 视频标签
static const String videoTag = '/x/tag/archive/tags';
}

View File

@ -17,7 +17,9 @@ class DanmakaHttp {
var response = await Request().get(
Api.webDanmaku,
data: params,
extra: {'resType': ResponseType.bytes},
options: Options(
responseType: ResponseType.bytes,
),
);
return DmSegMobileReply.fromBuffer(response.data);
}

View File

@ -92,7 +92,7 @@ class DynamicsHttp {
//
static Future dynamicDetail({
String? id,
required String id,
}) async {
var res = await Request().get(Api.dynamicDetail, data: {
'timezone_offset': -480,

View File

@ -9,6 +9,7 @@ import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/id_utils.dart';
import '../utils/storage.dart';
import '../utils/utils.dart';
@ -21,8 +22,8 @@ class Request {
static late CookieManager cookieManager;
static late final Dio dio;
factory Request() => _instance;
Box setting = GStrorage.setting;
static Box localCache = GStrorage.localCache;
Box setting = GStorage.setting;
static Box localCache = GStorage.localCache;
late bool enableSystemProxy;
late String systemProxyHost;
late String systemProxyPort;
@ -32,8 +33,8 @@ class Request {
/// 设置cookie
static setCookie() async {
Box userInfoCache = GStrorage.userInfo;
Box setting = GStrorage.setting;
Box userInfoCache = GStorage.userInfo;
Box setting = GStorage.setting;
final String cookiePath = await Utils.getCookiePath();
final PersistCookieJar cookieJar = PersistCookieJar(
ignoreExpires: true,
@ -43,7 +44,7 @@ class Request {
dio.interceptors.add(cookieManager);
final List<Cookie> cookie = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.baseUrl));
final userInfo = userInfoCache.get('userInfoCache');
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
if (userInfo != null && userInfo.mid != null) {
final List<Cookie> cookie2 = await cookieManager.cookieJar
.loadForRequest(Uri.parse(HttpString.tUrl));
@ -209,17 +210,13 @@ class Request {
*/
get(url, {data, Options? options, cancelToken, extra}) async {
Response response;
options ??= Options(); // 如果 options 为 null则初始化一个新的 Options 对象
ResponseType resType = ResponseType.json;
if (extra != null) {
resType = extra['resType'] ?? ResponseType.json;
if (extra['ua'] != null) {
options.headers = {'user-agent': headerUa(type: extra['ua'])};
options ??= Options();
options.headers ??= <String, dynamic>{};
options.headers?['user-agent'] = headerUa(type: extra['ua']);
}
}
options.responseType = resType;
try {
response = await dio.get(
url,

View File

@ -4,6 +4,7 @@ import 'package:hive/hive.dart';
import 'package:html/parser.dart';
import 'package:pilipala/models/member/article.dart';
import 'package:pilipala/models/member/like.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/global_data_cache.dart';
import '../common/constants.dart';
import '../models/dynamics/result.dart';
@ -25,7 +26,7 @@ class MemberHttp {
}) async {
String? wWebid;
if ((await getWWebid(mid: mid))['status']) {
wWebid = GlobalDataCache().wWebid;
wWebid = GlobalDataCache.wWebid;
}
Map params = await WbiSign().makSign({
@ -470,11 +471,11 @@ class MemberHttp {
SmartDialog.dismiss();
if (res.data['code'] == 0) {
String accessKey = res.data['data']['access_token'];
Box localCache = GStrorage.localCache;
Box userInfoCache = GStrorage.userInfo;
var userInfo = userInfoCache.get('userInfoCache');
Box localCache = GStorage.localCache;
Box userInfoCache = GStorage.userInfo;
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
localCache.put(
LocalCacheKey.accessKey, {'mid': userInfo.mid, 'value': accessKey});
LocalCacheKey.accessKey, {'mid': userInfo!.mid, 'value': accessKey});
return {'status': true, 'data': [], 'msg': '操作成功'};
} else {
return {
@ -573,7 +574,7 @@ class MemberHttp {
}
static Future getWWebid({required int mid}) async {
String? wWebid = GlobalDataCache().wWebid;
String? wWebid = GlobalDataCache.wWebid;
if (wWebid != null) {
return {'status': true, 'data': wWebid};
}
@ -587,7 +588,7 @@ class MemberHttp {
final content = match.group(1);
String decodedString = Uri.decodeComponent(content!);
Map<String, dynamic> map = jsonDecode(decodedString);
GlobalDataCache().wWebid = map['access_id'];
GlobalDataCache.wWebid = map['access_id'];
return {'status': true, 'data': map['access_id']};
} else {
return {'status': false, 'data': '请检查登录状态'};
@ -604,7 +605,7 @@ class MemberHttp {
}) async {
String? wWebid;
if ((await getWWebid(mid: mid))['status']) {
wWebid = GlobalDataCache().wWebid;
wWebid = GlobalDataCache.wWebid;
}
Map params = await WbiSign().makSign({
'host_mid': mid,

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:html/parser.dart';
import 'package:pilipala/models/read/opus.dart';
import 'package:pilipala/models/read/read.dart';
@ -65,6 +66,11 @@ class ReadHttp {
var res = await Request().get(
'https://www.bilibili.com/read/cv$id',
extra: {'ua': 'pc'},
options: Options(
headers: {
'cookie': 'opus-goback=1',
},
),
);
String scriptContent =
extractScriptContents(parse(res.data).body!.outerHtml)[0];

View File

@ -11,7 +11,7 @@ import '../utils/storage.dart';
import 'index.dart';
class SearchHttp {
static Box setting = GStrorage.setting;
static Box setting = GStorage.setting;
static Future hotSearchList() async {
var res = await Request().get(Api.hotSearchList);
if (res.data is String) {

View File

@ -3,6 +3,7 @@ import 'dart:developer';
import 'package:dio/dio.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/models/video/tags.dart';
import '../common/constants.dart';
import '../models/common/reply_type.dart';
import '../models/home/rcmd/result.dart';
@ -25,11 +26,11 @@ import 'init.dart';
/// 返回{'status': bool, 'data': List}
/// view层根据 status 判断渲染逻辑
class VideoHttp {
static Box localCache = GStrorage.localCache;
static Box setting = GStrorage.setting;
static Box localCache = GStorage.localCache;
static Box setting = GStorage.setting;
static bool enableRcmdDynamic =
setting.get(SettingBoxKey.enableRcmdDynamic, defaultValue: true);
static Box userInfoCache = GStrorage.userInfo;
static Box userInfoCache = GStorage.userInfo;
// 首页推荐视频
static Future rcmdVideoList({required int ps, required int freshIdx}) async {
@ -607,4 +608,19 @@ class VideoHttp {
};
}
}
// 获取视频标签
static Future getVideoTag({required String bvid}) async {
var res = await Request().get(Api.videoTag, data: {'bvid': bvid});
if (res.data['code'] == 0) {
return {
'status': true,
'data': res.data['data'].map<VideoTagItem>((e) {
return VideoTagItem.fromJson(e);
}).toList()
};
} else {
return {'status': false, 'data': [], 'msg': res.data['message']};
}
}
}

View File

@ -32,7 +32,7 @@ void main() async {
MediaKit.ensureInitialized();
await SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);
await GStrorage.init();
await GStorage.init();
clearLogs();
Request();
await Request.setCookie();
@ -65,7 +65,7 @@ void main() async {
}
PiliSchame.init();
await GlobalDataCache().initialize();
await GlobalDataCache.initialize();
}
class MyApp extends StatelessWidget {
@ -73,7 +73,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
// 主题色
Color defaultColor =
colorThemeTypes[setting.get(SettingBoxKey.customColor, defaultValue: 0)]
@ -222,13 +222,23 @@ class BuildMainApp extends StatelessWidget {
elevation: 20,
);
return GetMaterialApp(
title: 'PiliPala',
theme: ThemeData(
colorScheme: currentThemeValue == ThemeType.dark
? darkColorScheme
: lightColorScheme,
AppBarTheme appBarTheme(ColorScheme colorScheme) {
return AppBarTheme(
backgroundColor: colorScheme.surface,
foregroundColor: colorScheme.onSurface,
elevation: 0,
titleSpacing: 0,
scrolledUnderElevation: 0,
// titleTextStyle: TextStyle(
// fontSize: Theme.of(context).textTheme.titleLarge!.fontSize),
);
}
ThemeData buildThemeData(ColorScheme colorScheme) {
return ThemeData(
colorScheme: colorScheme,
snackBarTheme: snackBarTheme,
appBarTheme: appBarTheme(colorScheme),
pageTransitionsTheme: const PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{
TargetPlatform.android: ZoomPageTransitionsBuilder(
@ -236,12 +246,20 @@ class BuildMainApp extends StatelessWidget {
),
},
),
);
}
return GetMaterialApp(
title: 'PiliPala',
theme: buildThemeData(
currentThemeValue == ThemeType.dark
? darkColorScheme
: lightColorScheme,
),
darkTheme: ThemeData(
colorScheme: currentThemeValue == ThemeType.light
darkTheme: buildThemeData(
currentThemeValue == ThemeType.light
? lightColorScheme
: darkColorScheme,
snackBarTheme: snackBarTheme,
),
localizationsDelegates: const [
GlobalCupertinoLocalizations.delegate,

View File

@ -125,6 +125,7 @@ class ReplyControl {
this.upLike,
this.isShow,
this.entryText,
this.entryTextNum,
this.titleText,
this.time,
this.location,
@ -135,6 +136,7 @@ class ReplyControl {
bool? upLike;
bool? isShow;
String? entryText;
int? entryTextNum;
String? titleText;
String? time;
String? location;
@ -155,6 +157,10 @@ class ReplyControl {
}
entryText = json['sub_reply_entry_text'];
// 正则匹配
entryTextNum = json['sub_reply_entry_text'] != null
? int.parse(RegExp(r"\d+").stringMatch(json['sub_reply_entry_text']!)!)
: 0;
titleText = json['sub_reply_title_text'];
time = json['time_desc'];
location = json['location'] != null ? json['location'].split('')[1] : '';

View File

@ -29,7 +29,7 @@ class ReplyMember {
avatar = json['avatar'];
level = json['level_info']['current_level'];
pendant = Pendant.fromJson(json['pendant']);
officialVerify = json['officia_verify'];
officialVerify = json['official_verify'];
vip = json['vip'];
fansDetail = json['fans_detail'];
userSailing = json['user_sailing'] != null

View File

@ -0,0 +1,17 @@
class VideoTagItem {
String? tagName;
int? tagId;
int? tagType;
VideoTagItem({
this.tagName,
this.tagId,
this.tagType,
});
VideoTagItem.fromJson(Map<String, dynamic> json) {
tagName = json['tag_name'];
tagId = json['tag_id'];
tagType = json['type'];
}
}

View File

@ -39,9 +39,7 @@ class _AboutPageState extends State<AboutPage> {
TextStyle subTitleStyle =
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
title: Text('关于', style: Theme.of(context).textTheme.titleMedium),
),
appBar: AppBar(title: const Text('关于')),
body: SingleChildScrollView(
child: Column(
children: [

View File

@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/bangumi.dart';
import 'package:pilipala/models/bangumi/list.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
class BangumiController extends GetxController {
@ -12,17 +13,17 @@ class BangumiController extends GetxController {
RxInt total = 0.obs;
int _currentPage = 1;
bool isLoadingMore = true;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
RxBool userLogin = false.obs;
late int mid;
var userInfo;
UserInfoData? userInfo;
@override
void onInit() {
super.onInit();
userInfo = userInfoCache.get('userInfoCache');
if (userInfo != null) {
mid = userInfo.mid;
mid = userInfo!.mid!;
}
userLogin.value = userInfo != null;
}
@ -55,7 +56,7 @@ class BangumiController extends GetxController {
if (userInfo == null) {
return;
}
var result = await BangumiHttp.getRecentBangumi(mid: userInfo.mid);
var result = await BangumiHttp.getRecentBangumi(mid: userInfo!.mid!);
if (result['status']) {
bangumiFollowList.value = result['data'].list;
total.value = result['data'].total;

View File

@ -8,6 +8,7 @@ import 'package:pilipala/http/search.dart';
import 'package:pilipala/http/video.dart';
import 'package:pilipala/models/bangumi/info.dart';
import 'package:pilipala/models/user/fav_folder.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/pages/video/detail/reply/index.dart';
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
@ -48,7 +49,7 @@ class BangumiIntroController extends GetxController {
RxBool hasCoin = false.obs;
// 是否收藏
RxBool hasFav = false.obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
bool userLogin = false;
Rx<FavFolderData> favFolderData = FavFolderData().obs;
List addMediaIdsNew = [];
@ -57,7 +58,7 @@ class BangumiIntroController extends GetxController {
RxBool isFollowed = false.obs;
RxInt followStatus = 1.obs;
int _tempThemeValue = -1;
var userInfo;
UserInfoData? userInfo;
PersistentBottomSheetController? bottomSheetController;
List<Map<String, dynamic>> followStatusList = [
{'title': '标记为 「想看」', 'status': 1},
@ -259,7 +260,7 @@ class BangumiIntroController extends GetxController {
Future queryVideoInFolder() async {
var result = await VideoHttp.videoInFolder(
mid: userInfo.mid, rid: IdUtils.bv2av(bvid));
mid: userInfo!.mid!, rid: IdUtils.bv2av(bvid));
if (result['status']) {
favFolderData.value = result['data'];
}

View File

@ -116,7 +116,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
String heroTag = Get.arguments['heroTag'];
late final BangumiIntroController bangumiIntroController;
late final VideoDetailController videoDetailCtr;
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
late double sheetHeight;
int? cid;
bool isProcessing = false;
@ -148,7 +148,7 @@ class _BangumiInfoState extends State<BangumiInfo> {
// 收藏
showFavBottomSheet() async {
if (bangumiIntroController.userInfo.mid == null) {
if (bangumiIntroController.userInfo?.mid == null) {
SmartDialog.showToast('账号未登录');
return;
}

View File

@ -4,7 +4,7 @@ import 'package:pilipala/common/widgets/stat/danmu.dart';
import 'package:pilipala/common/widgets/stat/view.dart';
import 'package:pilipala/utils/storage.dart';
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
late double sheetHeight;
class IntroDetail extends StatelessWidget {

View File

@ -5,6 +5,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/models/bangumi/info.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/pages/video/detail/index.dart';
import 'package:pilipala/utils/storage.dart';
import '../../../common/pages_bottom_sheet.dart';
@ -36,8 +37,8 @@ class BangumiPanel extends StatefulWidget {
class _BangumiPanelState extends State<BangumiPanel> {
late RxInt currentIndex = (-1).obs;
final ScrollController listViewScrollCtr = ScrollController();
Box userInfoCache = GStrorage.userInfo;
dynamic userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
// 默认未开通
int vipStatus = 0;
late int cid;
@ -63,7 +64,7 @@ class _BangumiPanelState extends State<BangumiPanel> {
/// 获取大会员状态
userInfo = userInfoCache.get('userInfoCache');
if (userInfo != null) {
vipStatus = userInfo.vipStatus;
vipStatus = userInfo!.vipStatus!;
}
}

View File

@ -22,7 +22,7 @@ class _BlackListPageState extends State<BlackListPage> {
final ScrollController scrollController = ScrollController();
Future? _futureBuilderFuture;
bool _isLoadingMore = false;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
@override
void initState() {
@ -55,14 +55,9 @@ class _BlackListPageState extends State<BlackListPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'黑名单管理 ${_blackListController.total.value == 0 ? '' : '- ${_blackListController.total.value}'}',
style: Theme.of(context).textTheme.titleMedium,
),
),
),

View File

@ -32,7 +32,7 @@ class _PlDanmakuState extends State<PlDanmaku> {
late PlDanmakuController _plDanmakuController;
DanmakuController? _controller;
// bool danmuPlayStatus = true;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late bool enableShowDanmaku;
late List blockTypes;
late double showArea;

View File

@ -10,6 +10,7 @@ import 'package:pilipala/models/common/dynamics_type.dart';
import 'package:pilipala/models/dynamics/result.dart';
import 'package:pilipala/models/dynamics/up.dart';
import 'package:pilipala/models/live/item.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/id_utils.dart';
import 'package:pilipala/utils/route_push.dart';
@ -50,11 +51,11 @@ class DynamicsController extends GetxController {
];
bool flag = false;
RxInt initialValue = 0.obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
RxBool userLogin = false.obs;
var userInfo;
UserInfoData? userInfo;
RxBool isLoadingDynamic = false.obs;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
@override
void onInit() {
@ -246,7 +247,7 @@ class DynamicsController extends GetxController {
}
upData.value.upList!.insertAll(0, [
UpItem(face: '', uname: '全部动态', mid: -1),
UpItem(face: userInfo.face, uname: '', mid: userInfo.mid),
UpItem(face: userInfo!.face, uname: '', mid: userInfo!.mid),
]);
}
return res;

View File

@ -24,7 +24,7 @@ class DynamicDetailController extends GetxController {
ReplySortType _sortType = ReplySortType.time;
RxString sortTypeTitle = ReplySortType.time.titles.obs;
RxString sortTypeLabel = ReplySortType.time.labels.obs;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
RxInt replyReqCode = 200.obs;
bool isEnd = false;
@ -37,13 +37,13 @@ class DynamicDetailController extends GetxController {
acount.value =
int.parse(item!.modules!.moduleStat!.comment!.count ?? '0');
}
int deaultReplySortIndex =
int defaultReplySortIndex =
setting.get(SettingBoxKey.replySortType, defaultValue: 0);
if (deaultReplySortIndex == 2) {
if (defaultReplySortIndex == 2) {
setting.put(SettingBoxKey.replySortType, 0);
deaultReplySortIndex = 0;
defaultReplySortIndex = 0;
}
_sortType = ReplySortType.values[deaultReplySortIndex];
_sortType = ReplySortType.values[defaultReplySortIndex];
sortTypeTitle.value = _sortType.titles;
sortTypeLabel.value = _sortType.labels;
}
@ -123,4 +123,15 @@ class DynamicDetailController extends GetxController {
Future onLoad() async {
queryReplyList(reqType: 'onLoad');
}
Future removeReply(int? rpid, int? frpid) async {
// 移除一楼评论
if (rpid != null) {
replyList.removeWhere((item) {
return item.rpid == rpid;
});
}
/// TODO 移除二楼评论
}
}

View File

@ -111,14 +111,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
int rpid = replyItem.rpid!;
Get.to(
() => Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('评论详情')),
body: VideoReplyReplyPanel(
oid: oid,
rpid: rpid,
@ -192,10 +185,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 1,
centerTitle: false,
titleSpacing: 0,
title: StreamBuilder(
stream: titleStreamC.stream,
initialData: false,
@ -335,6 +325,8 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
.replies!
.add(replyItem);
},
onDelete:
_dynamicDetailController.removeReply,
);
}
},

View File

@ -47,7 +47,7 @@ class _DynamicForwardPageState extends State<DynamicForwardPage> {
widget.cb?.call();
_onClose();
} else {
SmartDialog.showToast(res['message']);
SmartDialog.showToast(res['msg']);
}
}

View File

@ -32,7 +32,7 @@ class _DynamicsPageState extends State<DynamicsPage>
final MineController mineController = Get.put(MineController());
late Future _futureBuilderFuture;
late Future _futureBuilderFutureUp;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
late ScrollController scrollController;
@override
@ -78,8 +78,6 @@ class _DynamicsPageState extends State<DynamicsPage>
super.build(context);
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
title: SizedBox(
height: 34,
child: Stack(

View File

@ -90,7 +90,7 @@ class _ActionPanelState extends State<ActionPanel>
SmartDialog.showToast('请先登录');
return;
}
int mid = userInfo.mid;
int mid = userInfo.mid!;
showModalBottomSheet(
context: context,
enableDrag: true,

View File

@ -173,7 +173,7 @@ class _UpPanelState extends State<UpPanel> {
if (data.type == 'up') {
EasyThrottle.throttle('follow', const Duration(milliseconds: 300),
() {
if (GlobalDataCache().enableDynamicSwitch) {
if (GlobalDataCache.enableDynamicSwitch) {
onClickUp(data, i);
} else {
onClickUpAni(data, i);

View File

@ -3,17 +3,18 @@ import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/fan.dart';
import 'package:pilipala/models/fans/result.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
class FansController extends GetxController {
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
int pn = 1;
int ps = 20;
int total = 0;
RxList<FansItemModel> fansList = <FansItemModel>[].obs;
late int mid;
late String name;
var userInfo;
UserInfoData? userInfo;
RxString loadingText = '加载中...'.obs;
RxBool isOwner = false.obs;
@ -23,9 +24,9 @@ class FansController extends GetxController {
userInfo = userInfoCache.get('userInfoCache');
mid = Get.parameters['mid'] != null
? int.parse(Get.parameters['mid']!)
: userInfo.mid;
isOwner.value = mid == userInfo.mid;
name = Get.parameters['name'] ?? userInfo.uname;
: userInfo!.mid!;
isOwner.value = mid == userInfo?.mid;
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
}
Future queryFans(type) async {

View File

@ -49,13 +49,8 @@ class _FansPageState extends State<FansPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: false,
titleSpacing: 0,
title: Text(
_fansController.isOwner.value ? '我的粉丝' : '${_fansController.name}的粉丝',
style: Theme.of(context).textTheme.titleMedium,
),
),
body: RefreshIndicator(

View File

@ -11,7 +11,7 @@ class FavController extends GetxController {
final ScrollController scrollController = ScrollController();
Rx<FavFolderData> favFolderData = FavFolderData().obs;
RxList<FavFolderItemData> favFolderList = <FavFolderItemData>[].obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
int currentPage = 1;
int pageSize = 60;

View File

@ -40,11 +40,8 @@ class _FavPageState extends State<FavPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Obx(() => Text(
'${_favController.isOwner.value ? '' : 'Ta'}的收藏',
style: Theme.of(context).textTheme.titleMedium,
)),
actions: [
Obx(() => !_favController.isOwner.value

View File

@ -19,8 +19,6 @@ class _FavEditPageState extends State<FavEditPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
title: Obx(
() => _favEditController.type.value == 'add'
? Text(
@ -32,7 +30,6 @@ class _FavEditPageState extends State<FavEditPage> {
style: Theme.of(context).textTheme.titleMedium,
),
),
centerTitle: false,
actions: [
Obx(
() => _favEditController.privacy.value == 0

View File

@ -47,7 +47,6 @@ class _FavSearchPageState extends State<FavSearchPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
onPressed: () => _favSearchCtr.submit(),

View File

@ -6,19 +6,20 @@ import 'package:pilipala/http/follow.dart';
import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/follow/result.dart';
import 'package:pilipala/models/member/tags.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
/// 查看自己的关注时,可以查看分类
/// 查看其他人的关注时,只可以看全部
class FollowController extends GetxController with GetTickerProviderStateMixin {
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
int pn = 1;
int ps = 20;
int total = 0;
RxList<FollowItemModel> followList = <FollowItemModel>[].obs;
late int mid;
late String name;
var userInfo;
UserInfoData? userInfo;
RxString loadingText = '加载中...'.obs;
RxBool isOwner = false.obs;
late List<MemberTagItemModel> followTags;
@ -30,9 +31,9 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
userInfo = userInfoCache.get('userInfoCache');
mid = Get.parameters['mid'] != null
? int.parse(Get.parameters['mid']!)
: userInfo.mid;
isOwner.value = mid == userInfo.mid;
name = Get.parameters['name'] ?? userInfo.uname;
: userInfo!.mid!;
isOwner.value = mid == userInfo?.mid;
name = Get.parameters['name'] ?? userInfo?.uname ?? '';
}
Future queryFollowings(type) async {
@ -68,7 +69,7 @@ class FollowController extends GetxController with GetTickerProviderStateMixin {
// 当查看当前用户的关注时,请求关注分组
Future followUpTags() async {
if (userInfo != null && mid == userInfo.mid) {
if (userInfo != null && mid == userInfo!.mid) {
var res = await MemberHttp.followUpTags();
if (res['status']) {
followTags = res['data'];

View File

@ -27,15 +27,10 @@ class _FollowPageState extends State<FollowPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Text(
_followController.isOwner.value
? '我的关注'
: '${_followController.name}的关注',
style: Theme.of(context).textTheme.titleMedium,
),
actions: [
IconButton(

View File

@ -47,7 +47,6 @@ class _FollowSearchPageState extends State<FollowSearchPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
onPressed: reRequest,

View File

@ -12,11 +12,11 @@ class HistoryController extends GetxController {
RxList<HisListItem> historyList = <HisListItem>[].obs;
RxBool isLoadingMore = false.obs;
RxBool pauseStatus = false.obs;
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
RxBool isLoading = false.obs;
RxBool enableMultiple = false.obs;
RxInt checkedCount = 0.obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
@override

View File

@ -69,12 +69,7 @@ class _HistoryPageState extends State<HistoryPage> {
appBar: AppBarWidget(
visible: _historyController.enableMultiple.value,
child1: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'观看记录',
style: Theme.of(context).textTheme.titleMedium,
),
title: const Text('观看记录'),
actions: [
IconButton(
onPressed: () => Get.toNamed('/historySearch'),
@ -127,8 +122,6 @@ class _HistoryPageState extends State<HistoryPage> {
],
),
child2: AppBar(
titleSpacing: 0,
centerTitle: false,
leading: IconButton(
onPressed: () {
_historyController.enableMultiple.value = false;
@ -143,7 +136,6 @@ class _HistoryPageState extends State<HistoryPage> {
title: Obx(
() => Text(
'已选择${_historyController.checkedCount.value}',
style: Theme.of(context).textTheme.titleMedium,
),
),
actions: [

View File

@ -45,7 +45,6 @@ class _HistorySearchPageState extends State<HistorySearchPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
onPressed: () => _hisCtr.submit(),

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/models/common/tab_type.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
import '../../http/index.dart';
@ -14,12 +15,12 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
late TabController tabController;
late List tabsCtrList;
late List<Widget> tabsPageList;
Box userInfoCache = GStrorage.userInfo;
Box settingStorage = GStrorage.setting;
Box userInfoCache = GStorage.userInfo;
Box settingStorage = GStorage.setting;
RxBool userLogin = false.obs;
RxString userFace = ''.obs;
var userInfo;
Box setting = GStrorage.setting;
UserInfoData? userInfo;
Box setting = GStorage.setting;
late final StreamController<bool> searchBarStream =
StreamController<bool>.broadcast();
late bool hideSearchBar;
@ -33,7 +34,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
super.onInit();
userInfo = userInfoCache.get('userInfoCache');
userLogin.value = userInfo != null;
userFace.value = userInfo != null ? userInfo.face : '';
userFace.value = userInfo != null ? userInfo!.face! : '';
hideSearchBar =
setting.get(SettingBoxKey.hideSearchBar, defaultValue: false);
if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
@ -62,7 +63,7 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
userInfo = await userInfoCache.get('userInfoCache');
userLogin.value = val ?? false;
if (val) return;
userFace.value = userInfo != null ? userInfo.face : '';
userFace.value = userInfo != null ? userInfo!.face! : '';
}
void setTabConfig() async {

View File

@ -54,7 +54,6 @@ class _HomePageState extends State<HomePage>
backgroundColor: Colors.transparent,
appBar: AppBar(
toolbarHeight: 0,
elevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: Platform.isAndroid
? SystemUiOverlayStyle(

View File

@ -3,16 +3,17 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
class HomeAppBar extends StatelessWidget {
const HomeAppBar({super.key});
@override
Widget build(BuildContext context) {
var userInfo = userInfoCache.get('userInfoCache');
final UserInfoData? userInfo = userInfoCache.get('userInfoCache');
return SliverAppBar(
// forceElevated: true,
scrolledUnderElevation: 0,
@ -28,7 +29,6 @@ class HomeAppBar extends StatelessWidget {
background: Column(
children: [
AppBar(
centerTitle: false,
title: const Text(
'PiLiPaLa',
style: TextStyle(
@ -73,8 +73,6 @@ class HomeAppBar extends StatelessWidget {
const SizedBox(width: 10)
],
elevation: 0,
scrolledUnderElevation: 0,
),
],
),

View File

@ -25,7 +25,7 @@ class HtmlRenderController extends GetxController {
ReplySortType _sortType = ReplySortType.time;
RxString sortTypeTitle = ReplySortType.time.titles.obs;
RxString sortTypeLabel = ReplySortType.time.labels.obs;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
@override
void onInit() {

View File

@ -104,14 +104,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
int rpid = replyItem.rpid!;
Get.to(
() => Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('评论详情')),
body: VideoReplyReplyPanel(
oid: oid,
rpid: rpid,
@ -127,12 +120,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
title,
style: Theme.of(context).textTheme.titleMedium,
),
title: Text(title),
actions: [
const SizedBox(width: 4),
IconButton(

View File

@ -13,7 +13,7 @@ class LaterController extends GetxController {
RxList<HotVideoItemModel> laterList = <HotVideoItemModel>[].obs;
int count = 0;
RxBool isLoading = false.obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
@override

View File

@ -28,18 +28,12 @@ class _LaterPageState extends State<LaterPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => _laterController.laterList.isNotEmpty
? Text(
'稍后再看 (${_laterController.laterList.length})',
style: Theme.of(context).textTheme.titleMedium,
)
: Text(
'稍后再看',
style: Theme.of(context).textTheme.titleMedium,
),
: const Text('稍后再看'),
),
actions: [
Obx(

View File

@ -17,7 +17,7 @@ class LiveController extends GetxController {
RxInt liveFollowingCount = 0.obs;
bool flag = false;
OverlayEntry? popupDialog;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
@override
void onInit() {

View File

@ -7,7 +7,7 @@ import 'package:pilipala/utils/storage.dart';
class LiveFollowController extends GetxController {
RxInt crossAxisCount = 2.obs;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
int _currentPage = 1;
RxInt liveFollowingCount = 0.obs;
RxList<LiveFollowingItemModel> liveFollowingList =

View File

@ -42,13 +42,8 @@ class _LiveFollowPageState extends State<LiveFollowPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Obx(() => Text(
'${_liveFollowController.liveFollowingCount}人正在直播中',
style: Theme.of(context).textTheme.titleMedium,
)),
),
body: Container(

View File

@ -33,7 +33,7 @@ class LiveRoomController extends GetxController {
int? tempCurrentQn;
late List<Map<String, dynamic>> acceptQnList;
RxString currentQnDesc = ''.obs;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
int userId = 0;
PlSocket? plSocket;
List<String> danmuHostList = [];

View File

@ -259,8 +259,6 @@ class _LiveRoomPageState extends State<LiveRoomPage>
left: 0,
right: 0,
child: AppBar(
centerTitle: false,
titleSpacing: 0,
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
toolbarHeight: isPortrait ? 56 : 0,

View File

@ -35,7 +35,7 @@ class _BottomControlState extends State<BottomControl> {
TextStyle subTitleStyle = const TextStyle(fontSize: 12);
TextStyle titleStyle = const TextStyle(fontSize: 14);
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
@override
void initState() {
@ -47,10 +47,7 @@ class _BottomControlState extends State<BottomControl> {
return AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
primary: false,
centerTitle: false,
automaticallyImplyLeading: false,
titleSpacing: 14,
title: Row(

View File

@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/http/common.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:pilipala/utils/utils.dart';
import '../../models/common/dynamic_badge_mode.dart';
@ -20,13 +21,13 @@ class MainController extends GetxController {
late List<int> navBarSort;
final StreamController<bool> bottomBarStream =
StreamController<bool>.broadcast();
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
DateTime? _lastPressedAt;
late bool hideTabBar;
late PageController pageController;
int selectedIndex = 0;
Box userInfoCache = GStrorage.userInfo;
dynamic userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
RxBool userLogin = false.obs;
late Rx<DynamicBadgeMode> dynamicBadgeType = DynamicBadgeMode.number.obs;
late bool enableGradientBg;
@ -85,7 +86,7 @@ class MainController extends GetxController {
}
if (mineItemIndex != -1 && userInfo != null) {
Widget avatar = NetworkImgLayer(
width: 28, height: 28, src: userInfo.face, type: 'avatar');
width: 28, height: 28, src: userInfo!.face, type: 'avatar');
navigationBars[mineItemIndex]['icon'] = avatar;
navigationBars[mineItemIndex]['selectIcon'] = avatar;
}

View File

@ -30,7 +30,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
late MineController _mineController;
int? _lastSelectTime; //上次点击时间
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late bool enableMYBar;
@override
@ -113,19 +113,19 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
@override
void dispose() async {
await GStrorage.close();
await GStorage.close();
EventBus().off(EventName.loginEvent);
super.dispose();
}
@override
Widget build(BuildContext context) {
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
double statusBarHeight = MediaQuery.of(context).padding.top;
double sheetHeight = MediaQuery.sizeOf(context).height -
MediaQuery.of(context).padding.top -
MediaQuery.sizeOf(context).width * 9 / 16;
GlobalDataCache().sheetHeight = sheetHeight;
GlobalDataCache.sheetHeight = sheetHeight;
localCache.put('sheetHeight', sheetHeight);
localCache.put('statusBarHeight', statusBarHeight);

View File

@ -9,6 +9,7 @@ import 'package:pilipala/models/member/archive.dart';
import 'package:pilipala/models/member/coin.dart';
import 'package:pilipala/models/member/info.dart';
import 'package:pilipala/models/member/like.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
import 'package:share_plus/share_plus.dart';
@ -18,11 +19,11 @@ class MemberController extends GetxController {
late Map userStat;
RxString face = ''.obs;
String? heroTag;
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
late int ownerMid;
// 投稿列表
RxList<VListItemModel>? archiveList = <VListItemModel>[].obs;
dynamic userInfo;
UserInfoData? userInfo;
RxInt attribute = (-1).obs;
RxString attributeText = '关注'.obs;
RxList<MemberCoinsDataModel> recentCoinsList = <MemberCoinsDataModel>[].obs;
@ -34,7 +35,7 @@ class MemberController extends GetxController {
super.onInit();
mid = int.tryParse(Get.parameters['mid']!) ?? -2;
userInfo = userInfoCache.get('userInfoCache');
ownerMid = userInfo != null ? userInfo.mid : -1;
ownerMid = userInfo != null ? userInfo!.mid! : -1;
isOwner.value = mid == ownerMid;
face.value = Get.arguments['face'] ?? '';
heroTag = Get.arguments['heroTag'] ?? '';

View File

@ -122,7 +122,7 @@ class ProfilePanel extends StatelessWidget {
),
child: Row(children: [
Image.asset(
'assets/images/live.gif',
'assets/images/live.png',
height: 10,
),
Text(

View File

@ -28,9 +28,8 @@ class MemberArchiveController extends GetxController {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
currentOrder.value = orderList.first;
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -47,12 +47,9 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'${_memberArchivesController.isOwner.value ? '' : 'Ta'}的投稿 - ${_memberArchivesController.currentOrder['label']}',
style: Theme.of(context).textTheme.titleMedium,
),
),
actions: [
@ -120,7 +117,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
}
} else {
return HttpError(
errMsg: snapshot.data['msg'],
errMsg: snapshot.data?['msg'] ?? '请求异常',
fn: () {},
);
}

View File

@ -20,9 +20,8 @@ class MemberArticleController extends GetxController {
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -48,12 +48,9 @@ class _MemberArticlePageState extends State<MemberArticlePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'${_memberArticleController.isOwner.value ? '' : 'Ta'}的图文',
style: Theme.of(context).textTheme.titleMedium,
),
),
),

View File

@ -20,7 +20,6 @@ class MemberCoinsItem extends StatelessWidget {
Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(coinItem.aid);
return Card(
elevation: 0,
clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero,
child: InkWell(

View File

@ -18,9 +18,8 @@ class MemberDynamicsController extends GetxController {
void onInit() {
super.onInit();
mid = int.parse(Get.parameters['mid']!);
ownerMid = GlobalDataCache().userInfo != null
? GlobalDataCache().userInfo!.mid!
: -1;
ownerMid =
GlobalDataCache.userInfo != null ? GlobalDataCache.userInfo!.mid! : -1;
isOwner.value = mid == -1 || mid == ownerMid;
}

View File

@ -54,12 +54,9 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'${_memberDynamicController.isOwner.value ? '' : 'Ta'}的动态',
style: Theme.of(context).textTheme.titleMedium,
),
),
),

View File

@ -49,7 +49,6 @@ class _MemberSearchPageState extends State<MemberSearchPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
onPressed: () => _memberSearchCtr.submit(),

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/member/seasons.dart';
import 'package:pilipala/utils/global_data_cache.dart';
class MemberSeasonsController extends GetxController {
final ScrollController scrollController = ScrollController();
@ -58,7 +59,7 @@ class MemberSeasonsController extends GetxController {
mid: mid,
seriesId: seriesId!,
pn: pn,
currentMid: 17340771,
currentMid: GlobalDataCache.userInfo?.mid ?? -1,
);
if (res['status']) {
seasonsList.addAll(res['data'].seriesList);

View File

@ -2,6 +2,8 @@ import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/skeleton/video_card_h.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'controller.dart';
import 'widgets/item.dart';
@ -41,12 +43,7 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(Get.parameters['seasonName']!,
style: Theme.of(context).textTheme.titleMedium),
),
appBar: AppBar(title: Text(Get.parameters['seasonName']!)),
body: Padding(
padding: const EdgeInsets.only(
left: StyleString.safeSpace,
@ -59,9 +56,9 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data != null) {
Map data = snapshot.data as Map;
Map? data = snapshot.data;
List list = _memberSeasonsController.seasonsList;
if (data['status']) {
if (data?['status']) {
return Obx(
() => list.isNotEmpty
? LayoutBuilder(
@ -87,16 +84,44 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
);
},
)
: const SizedBox(),
: const HttpError(
errMsg: '没有数据',
isInSliver: false,
isShowBtn: false,
),
);
} else {
return const SizedBox();
return HttpError(
errMsg: snapshot.data['msg'],
isInSliver: false,
fn: () {
setState(() {
_futureBuilderFuture =
_memberSeasonsController.onRefresh();
});
},
);
}
} else {
return const SizedBox();
return HttpError(
errMsg: snapshot.data['msg'] ?? '请求异常',
isInSliver: false,
fn: () {
setState(() {
_futureBuilderFuture =
_memberSeasonsController.onRefresh();
});
},
);
}
} else {
return const SizedBox();
return ListView.builder(
itemCount: 10,
shrinkWrap: true,
itemBuilder: (context, index) {
return const VideoCardHSkeleton();
},
);
}
},
),

View File

@ -47,9 +47,7 @@ class _MessageAtPageState extends State<MessageAtPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('@我的'),
),
appBar: AppBar(title: const Text('@我的')),
body: RefreshIndicator(
onRefresh: () async {
await _messageAtCtr.queryMessageAt(type: 'init');
@ -129,7 +127,7 @@ class AtItem extends StatelessWidget {
return InkWell(
onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type);
MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
},
child: Padding(
padding: const EdgeInsets.all(14),

View File

@ -47,9 +47,7 @@ class _MessageLikePageState extends State<MessageLikePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('收到的赞'),
),
appBar: AppBar(title: const Text('收到的赞')),
body: RefreshIndicator(
onRefresh: () async {
await _messageLikeCtr.queryMessageLike(type: 'init');
@ -127,7 +125,7 @@ class LikeItem extends StatelessWidget {
final String type = item.item!.type!;
return InkWell(
onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type);
MessageUtils.onClickMessage(context, uri, nativeUri, type, null);
},
child: Stack(
children: [

View File

@ -48,9 +48,7 @@ class _MessageReplyPageState extends State<MessageReplyPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('回复我的'),
),
appBar: AppBar(title: const Text('回复我的')),
body: RefreshIndicator(
onRefresh: () async {
await _messageReplyCtr.queryMessageReply(type: 'init');
@ -119,7 +117,7 @@ class ReplyItem extends StatelessWidget {
final String type = item.item!.type!;
return InkWell(
onTap: () async {
MessageUtils.onClickMessage(context, uri, nativeUri, type);
MessageUtils.onClickMessage(context, uri, nativeUri, type, item.item!);
},
child: Padding(
padding: const EdgeInsets.all(14),
@ -157,6 +155,9 @@ class ReplyItem extends StatelessWidget {
text: '回复了我的评论',
style: TextStyle(color: outline),
),
if (item.item!.type! == 'dynamic')
TextSpan(
text: '对我的动态发表了评论', style: TextStyle(color: outline)),
])),
const SizedBox(height: 6),
Text.rich(
@ -199,11 +200,32 @@ class ReplyItem extends StatelessWidget {
),
),
if (item.item!.type! == 'video')
NetworkImgLayer(
// NetworkImgLayer(
// width: 60,
// height: 60,
// src: item.item!.image,
// radius: 6,
// ),
Container(
width: 60,
height: 60,
src: item.item!.image,
radius: 6,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
child: Image.network(item.item!.image!, fit: BoxFit.cover),
),
if (item.item!.type! == 'dynamic')
Container(
width: 60,
height: 80,
padding: const EdgeInsets.all(4),
child: Text(
item.item!.title!,
maxLines: 4,
style: const TextStyle(fontSize: 12, letterSpacing: 0.3),
overflow: TextOverflow.ellipsis,
),
),
],
),

View File

@ -29,9 +29,7 @@ class _MessageSystemPageState extends State<MessageSystemPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('系统通知'),
),
appBar: AppBar(title: const Text('系统通知')),
body: RefreshIndicator(
onRefresh: () async {
await _messageSystemCtr.queryAndProcessMessages();

View File

@ -1,8 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:pilipala/http/dynamics.dart';
import 'package:pilipala/http/search.dart';
import 'package:pilipala/models/common/reply_type.dart';
import 'package:pilipala/models/dynamics/result.dart';
import 'package:pilipala/models/msg/reply.dart';
import 'package:pilipala/pages/dynamics/index.dart';
import 'package:pilipala/pages/video/detail/reply_reply/index.dart';
import 'package:pilipala/utils/app_scheme.dart';
import 'package:pilipala/utils/utils.dart';
@ -10,7 +14,12 @@ import 'package:pilipala/utils/utils.dart';
class MessageUtils {
// 回复我的、收到的赞点击
static void onClickMessage(
BuildContext context, Uri uri, Uri nativeUri, String type) async {
BuildContext context,
Uri uri,
Uri nativeUri,
String type,
ReplyContentItem? item,
) async {
final String path = uri.path;
final String bvid = path.split('/').last;
String? sourceType;
@ -24,8 +33,8 @@ class MessageUtils {
if (nativePath.contains('detail')) {
// 动态详情
sourceType = 'opus';
oid = nativePath.split('/')[3];
commentRootId = nativePath.split('/')[4];
oid = item?.subjectId!.toString() ?? nativePath.split('/')[3];
commentRootId = item?.sourceId!.toString() ?? nativePath.split('/')[4];
}
switch (type) {
case 'video':
@ -47,6 +56,7 @@ class MessageUtils {
}
break;
case 'reply':
case 'dynamic':
debugPrint('commentRootId: $oid, $commentRootId');
navigateToComment(
context,
@ -155,4 +165,14 @@ class MessageUtils {
}
return result;
}
// 跳转查看动态详情
static void navigateToDynamicDetail(String opusId) async {
DynamicsController dynamicsController = Get.put(DynamicsController());
var res = await DynamicsHttp.dynamicDetail(id: opusId);
if (res['status']) {
DynamicItemModel item = res['data'];
dynamicsController.pushDetail(item, 1);
}
}
}

View File

@ -17,8 +17,8 @@ class MineController extends GetxController {
Rx<UserInfoData> userInfo = UserInfoData().obs;
Rx<ThemeType> themeType = ThemeType.system.obs;
Rx<FavFolderData> favFolderData = FavFolderData().obs;
Box setting = GStrorage.setting;
Box userInfoCache = GStrorage.userInfo;
Box setting = GStorage.setting;
Box userInfoCache = GStorage.userInfo;
List menuList = [
{
'icon': Icons.history,

View File

@ -44,8 +44,6 @@ class _MinePageState extends State<MinePage>
super.build(context);
return Scaffold(
appBar: AppBar(
scrolledUnderElevation: 0,
elevation: 0,
actions: [
IconButton(
icon: const Icon(Icons.search_outlined),
@ -355,7 +353,8 @@ class _MinePageState extends State<MinePage>
itemBuilder: (context, index) {
if (flag && index == favFolderList.length) {
return Padding(
padding: const EdgeInsets.only(right: 14),
padding:
const EdgeInsets.only(right: 14, bottom: 70),
child: Center(
child: IconButton(
style: ButtonStyle(
@ -488,7 +487,7 @@ class FavFolderItem extends StatelessWidget {
child: NetworkImgLayer(
src: item!.cover,
width: 180,
height: 110,
height: MediaQuery.textScalerOf(context).scale(110),
),
),
),

View File

@ -3,17 +3,18 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/user.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
class MineEditController extends GetxController {
Box userInfoCache = GStrorage.userInfo;
Box userInfoCache = GStorage.userInfo;
final formKey = GlobalKey<FormState>();
final TextEditingController unameCtr = TextEditingController();
final TextEditingController useridCtr = TextEditingController();
final TextEditingController signCtr = TextEditingController();
final TextEditingController birthdayCtr = TextEditingController();
String? sex;
dynamic userInfo;
UserInfoData? userInfo;
@override
void onInit() {

View File

@ -23,9 +23,7 @@ class _MineEditPageState extends State<MineEditPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('编辑资料'),
),
appBar: AppBar(title: const Text('编辑资料')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: FutureBuilder(

View File

@ -14,7 +14,7 @@ class RankController extends GetxController with GetTickerProviderStateMixin {
late TabController tabController;
late List tabsCtrList;
late List<Widget> tabsPageList;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late final StreamController<bool> searchBarStream =
StreamController<bool>.broadcast();

View File

@ -38,7 +38,6 @@ class _RankPageState extends State<RankPage>
backgroundColor: Colors.transparent,
appBar: AppBar(
toolbarHeight: 0,
elevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: Platform.isAndroid
? SystemUiOverlayStyle(

View File

@ -14,7 +14,7 @@ class RcmdController extends GetxController {
// RxList<RecVideoItemModel> webVideoList = <RecVideoItemModel>[].obs;
bool isLoadingMore = true;
OverlayEntry? popupDialog;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
RxInt crossAxisCount = 2.obs;
late bool enableSaveLastData;
late String defaultRcmdType = 'web';

View File

@ -15,7 +15,7 @@ class SSearchController extends GetxController {
RxString searchKeyWord = ''.obs;
Rx<TextEditingController> controller = TextEditingController().obs;
RxList<HotSearchItem> hotSearchList = <HotSearchItem>[].obs;
Box localCache = GStrorage.localCache;
Box localCache = GStorage.localCache;
List historyCacheList = [];
RxList historyList = [].obs;
RxList<SearchSuggestItem> searchSuggestList = <SearchSuggestItem>[].obs;
@ -23,7 +23,7 @@ class SSearchController extends GetxController {
Debouncer(delay: const Duration(milliseconds: 200)); // 设置延迟时间
String hintText = '搜索';
RxString defaultSearch = ''.obs;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
bool enableHotKey = true;
bool enableSearchSuggest = true;
@ -43,10 +43,10 @@ class SSearchController extends GetxController {
hintText = hint;
}
}
historyCacheList = GlobalDataCache().historyCacheList;
historyCacheList = GlobalDataCache.historyCacheList;
historyList.value = historyCacheList;
enableHotKey = setting.get(SettingBoxKey.enableHotKey, defaultValue: true);
enableSearchSuggest = GlobalDataCache().enableSearchSuggest;
enableSearchSuggest = GlobalDataCache.enableSearchSuggest;
}
void onChange(value) {
@ -128,7 +128,7 @@ class SSearchController extends GetxController {
historyCacheList = [];
historyList.refresh();
localCache.put('cacheList', []);
GlobalDataCache().historyCacheList = [];
GlobalDataCache.historyCacheList = [];
SmartDialog.showToast('搜索历史已清空');
}
@ -139,7 +139,7 @@ class SSearchController extends GetxController {
historyList.value = historyCacheList;
historyList.refresh();
localCache.put('cacheList', historyCacheList);
GlobalDataCache().historyCacheList = historyCacheList;
GlobalDataCache.historyCacheList = historyCacheList;
searchFocusNode.unfocus();
}
}

View File

@ -49,7 +49,6 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
width: 1,
),
),
titleSpacing: 0,
actions: [
IconButton(
onPressed: () => _searchController.submit(),

View File

@ -51,8 +51,6 @@ class _SearchResultPageState extends State<SearchResultPage>
width: 1,
),
),
titleSpacing: 0,
centerTitle: false,
title: GestureDetector(
onTap: () => Get.back(),
child: SizedBox(

View File

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/init.dart';
import 'package:pilipala/models/common/theme_type.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/login.dart';
import 'package:pilipala/utils/storage.dart';
@ -13,16 +13,16 @@ import '../main/index.dart';
import 'widgets/select_dialog.dart';
class SettingController extends GetxController {
Box userInfoCache = GStrorage.userInfo;
Box setting = GStrorage.setting;
Box localCache = GStrorage.localCache;
Box userInfoCache = GStorage.userInfo;
Box setting = GStorage.setting;
Box localCache = GStorage.localCache;
RxBool userLogin = false.obs;
RxBool feedBackEnable = false.obs;
RxDouble toastOpacity = (1.0).obs;
RxInt picQuality = 10.obs;
Rx<ThemeType> themeType = ThemeType.system.obs;
var userInfo;
UserInfoData? userInfo;
Rx<DynamicBadgeMode> dynamicBadgeType = DynamicBadgeMode.number.obs;
RxInt defaultHomePage = 0.obs;

View File

@ -19,8 +19,8 @@ class ExtraSetting extends StatefulWidget {
}
class _ExtraSettingState extends State<ExtraSetting> {
Box setting = GStrorage.setting;
static Box localCache = GStrorage.localCache;
Box setting = GStorage.setting;
static Box localCache = GStorage.localCache;
late dynamic defaultReplySort;
late dynamic defaultDynamicType;
late dynamic enableSystemProxy;
@ -131,14 +131,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'其他设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('其他设置')),
body: ListView(
children: [
const SetSwitchItem(
@ -153,7 +146,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableSearchSuggest,
defaultVal: true,
callFn: (val) {
GlobalDataCache().enableSearchSuggest = val;
GlobalDataCache.enableSearchSuggest = val;
},
),
SetSwitchItem(
@ -188,7 +181,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableAutoExpand,
defaultVal: false,
callFn: (val) {
GlobalDataCache().enableAutoExpand = val;
GlobalDataCache.enableAutoExpand = val;
},
),
const SetSwitchItem(
@ -197,6 +190,15 @@ class _ExtraSettingState extends State<ExtraSetting> {
setKey: SettingBoxKey.enableRelatedVideo,
defaultVal: true,
),
SetSwitchItem(
title: '视频投屏开关',
subTitle: '打开后将在播放器右上角显示投屏入口',
setKey: SettingBoxKey.enableDlna,
defaultVal: false,
callFn: (bool val) {
GlobalDataCache.enableDlna = val;
},
),
ListTile(
dense: false,
title: Text('评论展示', style: titleStyle),

View File

@ -13,7 +13,7 @@ class ActionMenuSetPage extends StatefulWidget {
}
class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late List<String> actionTypeSort;
late List<Map> allLabels;
@ -38,7 +38,7 @@ class _ActionMenuSetPageState extends State<ActionMenuSetPage> {
.map<String>((i) => (i['value'] as ActionType).value)
.toList();
setting.put(SettingBoxKey.actionTypeSort, sortedTabbar);
GlobalDataCache().actionTypeSort = sortedTabbar;
GlobalDataCache.actionTypeSort = sortedTabbar;
SmartDialog.showToast('操作成功');
}

View File

@ -38,10 +38,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: const Text('选择应用主题'),
),
appBar: AppBar(title: const Text('选择应用主题')),
body: ListView(
children: [
Obx(
@ -142,7 +139,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
}
class ColorSelectController extends GetxController {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
RxBool dynamicColor = true.obs;
RxInt type = 0.obs;
late final List<Map<String, dynamic>> colorThemes;

View File

@ -16,7 +16,7 @@ class _SetDiaplayModeState extends State<SetDiaplayMode> {
List<DisplayMode> modes = <DisplayMode>[];
DisplayMode? active;
DisplayMode? preferred;
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
final ValueNotifier<int> page = ValueNotifier<int>(0);
late final PageController controller = PageController()

View File

@ -11,7 +11,7 @@ class FontSizeSelectPage extends StatefulWidget {
}
class _FontSizeSelectPageState extends State<FontSizeSelectPage> {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
List<double> list = [0.9, 0.95, 1.0, 1.05, 1.1, 1.15, 1.2, 1.25, 1.3];
late double minsize;
late double maxSize;

View File

@ -12,7 +12,7 @@ class TabbarSetPage extends StatefulWidget {
}
class _TabbarSetPageState extends State<TabbarSetPage> {
Box settingStorage = GStrorage.setting;
Box settingStorage = GStorage.setting;
late List defaultTabs;
late List<String> tabbarSort;

View File

@ -100,9 +100,7 @@ class _LogsPageState extends State<LogsPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text('日志', style: Theme.of(context).textTheme.titleMedium),
title: const Text('日志'),
actions: [
PopupMenuButton<String>(
onSelected: (String type) {

View File

@ -13,7 +13,7 @@ class NavigationBarSetPage extends StatefulWidget {
}
class _NavigationbarSetPageState extends State<NavigationBarSetPage> {
Box settingStorage = GStrorage.setting;
Box settingStorage = GStorage.setting;
late List defaultNavTabs;
late List<int> navBarSort;

View File

@ -16,7 +16,7 @@ class PlayGesturePage extends StatefulWidget {
}
class _PlayGesturePageState extends State<PlayGesturePage> {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late int fullScreenGestureMode;
@override
@ -34,14 +34,7 @@ class _PlayGesturePageState extends State<PlayGesturePage> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'手势设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('手势设置')),
body: ListView(
children: [
ListTile(
@ -65,11 +58,11 @@ class _PlayGesturePageState extends State<PlayGesturePage> {
},
);
if (result != null) {
GlobalDataCache().fullScreenGestureMode = FullScreenGestureMode
GlobalDataCache.fullScreenGestureMode = FullScreenGestureMode
.values
.firstWhere((element) => element.values == result);
fullScreenGestureMode =
GlobalDataCache().fullScreenGestureMode.index;
GlobalDataCache.fullScreenGestureMode.index;
setting.put(
SettingBoxKey.fullScreenGestureMode, fullScreenGestureMode);
SmartDialog.showToast('设置成功');

View File

@ -14,8 +14,8 @@ class PlaySpeedPage extends StatefulWidget {
}
class _PlaySpeedPageState extends State<PlaySpeedPage> {
Box videoStorage = GStrorage.video;
Box settingStorage = GStrorage.setting;
Box videoStorage = GStorage.video;
Box settingStorage = GStorage.setting;
late double playSpeedDefault;
late List<double> playSpeedSystem;
late double longPressSpeedDefault;
@ -204,16 +204,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Text(
'倍速设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('倍速设置')),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@ -23,7 +23,7 @@ class PlaySetting extends StatefulWidget {
}
class _PlaySettingState extends State<PlaySetting> {
Box setting = GStrorage.setting;
Box setting = GStorage.setting;
late dynamic defaultVideoQa;
late dynamic defaultLiveQa;
late dynamic defaultAudioQa;
@ -67,14 +67,7 @@ class _PlaySettingState extends State<PlaySetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'播放设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('播放设置')),
body: ListView(
children: [
ListTile(
@ -162,7 +155,7 @@ class _PlaySettingState extends State<PlaySetting> {
setKey: SettingBoxKey.enablePlayerControlAnimation,
defaultVal: true,
callFn: (bool val) {
GlobalDataCache().enablePlayerControlAnimation = val;
GlobalDataCache.enablePlayerControlAnimation = val;
}),
SetSwitchItem(
title: '港澳台模式',

View File

@ -3,6 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/utils/storage.dart';
class PrivacySetting extends StatefulWidget {
@ -14,8 +15,8 @@ class PrivacySetting extends StatefulWidget {
class _PrivacySettingState extends State<PrivacySetting> {
bool userLogin = false;
Box userInfoCache = GStrorage.userInfo;
var userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
@override
void initState() {
@ -32,14 +33,7 @@ class _PrivacySettingState extends State<PrivacySetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'隐私设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('隐私设置')),
body: Column(
children: [
ListTile(

View File

@ -3,6 +3,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/http/member.dart';
import 'package:pilipala/models/common/rcmd_type.dart';
import 'package:pilipala/models/user/info.dart';
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
import 'package:pilipala/utils/recommend_filter.dart';
import 'package:pilipala/utils/storage.dart';
@ -17,11 +18,11 @@ class RecommendSetting extends StatefulWidget {
}
class _RecommendSettingState extends State<RecommendSetting> {
Box setting = GStrorage.setting;
static Box localCache = GStrorage.localCache;
Box setting = GStorage.setting;
static Box localCache = GStorage.localCache;
late dynamic defaultRcmdType;
Box userInfoCache = GStrorage.userInfo;
late dynamic userInfo;
Box userInfoCache = GStorage.userInfo;
UserInfoData? userInfo;
bool userLogin = false;
late dynamic accessKeyInfo;
// late int filterUnfollowedRatio;
@ -53,14 +54,7 @@ class _RecommendSettingState extends State<RecommendSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'推荐设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: const Text('推荐设置')),
body: ListView(
children: [
ListTile(
@ -247,10 +241,9 @@ class _RecommendSettingState extends State<RecommendSetting> {
'* 其它(如热门视频、手动搜索、链接跳转等)均不受过滤器影响。\n'
'* 设定较严苛的条件可导致推荐项数锐减或多次请求,请酌情选择。\n'
'* 后续可能会增加更多过滤条件,敬请期待。',
style: Theme.of(context)
.textTheme
.labelSmall!
.copyWith(color: Theme.of(context).colorScheme.outline.withOpacity(0.7)),
style: Theme.of(context).textTheme.labelSmall!.copyWith(
color:
Theme.of(context).colorScheme.outline.withOpacity(0.7)),
),
)
],

Some files were not shown because too many files have changed in this diff Show More