From f60c0b9a1062466292bfe2933cf2ae14615986f8 Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Sun, 1 Jun 2025 15:02:38 +0800 Subject: [PATCH] opt dyn topic Signed-off-by: bggRGjQaUbCoE --- .../widgets/dynamic_sliver_appbar_medium.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/common/widgets/dynamic_sliver_appbar_medium.dart b/lib/common/widgets/dynamic_sliver_appbar_medium.dart index 010e9513..606666b7 100644 --- a/lib/common/widgets/dynamic_sliver_appbar_medium.dart +++ b/lib/common/widgets/dynamic_sliver_appbar_medium.dart @@ -119,15 +119,17 @@ class _DynamicSliverAppBarMediumState extends State { }); } - @override - void didChangeDependencies() { - _height = 0; - _updateHeight(); - super.didChangeDependencies(); - } + Orientation? _orientation; @override Widget build(BuildContext context) { + final orientation = MediaQuery.of(context).orientation; + if (orientation != _orientation) { + _orientation = orientation; + _height = 0; + _updateHeight(); + } + //Needed to lay out the flexibleSpace the first time, so we can calculate its intrinsic height if (_height == 0) { return SliverToBoxAdapter(