mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: expand ctr
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:math';
|
||||
|
||||
import 'package:PiliPalaX/http/loading_state.dart';
|
||||
import 'package:PiliPalaX/utils/utils.dart';
|
||||
import 'package:expandable/expandable.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
@@ -79,6 +80,8 @@ class VideoIntroController extends GetxController
|
||||
Rx<Map<String, dynamic>> queryVideoIntroData =
|
||||
Rx<Map<String, dynamic>>({"status": true});
|
||||
|
||||
ExpandableController? expandableCtr;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -609,6 +612,8 @@ class VideoIntroController extends GetxController
|
||||
@override
|
||||
void onClose() {
|
||||
canelTimer();
|
||||
expandableCtr?.dispose();
|
||||
expandableCtr = null;
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,12 +73,6 @@ class _VideoIntroPanelState extends State<VideoIntroPanel>
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
videoIntroController.onClose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
@@ -158,7 +152,6 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
|
||||
late final _coinKey = GlobalKey<ActionItemState>();
|
||||
late final _favKey = GlobalKey<ActionItemState>();
|
||||
late final ExpandableController _expandableCtr;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -171,28 +164,24 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
loadingStatus = widget.loadingStatus;
|
||||
enableAi = setting.get(SettingBoxKey.enableAi, defaultValue: true);
|
||||
|
||||
bool alwaysExapndIntroPanel = GStorage.alwaysExapndIntroPanel;
|
||||
if (videoIntroController.expandableCtr == null) {
|
||||
bool alwaysExapndIntroPanel = GStorage.alwaysExapndIntroPanel;
|
||||
|
||||
_expandableCtr = ExpandableController(
|
||||
initialExpanded: alwaysExapndIntroPanel,
|
||||
);
|
||||
videoIntroController.expandableCtr = ExpandableController(
|
||||
initialExpanded: alwaysExapndIntroPanel,
|
||||
);
|
||||
|
||||
if (alwaysExapndIntroPanel.not && GStorage.exapndIntroPanelH) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (context.orientation == Orientation.landscape &&
|
||||
_expandableCtr.expanded.not) {
|
||||
_expandableCtr.toggle();
|
||||
}
|
||||
});
|
||||
if (alwaysExapndIntroPanel.not && GStorage.exapndIntroPanelH) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (context.orientation == Orientation.landscape &&
|
||||
videoIntroController.expandableCtr?.expanded == false) {
|
||||
videoIntroController.expandableCtr?.toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_expandableCtr.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _showFavBottomSheet() => showModalBottomSheet(
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
@@ -249,7 +238,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
}
|
||||
feedBack();
|
||||
// widget.showIntroDetail();
|
||||
_expandableCtr.toggle();
|
||||
videoIntroController.expandableCtr?.toggle();
|
||||
}
|
||||
|
||||
// 用户主页
|
||||
@@ -412,7 +401,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: showIntroDetail,
|
||||
child: ExpandablePanel(
|
||||
controller: _expandableCtr,
|
||||
controller: videoIntroController.expandableCtr,
|
||||
collapsed: GestureDetector(
|
||||
onLongPress: () {
|
||||
feedBack();
|
||||
@@ -540,7 +529,7 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: showIntroDetail,
|
||||
child: ExpandablePanel(
|
||||
controller: _expandableCtr,
|
||||
controller: videoIntroController.expandableCtr,
|
||||
collapsed: const SizedBox.shrink(),
|
||||
expanded: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
Reference in New Issue
Block a user