mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-28 06:20:12 +08:00
refa intro panel gesture
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -180,15 +180,17 @@ class RenderAnimatedHeight extends RenderProxyBox {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void performLayout() {
|
void performLayout() {
|
||||||
|
final BoxConstraints constraints = this.constraints;
|
||||||
|
|
||||||
if (_isInvisible) {
|
if (_isInvisible) {
|
||||||
_heights = const (from: 0, to: 0);
|
_heights = const (from: 0, to: 0);
|
||||||
size = .zero;
|
child!.layout(constraints);
|
||||||
|
size = constraints.constrain(.zero);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastValue = _controller.value;
|
_lastValue = _controller.value;
|
||||||
|
|
||||||
final BoxConstraints constraints = this.constraints;
|
|
||||||
final childSize = (child!..layout(constraints, parentUsesSize: true)).size;
|
final childSize = (child!..layout(constraints, parentUsesSize: true)).size;
|
||||||
|
|
||||||
final Size animatedSize;
|
final Size animatedSize;
|
||||||
|
|||||||
132
lib/common/widgets/translucent_column.dart
Normal file
132
lib/common/widgets/translucent_column.dart
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of PiliPlus
|
||||||
|
*
|
||||||
|
* PiliPlus is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* PiliPlus is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with PiliPlus. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'package:PiliPlus/common/widgets/animated_height.dart'
|
||||||
|
show RenderAnimatedHeight;
|
||||||
|
import 'package:flutter/rendering.dart'
|
||||||
|
show RenderProxyBox, BoxHitTestResult, RenderFlex, FlexParentData;
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
class TranslucentColumn extends Flex {
|
||||||
|
const TranslucentColumn({
|
||||||
|
super.key,
|
||||||
|
super.mainAxisAlignment,
|
||||||
|
super.mainAxisSize,
|
||||||
|
super.crossAxisAlignment,
|
||||||
|
super.textDirection,
|
||||||
|
super.verticalDirection,
|
||||||
|
super.textBaseline,
|
||||||
|
super.spacing,
|
||||||
|
super.children,
|
||||||
|
}) : super(direction: Axis.vertical);
|
||||||
|
|
||||||
|
@override
|
||||||
|
RenderTranslucentColumn createRenderObject(BuildContext context) {
|
||||||
|
return RenderTranslucentColumn(
|
||||||
|
direction: direction,
|
||||||
|
mainAxisAlignment: mainAxisAlignment,
|
||||||
|
mainAxisSize: mainAxisSize,
|
||||||
|
crossAxisAlignment: crossAxisAlignment,
|
||||||
|
textDirection: getEffectiveTextDirection(context),
|
||||||
|
verticalDirection: verticalDirection,
|
||||||
|
textBaseline: textBaseline,
|
||||||
|
clipBehavior: clipBehavior,
|
||||||
|
spacing: spacing,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void updateRenderObject(
|
||||||
|
BuildContext context,
|
||||||
|
RenderTranslucentColumn renderObject,
|
||||||
|
) {
|
||||||
|
renderObject
|
||||||
|
..direction = direction
|
||||||
|
..mainAxisAlignment = mainAxisAlignment
|
||||||
|
..mainAxisSize = mainAxisSize
|
||||||
|
..crossAxisAlignment = crossAxisAlignment
|
||||||
|
..textDirection = getEffectiveTextDirection(context)
|
||||||
|
..verticalDirection = verticalDirection
|
||||||
|
..textBaseline = textBaseline
|
||||||
|
..clipBehavior = clipBehavior
|
||||||
|
..spacing = spacing;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RenderTranslucentColumn extends RenderFlex {
|
||||||
|
RenderTranslucentColumn({
|
||||||
|
super.children,
|
||||||
|
super.direction,
|
||||||
|
super.mainAxisSize,
|
||||||
|
super.mainAxisAlignment,
|
||||||
|
super.crossAxisAlignment,
|
||||||
|
super.textDirection,
|
||||||
|
super.verticalDirection,
|
||||||
|
super.textBaseline,
|
||||||
|
super.clipBehavior,
|
||||||
|
super.spacing,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool hitTestChildren(BoxHitTestResult result, {required Offset position}) {
|
||||||
|
RenderBox? child = lastChild;
|
||||||
|
final width = size.width;
|
||||||
|
while (child != null) {
|
||||||
|
final childParentData = child.parentData! as FlexParentData;
|
||||||
|
final bool isHit = result.addWithPaintOffset(
|
||||||
|
offset: childParentData.offset,
|
||||||
|
position: position,
|
||||||
|
hitTest: (BoxHitTestResult result, Offset transformed) {
|
||||||
|
assert(transformed == position - childParentData.offset);
|
||||||
|
if (transformed.dx >= 0.0 &&
|
||||||
|
transformed.dx < width &&
|
||||||
|
transformed.dy >= 0.0 &&
|
||||||
|
transformed.dy < child!.size.height) {
|
||||||
|
final hit = child.hitTest(result, position: transformed);
|
||||||
|
if (child is RenderAnimatedHeight) {
|
||||||
|
return hit;
|
||||||
|
}
|
||||||
|
if (hit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (child is RenderNoTranslucentArea) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (isHit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
child = childParentData.previousSibling;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NoTranslucentArea extends SingleChildRenderObjectWidget {
|
||||||
|
const NoTranslucentArea({super.key, required Widget super.child});
|
||||||
|
|
||||||
|
@override
|
||||||
|
RenderObject createRenderObject(BuildContext context) {
|
||||||
|
return RenderNoTranslucentArea();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RenderNoTranslucentArea extends RenderProxyBox {}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
import 'package:PiliPlus/utils/bili_colors.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
enum BadgeType {
|
enum BadgeType {
|
||||||
none(),
|
none(),
|
||||||
vip('大会员'),
|
vip('大会员'),
|
||||||
person('认证个人', Color(0xFFFFCC00)),
|
person('认证个人', BiliColors.yellow),
|
||||||
institution('认证机构', Colors.lightBlueAccent),
|
institution('认证机构', Colors.lightBlueAccent),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import 'package:PiliPlus/pages/member_guard/view.dart';
|
|||||||
import 'package:PiliPlus/pages/member_upower_rank/view.dart';
|
import 'package:PiliPlus/pages/member_upower_rank/view.dart';
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||||
|
import 'package:PiliPlus/utils/bili_colors.dart';
|
||||||
import 'package:PiliPlus/utils/bili_utils.dart';
|
import 'package:PiliPlus/utils/bili_utils.dart';
|
||||||
import 'package:PiliPlus/utils/color_utils.dart';
|
import 'package:PiliPlus/utils/color_utils.dart';
|
||||||
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
import 'package:PiliPlus/utils/extension/context_ext.dart';
|
||||||
@@ -278,13 +279,17 @@ class UserInfoCard extends StatelessWidget {
|
|||||||
shape: .circle,
|
shape: .circle,
|
||||||
color: colorScheme.surface,
|
color: colorScheme.surface,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: card.officialVerify?.type == 0
|
||||||
Icons.offline_bolt,
|
? const Icon(
|
||||||
color: card.officialVerify?.type == 0
|
Icons.offline_bolt,
|
||||||
? const Color(0xFFFFCC00)
|
color: BiliColors.yellow,
|
||||||
: Colors.lightBlueAccent,
|
size: 18,
|
||||||
size: 18,
|
)
|
||||||
),
|
: const Icon(
|
||||||
|
Icons.offline_bolt,
|
||||||
|
color: Colors.lightBlueAccent,
|
||||||
|
size: 18,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:PiliPlus/common/widgets/stat/stat.dart';
|
|||||||
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
import 'package:PiliPlus/models/common/image_preview_type.dart';
|
||||||
import 'package:PiliPlus/models/common/image_type.dart';
|
import 'package:PiliPlus/models/common/image_type.dart';
|
||||||
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
import 'package:PiliPlus/models_new/pgc/pgc_info_model/result.dart';
|
||||||
|
import 'package:PiliPlus/models_new/pgc/pgc_info_model/stat.dart';
|
||||||
import 'package:PiliPlus/pages/video/controller.dart';
|
import 'package:PiliPlus/pages/video/controller.dart';
|
||||||
import 'package:PiliPlus/pages/video/introduction/pgc/controller.dart';
|
import 'package:PiliPlus/pages/video/introduction/pgc/controller.dart';
|
||||||
import 'package:PiliPlus/pages/video/introduction/pgc/widgets/pgc_panel.dart';
|
import 'package:PiliPlus/pages/video/introduction/pgc/widgets/pgc_panel.dart';
|
||||||
@@ -76,7 +77,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 6),
|
const SizedBox(height: 6),
|
||||||
// 点赞收藏转发 布局样式2
|
// 点赞收藏转发 布局样式2
|
||||||
if (introController.isPgc) actionGrid(item, introController),
|
if (introController.isPgc) actionGrid(item.stat!, introController),
|
||||||
// 番剧分集
|
// 番剧分集
|
||||||
if (item.episodes?.isNotEmpty == true)
|
if (item.episodes?.isNotEmpty == true)
|
||||||
PgcPanel(
|
PgcPanel(
|
||||||
@@ -383,10 +384,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget actionGrid(
|
Widget actionGrid(PgcStat stat, PgcIntroController introController) {
|
||||||
PgcInfoModel item,
|
|
||||||
PgcIntroController introController,
|
|
||||||
) {
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 48,
|
height: 48,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -399,7 +397,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
selectIcon: const Icon(FontAwesomeIcons.solidThumbsUp),
|
||||||
selectStatus: introController.hasLike.value,
|
selectStatus: introController.hasLike.value,
|
||||||
semanticsLabel: '点赞',
|
semanticsLabel: '点赞',
|
||||||
text: NumUtils.numFormat(item.stat!.like),
|
text: NumUtils.numFormat(stat.like),
|
||||||
onStartTriple: introController.onStartTriple,
|
onStartTriple: introController.onStartTriple,
|
||||||
onCancelTriple: introController.onCancelTriple,
|
onCancelTriple: introController.onCancelTriple,
|
||||||
),
|
),
|
||||||
@@ -412,7 +410,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
onTap: introController.actionCoinVideo,
|
onTap: introController.actionCoinVideo,
|
||||||
selectStatus: introController.hasCoin,
|
selectStatus: introController.hasCoin,
|
||||||
semanticsLabel: '投币',
|
semanticsLabel: '投币',
|
||||||
text: NumUtils.numFormat(item.stat!.coin),
|
text: NumUtils.numFormat(stat.coin),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
@@ -427,7 +425,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
),
|
),
|
||||||
selectStatus: introController.hasFav.value,
|
selectStatus: introController.hasFav.value,
|
||||||
semanticsLabel: '收藏',
|
semanticsLabel: '收藏',
|
||||||
text: NumUtils.numFormat(item.stat!.favorite),
|
text: NumUtils.numFormat(stat.favorite),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
Obx(
|
||||||
@@ -446,7 +444,7 @@ class _PgcIntroPageState extends State<PgcIntroPage> {
|
|||||||
onTap: () => introController.actionShareVideo(context),
|
onTap: () => introController.actionShareVideo(context),
|
||||||
selectStatus: false,
|
selectStatus: false,
|
||||||
semanticsLabel: '转发',
|
semanticsLabel: '转发',
|
||||||
text: NumUtils.numFormat(item.stat!.share),
|
text: NumUtils.numFormat(stat.share),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
11
lib/utils/bili_colors.dart
Normal file
11
lib/utils/bili_colors.dart
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:flutter/widgets.dart' show Color;
|
||||||
|
|
||||||
|
abstract final class BiliColors {
|
||||||
|
static const pinkLight = Color(0xFFFF6699);
|
||||||
|
static const pinkDark = Color(0xFFD44E7D);
|
||||||
|
|
||||||
|
static const blueLight = Color(0xFF008AC5);
|
||||||
|
static const blueDark = Color(0xFF2C9CC8);
|
||||||
|
|
||||||
|
static const yellow = Color(0xFFFFCC00);
|
||||||
|
}
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
|
import 'package:PiliPlus/utils/bili_colors.dart';
|
||||||
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
||||||
import 'package:flutter/material.dart'
|
import 'package:flutter/material.dart'
|
||||||
show ThemeData, Color, ColorScheme, Brightness, Colors;
|
show ThemeData, Color, ColorScheme, Brightness, Colors;
|
||||||
|
|
||||||
const _pinkLight = Color(0xFFFF6699);
|
|
||||||
const _pinkDark = Color(0xFFD44E7D);
|
|
||||||
|
|
||||||
const _blueLight = Color(0xFF008AC5);
|
|
||||||
const _blueDark = Color(0xFF2C9CC8);
|
|
||||||
|
|
||||||
extension ThemeDataExt on ThemeData {
|
extension ThemeDataExt on ThemeData {
|
||||||
bool get isLight => brightness.isLight;
|
bool get isLight => brightness.isLight;
|
||||||
|
|
||||||
@@ -15,12 +10,14 @@ extension ThemeDataExt on ThemeData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension ColorSchemeExt on ColorScheme {
|
extension ColorSchemeExt on ColorScheme {
|
||||||
Color get vipColor => brightness.isLight ? _pinkLight : _pinkDark;
|
Color get vipColor =>
|
||||||
|
brightness.isLight ? BiliColors.pinkLight : BiliColors.pinkDark;
|
||||||
|
|
||||||
Color get blue => brightness.isLight ? _blueLight : _blueDark;
|
Color get blue =>
|
||||||
|
brightness.isLight ? BiliColors.blueLight : BiliColors.blueDark;
|
||||||
|
|
||||||
Color get btnColor =>
|
Color get btnColor =>
|
||||||
brightness.isLight ? _pinkLight : const Color(0xFF8F0030);
|
brightness.isLight ? BiliColors.pinkLight : const Color(0xFF8F0030);
|
||||||
|
|
||||||
Color get freeColor =>
|
Color get freeColor =>
|
||||||
brightness.isLight ? const Color(0xFFFF7F24) : const Color(0xFFD66011);
|
brightness.isLight ? const Color(0xFFFF7F24) : const Color(0xFFD66011);
|
||||||
|
|||||||
Reference in New Issue
Block a user