mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-14 05:03:57 +08:00
@@ -34,23 +34,4 @@ abstract final class Assets {
|
||||
static const right = 'assets/images/paycoins/ic_right.png';
|
||||
static const rightDisable = 'assets/images/paycoins/ic_right_disable.png';
|
||||
static const panelClose = 'assets/images/paycoins/ic_panel_close.png';
|
||||
|
||||
static const List<String> mpvAnime4KShaders = [
|
||||
'Anime4K_Clamp_Highlights.glsl',
|
||||
'Anime4K_Restore_CNN_VL.glsl',
|
||||
'Anime4K_Upscale_CNN_x2_VL.glsl',
|
||||
'Anime4K_AutoDownscalePre_x2.glsl',
|
||||
'Anime4K_AutoDownscalePre_x4.glsl',
|
||||
'Anime4K_Upscale_CNN_x2_M.glsl',
|
||||
];
|
||||
|
||||
static const mpvAnime4KShadersLite = [
|
||||
'Anime4K_Clamp_Highlights.glsl',
|
||||
'Anime4K_Restore_CNN_M.glsl',
|
||||
'Anime4K_Restore_CNN_S.glsl',
|
||||
'Anime4K_Upscale_CNN_x2_M.glsl',
|
||||
'Anime4K_AutoDownscalePre_x2.glsl',
|
||||
'Anime4K_AutoDownscalePre_x4.glsl',
|
||||
'Anime4K_Upscale_CNN_x2_S.glsl',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,220 +0,0 @@
|
||||
abstract final class Login {
|
||||
//内容来自 https://passport.bilibili.com/web/generic/country/list
|
||||
static const dialPrefix = [
|
||||
(id: 1, cname: "中国大陆", countryId: 86),
|
||||
(id: 5, cname: "中国香港特别行政区", countryId: 852),
|
||||
(id: 2, cname: "中国澳门特别行政区", countryId: 853),
|
||||
(id: 3, cname: "中国台湾", countryId: 886),
|
||||
(id: 4, cname: "美国", countryId: 1),
|
||||
(id: 6, cname: "比利时", countryId: 32),
|
||||
(id: 7, cname: "澳大利亚", countryId: 61),
|
||||
(id: 8, cname: "法国", countryId: 33),
|
||||
(id: 9, cname: "加拿大", countryId: 1),
|
||||
(id: 10, cname: "日本", countryId: 81),
|
||||
(id: 11, cname: "新加坡", countryId: 65),
|
||||
(id: 12, cname: "韩国", countryId: 82),
|
||||
(id: 13, cname: "马来西亚", countryId: 60),
|
||||
(id: 14, cname: "英国", countryId: 44),
|
||||
(id: 15, cname: "意大利", countryId: 39),
|
||||
(id: 16, cname: "德国", countryId: 49),
|
||||
(id: 18, cname: "俄罗斯", countryId: 7),
|
||||
(id: 19, cname: "新西兰", countryId: 64),
|
||||
(id: 153, cname: "瓦利斯群岛和富图纳群岛", countryId: 1681),
|
||||
(id: 152, cname: "葡萄牙", countryId: 351),
|
||||
(id: 151, cname: "帕劳", countryId: 680),
|
||||
(id: 150, cname: "诺福克岛", countryId: 672),
|
||||
(id: 149, cname: "挪威", countryId: 47),
|
||||
(id: 148, cname: "纽埃岛", countryId: 683),
|
||||
(id: 147, cname: "尼日利亚", countryId: 234),
|
||||
(id: 146, cname: "尼日尔", countryId: 227),
|
||||
(id: 145, cname: "尼加拉瓜", countryId: 505),
|
||||
(id: 144, cname: "尼泊尔", countryId: 977),
|
||||
(id: 143, cname: "瑙鲁", countryId: 674),
|
||||
(id: 154, cname: "格鲁吉亚", countryId: 995),
|
||||
(id: 155, cname: "瑞典", countryId: 46),
|
||||
(id: 165, cname: "沙特阿拉伯", countryId: 966),
|
||||
(id: 164, cname: "桑给巴尔岛", countryId: 259),
|
||||
(id: 163, cname: "塞舌尔共和国", countryId: 248),
|
||||
(id: 162, cname: "塞浦路斯", countryId: 357),
|
||||
(id: 161, cname: "塞内加尔", countryId: 221),
|
||||
(id: 160, cname: "塞拉利昂", countryId: 232),
|
||||
(id: 159, cname: "萨摩亚,东部", countryId: 684),
|
||||
(id: 158, cname: "萨摩亚,西部", countryId: 685),
|
||||
(id: 157, cname: "萨尔瓦多", countryId: 503),
|
||||
(id: 156, cname: "瑞士", countryId: 41),
|
||||
(id: 166, cname: "圣多美和普林西比", countryId: 239),
|
||||
(id: 142, cname: "塞尔维亚", countryId: 381),
|
||||
(id: 141, cname: "南非", countryId: 27),
|
||||
(id: 128, cname: "毛里塔尼亚", countryId: 222),
|
||||
(id: 127, cname: "毛里求斯", countryId: 230),
|
||||
(id: 126, cname: "马歇尔岛", countryId: 692),
|
||||
(id: 125, cname: "马提尼克岛", countryId: 596),
|
||||
(id: 124, cname: "马其顿", countryId: 389),
|
||||
(id: 123, cname: "马里亚纳岛", countryId: 1670),
|
||||
(id: 122, cname: "马里", countryId: 223),
|
||||
(id: 121, cname: "马拉维", countryId: 265),
|
||||
(id: 120, cname: "马耳他", countryId: 356),
|
||||
(id: 119, cname: "马尔代夫", countryId: 960),
|
||||
(id: 129, cname: "蒙古", countryId: 976),
|
||||
(id: 130, cname: "蒙特塞拉特岛", countryId: 1664),
|
||||
(id: 140, cname: "纳米比亚", countryId: 264),
|
||||
(id: 139, cname: "墨西哥", countryId: 52),
|
||||
(id: 138, cname: "莫桑比克", countryId: 258),
|
||||
(id: 137, cname: "摩纳哥", countryId: 377),
|
||||
(id: 136, cname: "摩洛哥", countryId: 212),
|
||||
(id: 135, cname: "摩尔多瓦", countryId: 373),
|
||||
(id: 134, cname: "缅甸", countryId: 95),
|
||||
(id: 133, cname: "密克罗尼西亚", countryId: 691),
|
||||
(id: 132, cname: "秘鲁", countryId: 51),
|
||||
(id: 131, cname: "孟加拉国", countryId: 880),
|
||||
(id: 118, cname: "马达加斯加", countryId: 261),
|
||||
(id: 167, cname: "圣卢西亚", countryId: 1784),
|
||||
(id: 216, cname: "智利", countryId: 56),
|
||||
(id: 203, cname: "牙买加", countryId: 1876),
|
||||
(id: 202, cname: "叙利亚", countryId: 963),
|
||||
(id: 201, cname: "匈牙利", countryId: 36),
|
||||
(id: 200, cname: "科特迪瓦", countryId: 225),
|
||||
(id: 199, cname: "希腊", countryId: 30),
|
||||
(id: 198, cname: "西班牙", countryId: 34),
|
||||
(id: 197, cname: "乌兹别克斯坦", countryId: 998),
|
||||
(id: 196, cname: "乌拉圭", countryId: 598),
|
||||
(id: 195, cname: "乌克兰", countryId: 380),
|
||||
(id: 194, cname: "乌干达", countryId: 256),
|
||||
(id: 204, cname: "亚美尼亚", countryId: 374),
|
||||
(id: 205, cname: "也门", countryId: 967),
|
||||
(id: 215, cname: "直布罗陀", countryId: 350),
|
||||
(id: 214, cname: "乍得", countryId: 235),
|
||||
(id: 213, cname: "赞比亚", countryId: 260),
|
||||
(id: 212, cname: "越南", countryId: 84),
|
||||
(id: 211, cname: "约旦", countryId: 962),
|
||||
(id: 210, cname: "印尼", countryId: 62),
|
||||
(id: 209, cname: "印度", countryId: 91),
|
||||
(id: 208, cname: "以色列", countryId: 972),
|
||||
(id: 207, cname: "伊朗", countryId: 98),
|
||||
(id: 206, cname: "伊拉克", countryId: 964),
|
||||
(id: 193, cname: "文莱", countryId: 673),
|
||||
(id: 192, cname: "委内瑞拉", countryId: 58),
|
||||
(id: 191, cname: "维珍群岛(英属)", countryId: 1284),
|
||||
(id: 178, cname: "泰国", countryId: 66),
|
||||
(id: 177, cname: "索马里", countryId: 252),
|
||||
(id: 176, cname: "所罗门群岛", countryId: 677),
|
||||
(id: 175, cname: "苏里南", countryId: 597),
|
||||
(id: 174, cname: "苏丹", countryId: 249),
|
||||
(id: 173, cname: "斯威士兰", countryId: 268),
|
||||
(id: 172, cname: "斯洛文尼亚", countryId: 386),
|
||||
(id: 171, cname: "斯洛伐克", countryId: 421),
|
||||
(id: 170, cname: "斯里兰卡", countryId: 94),
|
||||
(id: 169, cname: "圣皮埃尔和密克隆群岛", countryId: 508),
|
||||
(id: 179, cname: "坦桑尼亚", countryId: 255),
|
||||
(id: 180, cname: "汤加", countryId: 676),
|
||||
(id: 190, cname: "维珍群岛(美属)", countryId: 1340),
|
||||
(id: 189, cname: "瓦努阿图", countryId: 678),
|
||||
(id: 188, cname: "托克劳岛", countryId: 690),
|
||||
(id: 187, cname: "土库曼斯坦", countryId: 993),
|
||||
(id: 186, cname: "土耳其", countryId: 90),
|
||||
(id: 185, cname: "图瓦卢", countryId: 688),
|
||||
(id: 184, cname: "突尼斯", countryId: 216),
|
||||
(id: 183, cname: "阿森松岛", countryId: 247),
|
||||
(id: 182, cname: "特立尼达和多巴哥", countryId: 1868),
|
||||
(id: 181, cname: "特克斯和凯科斯", countryId: 1649),
|
||||
(id: 168, cname: "圣马力诺", countryId: 378),
|
||||
(id: 67, cname: "法属圭亚那", countryId: 594),
|
||||
(id: 54, cname: "不丹", countryId: 975),
|
||||
(id: 53, cname: "博茨瓦纳", countryId: 267),
|
||||
(id: 52, cname: "伯利兹", countryId: 501),
|
||||
(id: 51, cname: "玻利维亚", countryId: 591),
|
||||
(id: 50, cname: "波兰", countryId: 48),
|
||||
(id: 49, cname: "波黑", countryId: 387),
|
||||
(id: 48, cname: "波多黎各", countryId: 1787),
|
||||
(id: 47, cname: "冰岛", countryId: 354),
|
||||
(id: 46, cname: "贝宁", countryId: 229),
|
||||
(id: 45, cname: "保加利亚", countryId: 359),
|
||||
(id: 55, cname: "布基纳法索", countryId: 226),
|
||||
(id: 56, cname: "布隆迪", countryId: 257),
|
||||
(id: 66, cname: "法属波利尼西亚", countryId: 689),
|
||||
(id: 65, cname: "法罗岛", countryId: 298),
|
||||
(id: 64, cname: "厄立特里亚", countryId: 291),
|
||||
(id: 63, cname: "厄瓜多尔", countryId: 593),
|
||||
(id: 62, cname: "多米尼加代表", countryId: 1809),
|
||||
(id: 61, cname: "多米尼加", countryId: 1767),
|
||||
(id: 60, cname: "多哥", countryId: 228),
|
||||
(id: 59, cname: "迪戈加西亚岛", countryId: 246),
|
||||
(id: 58, cname: "丹麦", countryId: 45),
|
||||
(id: 57, cname: "赤道几内亚", countryId: 240),
|
||||
(id: 44, cname: "百慕大群岛", countryId: 1441),
|
||||
(id: 43, cname: "白俄罗斯", countryId: 375),
|
||||
(id: 42, cname: "巴西", countryId: 55),
|
||||
(id: 29, cname: "爱尔兰", countryId: 353),
|
||||
(id: 28, cname: "埃塞俄比亚", countryId: 251),
|
||||
(id: 27, cname: "埃及", countryId: 20),
|
||||
(id: 26, cname: "阿塞拜疆", countryId: 994),
|
||||
(id: 25, cname: "阿曼", countryId: 968),
|
||||
(id: 24, cname: "阿联酋", countryId: 971),
|
||||
(id: 23, cname: "阿根廷", countryId: 54),
|
||||
(id: 22, cname: "阿富汗", countryId: 93),
|
||||
(id: 21, cname: "阿尔及利亚", countryId: 213),
|
||||
(id: 20, cname: "阿尔巴尼亚", countryId: 355),
|
||||
(id: 30, cname: "爱沙尼亚", countryId: 372),
|
||||
(id: 31, cname: "安道尔", countryId: 376),
|
||||
(id: 41, cname: "巴拿马", countryId: 507),
|
||||
(id: 40, cname: "巴林", countryId: 973),
|
||||
(id: 39, cname: "巴拉圭", countryId: 595),
|
||||
(id: 38, cname: "巴基斯坦", countryId: 92),
|
||||
(id: 37, cname: "巴哈马群岛", countryId: 1242),
|
||||
(id: 36, cname: "巴布亚新几内亚", countryId: 675),
|
||||
(id: 35, cname: "巴巴多斯", countryId: 1246),
|
||||
(id: 34, cname: "奥地利", countryId: 43),
|
||||
(id: 33, cname: "安提瓜岛和巴布达", countryId: 1268),
|
||||
(id: 32, cname: "安哥拉", countryId: 244),
|
||||
(id: 68, cname: "非洲中部", countryId: 236),
|
||||
(id: 117, cname: "罗马尼亚", countryId: 40),
|
||||
(id: 104, cname: "科威特", countryId: 965),
|
||||
(id: 103, cname: "科摩罗", countryId: 269),
|
||||
(id: 102, cname: "开曼群岛", countryId: 1345),
|
||||
(id: 101, cname: "卡塔尔", countryId: 974),
|
||||
(id: 100, cname: "喀麦隆", countryId: 237),
|
||||
(id: 99, cname: "聚会岛", countryId: 262),
|
||||
(id: 98, cname: "津巴布韦", countryId: 263),
|
||||
(id: 97, cname: "捷克", countryId: 420),
|
||||
(id: 96, cname: "柬埔寨", countryId: 855),
|
||||
(id: 95, cname: "加蓬", countryId: 241),
|
||||
(id: 105, cname: "克罗地亚", countryId: 385),
|
||||
(id: 106, cname: "肯尼亚", countryId: 254),
|
||||
(id: 116, cname: "卢旺达", countryId: 250),
|
||||
(id: 115, cname: "卢森堡", countryId: 352),
|
||||
(id: 114, cname: "利比亚", countryId: 218),
|
||||
(id: 113, cname: "利比里亚", countryId: 231),
|
||||
(id: 112, cname: "立陶宛", countryId: 370),
|
||||
(id: 111, cname: "黎巴嫩", countryId: 961),
|
||||
(id: 110, cname: "老挝", countryId: 856),
|
||||
(id: 109, cname: "莱索托", countryId: 266),
|
||||
(id: 108, cname: "拉脱维亚", countryId: 371),
|
||||
(id: 107, cname: "库克岛", countryId: 682),
|
||||
(id: 94, cname: "加纳", countryId: 233),
|
||||
(id: 93, cname: "几内亚比绍", countryId: 245),
|
||||
(id: 92, cname: "几内亚", countryId: 224),
|
||||
(id: 79, cname: "格林纳达", countryId: 1473),
|
||||
(id: 78, cname: "哥斯达黎加", countryId: 506),
|
||||
(id: 77, cname: "哥伦比亚", countryId: 57),
|
||||
(id: 76, cname: "刚果(金)", countryId: 243),
|
||||
(id: 75, cname: "刚果", countryId: 242),
|
||||
(id: 74, cname: "冈比亚", countryId: 220),
|
||||
(id: 73, cname: "福克兰岛", countryId: 500),
|
||||
(id: 72, cname: "佛得角", countryId: 238),
|
||||
(id: 71, cname: "芬兰", countryId: 358),
|
||||
(id: 70, cname: "斐济", countryId: 679),
|
||||
(id: 80, cname: "格陵兰岛", countryId: 299),
|
||||
(id: 81, cname: "古巴", countryId: 53),
|
||||
(id: 91, cname: "吉尔吉斯斯坦", countryId: 996),
|
||||
(id: 90, cname: "吉布提", countryId: 253),
|
||||
(id: 89, cname: "基里巴斯", countryId: 686),
|
||||
(id: 88, cname: "维克岛", countryId: 1808),
|
||||
(id: 87, cname: "洪都拉斯", countryId: 504),
|
||||
(id: 86, cname: "荷兰", countryId: 31),
|
||||
(id: 85, cname: "朝鲜", countryId: 850),
|
||||
(id: 84, cname: "海地", countryId: 509),
|
||||
(id: 83, cname: "关岛", countryId: 1671),
|
||||
(id: 82, cname: "瓜德罗普岛", countryId: 590),
|
||||
(id: 69, cname: "菲律宾", countryId: 63),
|
||||
];
|
||||
}
|
||||
@@ -15,8 +15,8 @@ import 'package:get/get_navigation/src/extension_navigation.dart';
|
||||
import 'package:intl/intl.dart' show DateFormat;
|
||||
import 'package:re_highlight/languages/json.dart';
|
||||
import 'package:re_highlight/re_highlight.dart';
|
||||
import 'package:re_highlight/styles/base16/github.dart';
|
||||
import 'package:re_highlight/styles/github-dark.dart';
|
||||
import 'package:re_highlight/styles/github.dart';
|
||||
|
||||
void exportToClipBoard({
|
||||
required ValueGetter<String> onExport,
|
||||
|
||||
@@ -5,13 +5,10 @@
|
||||
import 'dart:math' as math;
|
||||
import 'dart:ui' show SemanticsRole, lerpDouble;
|
||||
|
||||
import 'package:PiliPlus/pages/main/controller.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart' show DragStartBehavior;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
import 'package:get/get_instance/src/extension_instance.dart';
|
||||
|
||||
const double _kTabWidth = 51.0;
|
||||
const double _kTextAndIconTabWidth = 72.0;
|
||||
@@ -1626,8 +1623,6 @@ class _VerticalTabBarState extends State<VerticalTabBar> {
|
||||
|
||||
int get maxTabIndex => _indicatorPainter!.maxTabIndex;
|
||||
|
||||
final _mainCtr = Get.find<MainController>();
|
||||
|
||||
double _tabScrollOffset(
|
||||
int index,
|
||||
double viewportWidth,
|
||||
@@ -1650,16 +1645,7 @@ class _VerticalTabBarState extends State<VerticalTabBar> {
|
||||
final double paddingTop =
|
||||
widget.padding?.resolve(TextDirection.ltr).top ?? 0;
|
||||
return clampDouble(
|
||||
tabCenter +
|
||||
paddingTop -
|
||||
viewportWidth / 2.0 +
|
||||
(_mainCtr.useBottomNav &&
|
||||
switch (_mainCtr.barHideType) {
|
||||
.instant => _mainCtr.showBottomBar?.value ?? true,
|
||||
.sync => (_mainCtr.barOffset?.value ?? 0) == 0,
|
||||
}
|
||||
? 80.0
|
||||
: 0.0),
|
||||
tabCenter + paddingTop - viewportWidth / 2.0,
|
||||
minExtent,
|
||||
maxExtent,
|
||||
);
|
||||
|
||||
@@ -676,11 +676,11 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
}
|
||||
|
||||
void _onPointerDown(PointerDownEvent event) {
|
||||
widget.onPointerDown?.call(event);
|
||||
final localPosition = event.localPosition;
|
||||
if (localPosition.dx < 40 || localPosition.dy < 40) {
|
||||
return;
|
||||
}
|
||||
widget.onPointerDown?.call(event);
|
||||
_scaleGestureRecognizer.addPointer(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +55,9 @@ class ImageModel {
|
||||
|
||||
bool get isLongPic =>
|
||||
_isLongPic ??= (height / width) > Style.imgMaxRatio && width > 100;
|
||||
bool get isLivePhoto =>
|
||||
_isLivePhoto ??= enableLivePhoto && liveUrl?.isNotEmpty == true;
|
||||
bool get isLivePhoto => _isLivePhoto ??= liveUrl?.isNotEmpty == true;
|
||||
|
||||
bool get isGif => url.endsWith(ImageUtils.kSuffixGIF);
|
||||
|
||||
static bool enableLivePhoto = Pref.enableLivePhoto;
|
||||
}
|
||||
|
||||
class ImageGridView extends StatelessWidget {
|
||||
|
||||
@@ -25,14 +25,11 @@ import 'package:PiliPlus/common/widgets/image_viewer/image.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/loading_indicator.dart';
|
||||
import 'package:PiliPlus/common/widgets/image_viewer/viewer.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/main.dart' show tmpPadding;
|
||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
import 'package:PiliPlus/utils/device_utils.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/view/simple_video_texture.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/string_ext.dart';
|
||||
import 'package:PiliPlus/utils/image_utils.dart';
|
||||
import 'package:PiliPlus/utils/max_screen_size.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
@@ -80,7 +77,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
late final int _quality;
|
||||
late final RxInt _currIndex;
|
||||
GlobalKey? _key;
|
||||
EdgeInsets? _padding;
|
||||
late EdgeInsets _padding;
|
||||
|
||||
late bool _hasInit = false;
|
||||
Player? _player;
|
||||
@@ -175,42 +172,10 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
);
|
||||
}
|
||||
|
||||
late final bool _hideSystemBar;
|
||||
|
||||
void _initHideSystemBar() {
|
||||
if (Platform.isAndroid) {
|
||||
if (showSystemBar_) {
|
||||
final size = DeviceUtils.size;
|
||||
_hideSystemBar = !MaxScreenSize.isWindowMode(
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
);
|
||||
} else {
|
||||
_hideSystemBar = false;
|
||||
}
|
||||
} else if (Platform.isIOS) {
|
||||
_hideSystemBar = showSystemBar_;
|
||||
} else {
|
||||
_hideSystemBar = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
if (_padding == null) {
|
||||
final padding = MediaQuery.viewPaddingOf(context);
|
||||
_padding = padding;
|
||||
_initHideSystemBar();
|
||||
if (_hideSystemBar) {
|
||||
tmpPadding = padding;
|
||||
hideSystemBar()!.whenComplete(
|
||||
() => WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => tmpPadding = null,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
_padding = MediaQuery.viewPaddingOf(context);
|
||||
}
|
||||
|
||||
Matrix4 _onTransform(double val) {
|
||||
@@ -302,9 +267,6 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 200), _currIndex.close);
|
||||
super.dispose();
|
||||
if (_hideSystemBar) {
|
||||
showSystemBar();
|
||||
}
|
||||
}
|
||||
|
||||
void _onPointerDown(PointerDownEvent event) {
|
||||
@@ -357,7 +319,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
right: 0,
|
||||
child: IgnorePointer(
|
||||
child: Container(
|
||||
padding: _padding! + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
padding: _padding + const EdgeInsets.fromLTRB(12, 8, 20, 8),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
@@ -512,7 +474,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
||||
_horizontalDragGestureRecognizer,
|
||||
onChangePage: _onChangePage,
|
||||
child: FittedBox(
|
||||
child: SimpleVideo(
|
||||
child: SimpleVideoTexture(
|
||||
controller: _videoController!,
|
||||
fill: Colors.transparent,
|
||||
),
|
||||
|
||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/models/common/avatar_badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PendantAvatar extends StatelessWidget {
|
||||
@@ -35,8 +34,6 @@ class PendantAvatar extends StatelessWidget {
|
||||
? .institution
|
||||
: .none;
|
||||
|
||||
static bool showDecorate = Pref.showDecorate;
|
||||
|
||||
final BadgeType badgeType;
|
||||
final String? url;
|
||||
final double preferredSize;
|
||||
@@ -51,7 +48,7 @@ class PendantAvatar extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final showPendant = showDecorate && pendantImage?.isNotEmpty == true;
|
||||
final showPendant = pendantImage?.isNotEmpty == true;
|
||||
final size = showPendant ? preferredSize - pendentOffset : preferredSize;
|
||||
Widget? pendant;
|
||||
if (showPendant) {
|
||||
|
||||
@@ -739,13 +739,14 @@ class RenderProgressBar extends RenderBox implements MouseTrackerAnnotation {
|
||||
}) {
|
||||
final baseBarPaint = Paint()
|
||||
..color = color
|
||||
..strokeCap = StrokeCap.round
|
||||
..strokeCap = .square
|
||||
..strokeWidth = _barHeight;
|
||||
final capRadius = _barHeight / 2;
|
||||
final adjustedWidth = availableSize.width - barHeight;
|
||||
final dx = widthProportion * adjustedWidth + capRadius;
|
||||
final startPoint = Offset(capRadius, availableSize.height / 2);
|
||||
final endPoint = Offset(dx, availableSize.height / 2);
|
||||
final dy = availableSize.height / 2;
|
||||
final startPoint = Offset(capRadius, dy);
|
||||
final endPoint = Offset(dx, dy);
|
||||
canvas.drawLine(startPoint, endPoint, baseBarPaint);
|
||||
}
|
||||
|
||||
|
||||
18
lib/common/widgets/scaffold.dart
Normal file
18
lib/common/widgets/scaffold.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget scaffold({
|
||||
Widget? appBar,
|
||||
required Widget body,
|
||||
}) {
|
||||
if (appBar != null) {
|
||||
body = Column(
|
||||
children: [
|
||||
appBar,
|
||||
Expanded(child: body),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Material(
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
import 'dart:async' show scheduleMicrotask;
|
||||
import 'dart:collection' show Queue;
|
||||
import 'dart:ui' show PointerDataPacket;
|
||||
|
||||
import 'package:flutter/gestures.dart' show PointerEventConverter;
|
||||
import 'package:flutter/rendering.dart' show RenderView, ViewConfiguration;
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// ref https://github.com/LastMonopoly/scaled_app
|
||||
|
||||
/// Adapted from [WidgetsFlutterBinding]
|
||||
///
|
||||
class ScaledWidgetsFlutterBinding extends WidgetsFlutterBinding {
|
||||
ScaledWidgetsFlutterBinding._({double scaleFactor = 1.0})
|
||||
: _scaleFactor = scaleFactor;
|
||||
|
||||
/// Calculate scale factor from device size.
|
||||
double _scaleFactor;
|
||||
|
||||
/// Update scaleFactor callback, then rebuild layout
|
||||
set scaleFactor(double scaleFactor) {
|
||||
if (_scaleFactor == scaleFactor) return;
|
||||
_scaleFactor = scaleFactor;
|
||||
handleMetricsChanged();
|
||||
}
|
||||
|
||||
double devicePixelRatioScaled = 0;
|
||||
|
||||
static ScaledWidgetsFlutterBinding? _binding;
|
||||
|
||||
static ScaledWidgetsFlutterBinding get instance => _binding!;
|
||||
|
||||
/// Scaling will be applied based on [scaleFactor] callback.
|
||||
///
|
||||
static WidgetsBinding ensureInitialized({double scaleFactor = 1.0}) =>
|
||||
_binding ??= ScaledWidgetsFlutterBinding._(scaleFactor: scaleFactor);
|
||||
|
||||
/// Override the method from [RendererBinding.createViewConfiguration] to
|
||||
/// change what size or device pixel ratio the [RenderView] will use.
|
||||
///
|
||||
/// See more:
|
||||
/// * [RendererBinding.createViewConfiguration]
|
||||
/// * [TestWidgetsFlutterBinding.createViewConfiguration]
|
||||
@override
|
||||
ViewConfiguration createViewConfigurationFor(RenderView renderView) {
|
||||
final view = renderView.flutterView;
|
||||
final devicePixelRatio = view.devicePixelRatio;
|
||||
devicePixelRatioScaled = devicePixelRatio * _scaleFactor;
|
||||
final BoxConstraints physicalConstraints =
|
||||
BoxConstraints.fromViewConstraints(view.physicalConstraints);
|
||||
return ViewConfiguration(
|
||||
physicalConstraints: physicalConstraints,
|
||||
logicalConstraints: physicalConstraints / devicePixelRatioScaled,
|
||||
devicePixelRatio: devicePixelRatioScaled,
|
||||
);
|
||||
}
|
||||
|
||||
/// Adapted from [GestureBinding.initInstances]
|
||||
@override
|
||||
void initInstances() {
|
||||
super.initInstances();
|
||||
platformDispatcher.onPointerDataPacket = _handlePointerDataPacket;
|
||||
}
|
||||
|
||||
@override
|
||||
void unlocked() {
|
||||
super.unlocked();
|
||||
_flushPointerEventQueue();
|
||||
}
|
||||
|
||||
final Queue<PointerEvent> _pendingPointerEvents = Queue<PointerEvent>();
|
||||
|
||||
/// When we scale UI using [ViewConfiguration], [ui.window] stays the same.
|
||||
///
|
||||
/// [GestureBinding] uses [platformDispatcher.implicitView.devicePixelRatio] for calculations,
|
||||
/// so we override corresponding methods.
|
||||
///
|
||||
void _handlePointerDataPacket(PointerDataPacket packet) {
|
||||
// We convert pointer data to logical pixels so that e.g. the touch slop can be
|
||||
// defined in a device-independent manner.
|
||||
try {
|
||||
_pendingPointerEvents.addAll(
|
||||
PointerEventConverter.expand(packet.data, _devicePixelRatioForView),
|
||||
);
|
||||
if (!locked) {
|
||||
_flushPointerEventQueue();
|
||||
}
|
||||
} catch (error, stack) {
|
||||
FlutterError.reportError(
|
||||
FlutterErrorDetails(
|
||||
exception: error,
|
||||
stack: stack,
|
||||
library: 'gestures library',
|
||||
context: ErrorDescription('while handling a pointer data packet'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
double _devicePixelRatioForView(int viewId) => devicePixelRatioScaled;
|
||||
|
||||
/// Dispatch a [PointerCancelEvent] for the given pointer soon.
|
||||
///
|
||||
/// The pointer event will be dispatched before the next pointer event and
|
||||
/// before the end of the microtask but not within this function call.
|
||||
@override
|
||||
void cancelPointer(int pointer) {
|
||||
if (_pendingPointerEvents.isEmpty && !locked) {
|
||||
scheduleMicrotask(_flushPointerEventQueue);
|
||||
}
|
||||
_pendingPointerEvents.addFirst(PointerCancelEvent(pointer: pointer));
|
||||
}
|
||||
|
||||
void _flushPointerEventQueue() {
|
||||
assert(!locked);
|
||||
|
||||
while (_pendingPointerEvents.isNotEmpty) {
|
||||
handlePointerEvent(_pendingPointerEvents.removeFirst());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,7 @@ import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/models_new/space/space_archive/item.dart';
|
||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||
import 'package:PiliPlus/pages/search/widgets/search_text.dart';
|
||||
import 'package:PiliPlus/pages/video/ai_conclusion/view.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -61,34 +58,6 @@ class VideoPopupMenu extends StatelessWidget {
|
||||
const Icon(MdiIcons.clockTimeEightOutline, size: 16),
|
||||
() => UserHttp.toViewLater(bvid: videoItem.bvid),
|
||||
),
|
||||
if (videoItem.cid != null && Pref.enableAi)
|
||||
_VideoCustomAction(
|
||||
'AI总结',
|
||||
const Icon(CustomIcons.ai_circle, size: 16),
|
||||
() async {
|
||||
final res = await UgcIntroController.getAiConclusion(
|
||||
videoItem.bvid!,
|
||||
videoItem.cid!,
|
||||
videoItem.owner.mid,
|
||||
);
|
||||
if (res != null && context.mounted) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => Dialog(
|
||||
child: Padding(
|
||||
padding: const .symmetric(vertical: 14),
|
||||
child: AiConclusionPanel.buildContent(
|
||||
context,
|
||||
Theme.of(context),
|
||||
res,
|
||||
tap: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
if (videoItem is! SpaceArchiveItem) ...[
|
||||
_VideoCustomAction(
|
||||
|
||||
Reference in New Issue
Block a user