Compare commits
7 Commits
feature-em
...
alpha
Author | SHA1 | Date | |
---|---|---|---|
df2cb00112 | |||
835ea0a9ff | |||
89501d3daa | |||
90c0256766 | |||
c2767486f5 | |||
e2befb11ff | |||
b0166d6657 |
@ -2,6 +2,7 @@ import 'package:cached_network_image/cached_network_image.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/utils/extension.dart';
|
import 'package:pilipala/utils/extension.dart';
|
||||||
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
import '../../utils/storage.dart';
|
import '../../utils/storage.dart';
|
||||||
import '../constants.dart';
|
import '../constants.dart';
|
||||||
|
|
||||||
@ -32,8 +33,10 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final int defaultImgQuality = GlobalData().imgQuality;
|
||||||
final String imageUrl =
|
final String imageUrl =
|
||||||
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? 100}q.webp';
|
'${src!.startsWith('//') ? 'https:${src!}' : src!}@${quality ?? defaultImgQuality}q.webp';
|
||||||
|
print(imageUrl);
|
||||||
int? memCacheWidth, memCacheHeight;
|
int? memCacheWidth, memCacheHeight;
|
||||||
double aspectRatio = (width / height).toDouble();
|
double aspectRatio = (width / height).toDouble();
|
||||||
|
|
||||||
@ -81,7 +84,7 @@ class NetworkImgLayer extends StatelessWidget {
|
|||||||
fadeOutDuration ?? const Duration(milliseconds: 120),
|
fadeOutDuration ?? const Duration(milliseconds: 120),
|
||||||
fadeInDuration:
|
fadeInDuration:
|
||||||
fadeInDuration ?? const Duration(milliseconds: 120),
|
fadeInDuration ?? const Duration(milliseconds: 120),
|
||||||
filterQuality: FilterQuality.high,
|
filterQuality: FilterQuality.low,
|
||||||
errorWidget: (BuildContext context, String url, Object error) =>
|
errorWidget: (BuildContext context, String url, Object error) =>
|
||||||
placeholder(context),
|
placeholder(context),
|
||||||
placeholder: (BuildContext context, String url) =>
|
placeholder: (BuildContext context, String url) =>
|
||||||
|
@ -201,11 +201,11 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
var cleanStatus = await CacheManage().clearCacheAll();
|
var cleanStatus = await CacheManage().clearCacheAll();
|
||||||
if (cleanStatus) {
|
if (cleanStatus) {
|
||||||
getCacheSize();
|
getCacheSize();
|
||||||
|
SmartDialog.showToast('清除成功');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: const Text('清除缓存'),
|
title: const Text('清除缓存'),
|
||||||
subtitle: Text('图片及网络缓存 $cacheSize', style: subTitleStyle),
|
subtitle: Text('图片及网络缓存 $cacheSize', style: subTitleStyle),
|
||||||
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
|
||||||
),
|
),
|
||||||
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
SizedBox(height: MediaQuery.of(context).padding.bottom + 20)
|
||||||
],
|
],
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/common/dynamics_type.dart';
|
import 'package:pilipala/models/common/dynamics_type.dart';
|
||||||
import 'package:pilipala/models/common/reply_sort_type.dart';
|
import 'package:pilipala/models/common/reply_sort_type.dart';
|
||||||
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
|
import '../home/index.dart';
|
||||||
import 'widgets/switch_item.dart';
|
import 'widgets/switch_item.dart';
|
||||||
|
|
||||||
class ExtraSetting extends StatefulWidget {
|
class ExtraSetting extends StatefulWidget {
|
||||||
@ -138,18 +140,20 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '大家都在搜',
|
title: '大家都在搜',
|
||||||
subTitle: '是否展示「大家都在搜」',
|
subTitle: '是否展示「大家都在搜」',
|
||||||
setKey: SettingBoxKey.enableHotKey,
|
setKey: SettingBoxKey.enableHotKey,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
callFn: (val) => {SmartDialog.showToast('下次启动时生效')},
|
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
SetSwitchItem(
|
||||||
title: '搜索默认词',
|
title: '搜索默认词',
|
||||||
subTitle: '是否展示搜索框默认词',
|
subTitle: '是否展示搜索框默认词',
|
||||||
setKey: SettingBoxKey.enableSearchWord,
|
setKey: SettingBoxKey.enableSearchWord,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
|
callFn: (val) {
|
||||||
|
Get.find<HomeController>().defaultSearch.value = '';
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SetSwitchItem(
|
const SetSwitchItem(
|
||||||
title: '快速收藏',
|
title: '快速收藏',
|
||||||
|
@ -8,6 +8,7 @@ import 'package:pilipala/models/common/theme_type.dart';
|
|||||||
import 'package:pilipala/pages/setting/pages/color_select.dart';
|
import 'package:pilipala/pages/setting/pages/color_select.dart';
|
||||||
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
import 'package:pilipala/pages/setting/widgets/select_dialog.dart';
|
||||||
import 'package:pilipala/pages/setting/widgets/slide_dialog.dart';
|
import 'package:pilipala/pages/setting/widgets/slide_dialog.dart';
|
||||||
|
import 'package:pilipala/utils/global_data.dart';
|
||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
|
|
||||||
import '../../models/common/dynamic_badge_mode.dart';
|
import '../../models/common/dynamic_badge_mode.dart';
|
||||||
@ -176,6 +177,8 @@ class _StyleSettingState extends State<StyleSetting> {
|
|||||||
SettingBoxKey.defaultPicQa, picQuality);
|
SettingBoxKey.defaultPicQa, picQuality);
|
||||||
Get.back();
|
Get.back();
|
||||||
settingController.picQuality.value = picQuality;
|
settingController.picQuality.value = picQuality;
|
||||||
|
GlobalData().imgQuality = picQuality;
|
||||||
|
SmartDialog.showToast('设置成功');
|
||||||
},
|
},
|
||||||
child: const Text('确定'),
|
child: const Text('确定'),
|
||||||
)
|
)
|
||||||
|
@ -2,7 +2,6 @@ import 'package:easy_debounce/easy_throttle.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:pilipala/common/widgets/http_error.dart';
|
import 'package:pilipala/common/widgets/http_error.dart';
|
||||||
import 'package:pilipala/pages/fav/widgets/item.dart';
|
|
||||||
import 'controller.dart';
|
import 'controller.dart';
|
||||||
import 'widgets/item.dart';
|
import 'widgets/item.dart';
|
||||||
|
|
||||||
|
@ -19,6 +19,8 @@ import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
|||||||
import 'package:pilipala/utils/storage.dart';
|
import 'package:pilipala/utils/storage.dart';
|
||||||
import 'package:pilipala/http/danmaku.dart';
|
import 'package:pilipala/http/danmaku.dart';
|
||||||
import 'package:pilipala/services/shutdown_timer_service.dart';
|
import 'package:pilipala/services/shutdown_timer_service.dart';
|
||||||
|
import '../../../../models/video_detail_res.dart';
|
||||||
|
import '../introduction/index.dart';
|
||||||
|
|
||||||
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
||||||
const HeaderControl({
|
const HeaderControl({
|
||||||
@ -48,11 +50,31 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
final Box<dynamic> videoStorage = GStrorage.video;
|
final Box<dynamic> videoStorage = GStrorage.video;
|
||||||
late List<double> speedsList;
|
late List<double> speedsList;
|
||||||
double buttonSpace = 8;
|
double buttonSpace = 8;
|
||||||
|
bool showTitle = false;
|
||||||
|
late String heroTag;
|
||||||
|
late VideoIntroController videoIntroController;
|
||||||
|
late VideoDetailData videoDetail;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
videoInfo = widget.videoDetailCtr!.data;
|
videoInfo = widget.videoDetailCtr!.data;
|
||||||
speedsList = widget.controller!.speedsList;
|
speedsList = widget.controller!.speedsList;
|
||||||
|
fullScreenStatusListener();
|
||||||
|
heroTag = Get.arguments['heroTag'];
|
||||||
|
videoIntroController = Get.put(VideoIntroController(), tag: heroTag);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fullScreenStatusListener() {
|
||||||
|
widget.videoDetailCtr!.plPlayerController.isFullScreen
|
||||||
|
.listen((bool isFullScreen) {
|
||||||
|
if (isFullScreen) {
|
||||||
|
showTitle = true;
|
||||||
|
} else {
|
||||||
|
showTitle = false;
|
||||||
|
}
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置面板
|
/// 设置面板
|
||||||
@ -342,8 +364,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
},
|
},
|
||||||
dense: true,
|
dense: true,
|
||||||
contentPadding: const EdgeInsets.only(),
|
contentPadding: const EdgeInsets.only(),
|
||||||
title:
|
title: const Text("额外等待视频播放完毕", style: titleStyle),
|
||||||
const Text("额外等待视频播放完毕", style: titleStyle),
|
|
||||||
trailing: Switch(
|
trailing: Switch(
|
||||||
// thumb color (round icon)
|
// thumb color (round icon)
|
||||||
activeColor: Theme.of(context).colorScheme.primary,
|
activeColor: Theme.of(context).colorScheme.primary,
|
||||||
@ -1047,6 +1068,8 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
);
|
);
|
||||||
|
final bool isLandscape =
|
||||||
|
MediaQuery.of(context).orientation == Orientation.landscape;
|
||||||
return AppBar(
|
return AppBar(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
@ -1081,6 +1104,31 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: buttonSpace),
|
SizedBox(width: buttonSpace),
|
||||||
|
if (showTitle && isLandscape) ...[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: 200),
|
||||||
|
child: Text(
|
||||||
|
videoIntroController.videoDetail.value.title!,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (videoIntroController.isShowOnlineTotal)
|
||||||
|
Text(
|
||||||
|
'${videoIntroController.total.value}人正在看',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
] else ...[
|
||||||
ComBtn(
|
ComBtn(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
FontAwesomeIcons.house,
|
FontAwesomeIcons.house,
|
||||||
@ -1096,6 +1144,7 @@ class _HeaderControlState extends State<HeaderControl> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
],
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// ComBtn(
|
// ComBtn(
|
||||||
// icon: const Icon(
|
// icon: const Icon(
|
||||||
|
12
lib/utils/global_data.dart
Normal file
12
lib/utils/global_data.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
class GlobalData {
|
||||||
|
int imgQuality = 10;
|
||||||
|
|
||||||
|
// 私有构造函数
|
||||||
|
GlobalData._();
|
||||||
|
|
||||||
|
// 单例实例
|
||||||
|
static final GlobalData _instance = GlobalData._();
|
||||||
|
|
||||||
|
// 获取全局实例
|
||||||
|
factory GlobalData() => _instance;
|
||||||
|
}
|
@ -1,11 +1,10 @@
|
|||||||
// import 'package:hive/hive.dart';
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:hive_flutter/hive_flutter.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:pilipala/models/model_owner.dart';
|
import 'package:pilipala/models/model_owner.dart';
|
||||||
import 'package:pilipala/models/search/hot.dart';
|
import 'package:pilipala/models/search/hot.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
|
import 'global_data.dart';
|
||||||
|
|
||||||
class GStrorage {
|
class GStrorage {
|
||||||
static late final Box<dynamic> userInfo;
|
static late final Box<dynamic> userInfo;
|
||||||
@ -44,6 +43,8 @@ class GStrorage {
|
|||||||
);
|
);
|
||||||
// 视频设置
|
// 视频设置
|
||||||
video = await Hive.openBox('video');
|
video = await Hive.openBox('video');
|
||||||
|
GlobalData().imgQuality =
|
||||||
|
setting.get(SettingBoxKey.defaultPicQa, defaultValue: 10); // 设置全局变量
|
||||||
}
|
}
|
||||||
|
|
||||||
static void regAdapter() {
|
static void regAdapter() {
|
||||||
|
Reference in New Issue
Block a user