diff --git a/lib/pages/dynamics/deatil/view.dart b/lib/pages/dynamics/deatil/view.dart index 43c40d576..a09fa367e 100644 --- a/lib/pages/dynamics/deatil/view.dart +++ b/lib/pages/dynamics/deatil/view.dart @@ -71,7 +71,7 @@ class _DynamicDetailPageState extends State { } } - void replyReply(replyItem, paddingTop) { + void replyReply(replyItem) { int oid = replyItem.replies!.first.oid; int rpid = replyItem.rpid!; Get.to( @@ -83,7 +83,6 @@ class _DynamicDetailPageState extends State { body: VideoReplyReplyPanel( oid: oid, rpid: rpid, - paddingTop: paddingTop, source: 'dynamic', replyType: ReplyType.values[type], ), @@ -216,8 +215,8 @@ class _DynamicDetailPageState extends State { _dynamicDetailController!.replyList[index], showReplyRow: true, replyLevel: '1', - replyReply: (replyItem, paddingTop) => - replyReply(replyItem, paddingTop), + replyReply: (replyItem) => + replyReply(replyItem), replyType: ReplyType.album, ); } diff --git a/lib/pages/main/view.dart b/lib/pages/main/view.dart index 5d5facb81..2eab8f241 100644 --- a/lib/pages/main/view.dart +++ b/lib/pages/main/view.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:hive/hive.dart'; import 'package:pilipala/pages/dynamics/index.dart'; import 'package:pilipala/pages/home/index.dart'; +import 'package:pilipala/utils/storage.dart'; import './controller.dart'; class MainApp extends StatefulWidget { @@ -87,6 +89,11 @@ class _MainAppState extends State with SingleTickerProviderStateMixin { @override Widget build(BuildContext context) { + Box localCache = GStrorage.localCache; + double sheetHeight = MediaQuery.of(context).size.height - + MediaQuery.of(context).padding.top - + MediaQuery.of(context).size.width * 9 / 16; + localCache.put('sheetHeight', sheetHeight); return Scaffold( body: FadeTransition( opacity: _fadeAnimation!, diff --git a/lib/pages/video/detail/controller.dart b/lib/pages/video/detail/controller.dart index 47e1f1c52..8158a984d 100644 --- a/lib/pages/video/detail/controller.dart +++ b/lib/pages/video/detail/controller.dart @@ -77,7 +77,7 @@ class VideoDetailController extends GetxController queryVideoUrl(); } - showReplyReplyPanel(paddingTop) { + showReplyReplyPanel() { PersistentBottomSheetController? ctr = scaffoldKey.currentState?.showBottomSheet((BuildContext context) { return VideoReplyReplyPanel( @@ -87,7 +87,6 @@ class VideoDetailController extends GetxController fRpid = 0, }, firstFloor: firstFloor, - paddingTop: paddingTop, replyType: ReplyType.video, source: 'videoDetail', ); diff --git a/lib/pages/video/detail/reply/view.dart b/lib/pages/video/detail/reply/view.dart index 91484cce3..00e0ffc2e 100644 --- a/lib/pages/video/detail/reply/view.dart +++ b/lib/pages/video/detail/reply/view.dart @@ -116,13 +116,13 @@ class _VideoReplyPanelState extends State } // 展示二级回复 - void replyReply(replyItem, paddingTop) { + void replyReply(replyItem) { VideoDetailController videoDetailCtr = Get.find(tag: Get.arguments['heroTag']); videoDetailCtr.oid = replyItem.replies!.first.oid; videoDetailCtr.fRpid = replyItem.rpid!; videoDetailCtr.firstFloor = replyItem; - videoDetailCtr.showReplyReplyPanel(paddingTop); + videoDetailCtr.showReplyReplyPanel(); } @override @@ -134,7 +134,6 @@ class _VideoReplyPanelState extends State @override Widget build(BuildContext context) { - double paddingTop = MediaQuery.of(context).padding.top; return RefreshIndicator( onRefresh: () async { setState(() {}); @@ -180,8 +179,8 @@ class _VideoReplyPanelState extends State _videoReplyController.replyList[index], showReplyRow: true, replyLevel: replyLevel, - replyReply: (replyItem, paddingTop) => - replyReply(replyItem, paddingTop), + replyReply: (replyItem) => + replyReply(replyItem), ); } }, @@ -234,7 +233,6 @@ class _VideoReplyPanelState extends State oid: IdUtils.bv2av(Get.parameters['bvid']!), root: 0, parent: 0, - paddingTop: paddingTop, ); }, ).then( diff --git a/lib/pages/video/detail/reply/widgets/reply_item.dart b/lib/pages/video/detail/reply/widgets/reply_item.dart index ce6b95903..0ffce7d31 100644 --- a/lib/pages/video/detail/reply/widgets/reply_item.dart +++ b/lib/pages/video/detail/reply/widgets/reply_item.dart @@ -229,7 +229,6 @@ class ReplyItem extends StatelessWidget { // 感谢、回复、复制 Widget bottonAction(context, replyControl) { var color = Theme.of(context).colorScheme.outline; - double paddingTop = MediaQuery.of(context).padding.top; return Row( children: [ const SizedBox(width: 48), @@ -283,7 +282,6 @@ class ReplyItem extends StatelessWidget { oid: replyItem!.oid, root: replyItem!.rpid, parent: replyItem!.rpid, - paddingTop: paddingTop, replyType: replyType, ); }, @@ -347,7 +345,6 @@ class ReplyItemRow extends StatelessWidget { Widget build(BuildContext context) { bool isShow = replyControl!.isShow!; int extraRow = replyControl != null && isShow ? 1 : 0; - double paddingTop = MediaQuery.of(context).padding.top; return Container( margin: const EdgeInsets.only(left: 42, right: 4, top: 0), child: Material( @@ -360,7 +357,7 @@ class ReplyItemRow extends StatelessWidget { children: [ for (var i = 0; i < replies!.length; i++) ...[ InkWell( - onTap: () => replyReply!(replyItem, paddingTop), + onTap: () => replyReply!(replyItem), child: Container( width: double.infinity, padding: EdgeInsets.fromLTRB( @@ -410,7 +407,7 @@ class ReplyItemRow extends StatelessWidget { ], if (extraRow == 1) InkWell( - onTap: () => replyReply!(replyItem, paddingTop), + onTap: () => replyReply!(replyItem), child: Container( width: double.infinity, padding: const EdgeInsets.fromLTRB(8, 5, 8, 8), diff --git a/lib/pages/video/detail/replyNew/view.dart b/lib/pages/video/detail/replyNew/view.dart index 4d1a52c9f..7faeb5965 100644 --- a/lib/pages/video/detail/replyNew/view.dart +++ b/lib/pages/video/detail/replyNew/view.dart @@ -3,16 +3,17 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; +import 'package:hive/hive.dart'; import 'package:pilipala/http/video.dart'; import 'package:pilipala/models/common/reply_type.dart'; import 'package:pilipala/models/video/reply/item.dart'; +import 'package:pilipala/utils/storage.dart'; class VideoReplyNewDialog extends StatefulWidget { int? oid; int? root; String? replyLevel; int? parent; - double? paddingTop; ReplyType? replyType; VideoReplyNewDialog({ @@ -20,7 +21,6 @@ class VideoReplyNewDialog extends StatefulWidget { this.root, this.replyLevel, this.parent, - this.paddingTop, this.replyType, }); @@ -38,6 +38,8 @@ class _VideoReplyNewDialogState extends State bool ableClean = false; bool autoFocus = false; Timer? timer; + Box localCache = GStrorage.localCache; + late double sheetHeight; @override void initState() { @@ -50,6 +52,8 @@ class _VideoReplyNewDialogState extends State WidgetsBinding.instance.addObserver(this); // 自动聚焦 _autoFocus(); + + sheetHeight = localCache.get('sheetHeight'); } _autoFocus() async { @@ -101,11 +105,8 @@ class _VideoReplyNewDialogState extends State @override Widget build(BuildContext context) { - print('1111111'); return Container( - height: MediaQuery.of(context).size.height - - MediaQuery.of(context).size.width * 9 / 16 - - widget.paddingTop!, + height: sheetHeight, clipBehavior: Clip.hardEdge, decoration: BoxDecoration( borderRadius: const BorderRadius.only( diff --git a/lib/pages/video/detail/replyReply/view.dart b/lib/pages/video/detail/replyReply/view.dart index bfda7f76e..5f3034c97 100644 --- a/lib/pages/video/detail/replyReply/view.dart +++ b/lib/pages/video/detail/replyReply/view.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:hive/hive.dart'; import 'package:pilipala/common/skeleton/video_reply.dart'; import 'package:pilipala/common/widgets/http_error.dart'; import 'package:pilipala/models/common/reply_type.dart'; import 'package:pilipala/models/video/reply/item.dart'; import 'package:pilipala/pages/video/detail/reply/widgets/reply_item.dart'; +import 'package:pilipala/utils/storage.dart'; import 'controller.dart'; @@ -13,7 +15,6 @@ class VideoReplyReplyPanel extends StatefulWidget { int? rpid; Function? closePanel; ReplyItemModel? firstFloor; - double? paddingTop; String? source; ReplyType? replyType; @@ -22,7 +23,6 @@ class VideoReplyReplyPanel extends StatefulWidget { this.rpid, this.closePanel, this.firstFloor, - this.paddingTop, this.source, this.replyType, super.key, @@ -35,6 +35,8 @@ class VideoReplyReplyPanel extends StatefulWidget { class _VideoReplyReplyPanelState extends State { late VideoReplyReplyController _videoReplyReplyController; late AnimationController replyAnimationCtl; + Box localCache = GStrorage.localCache; + late double sheetHeight; @override void initState() { @@ -57,6 +59,8 @@ class _VideoReplyReplyPanelState extends State { } }, ); + + sheetHeight = localCache.get('sheetHeight'); } @override @@ -68,11 +72,7 @@ class _VideoReplyReplyPanelState extends State { @override Widget build(BuildContext context) { return Container( - height: widget.source == 'videoDetail' - ? MediaQuery.of(context).size.height - - MediaQuery.of(context).size.width * 9 / 16 - - widget.paddingTop! - : null, + height: widget.source == 'videoDetail' ? sheetHeight : null, color: Theme.of(context).colorScheme.background, child: Column( children: [ diff --git a/lib/utils/wbi_sign.dart b/lib/utils/wbi_sign.dart index 39c883895..24fd9e7ca 100644 --- a/lib/utils/wbi_sign.dart +++ b/lib/utils/wbi_sign.dart @@ -10,7 +10,7 @@ import 'dart:convert'; import 'package:pilipala/utils/storage.dart'; class WbiSign { - static Box localCache = GStrorage.user; + static Box localCache = GStrorage.localCache; List mixinKeyEncTab = [ 46, 47,