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