From c8e157b2d609dfc3013157d6ff2c1e199b34e933 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 20 Jan 2024 22:31:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E9=A6=96=E9=A1=B5tabController=20in?= =?UTF-8?q?dex=E4=B8=8D=E5=8F=8A=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/controller.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/pages/home/controller.dart b/lib/pages/home/controller.dart index 3a742519..614d103a 100644 --- a/lib/pages/home/controller.dart +++ b/lib/pages/home/controller.dart @@ -41,6 +41,21 @@ class HomeController extends GetxController with GetTickerProviderStateMixin { ); hideSearchBar = setting.get(SettingBoxKey.hideSearchBar, defaultValue: true); + + // 监听 tabController 切换 + tabController.animation!.addListener(() { + if (tabController.indexIsChanging) { + if (initialIndex.value != tabController.index) { + initialIndex.value = tabController.index; + } + } else { + final int temp = tabController.animation!.value.round(); + if (initialIndex.value != temp) { + initialIndex.value = temp; + tabController.index = initialIndex.value; + } + } + }); } void onRefresh() { From 32f84dc7035e191d06131fdda700f4294a2e450d Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sat, 20 Jan 2024 22:48:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E9=A6=96=E9=A1=B5=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=8F=E5=9B=BE=E6=A0=87=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/home/view.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 49982c7d..f9823334 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:get/get.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/pages/mine/index.dart'; @@ -46,6 +47,13 @@ class _HomePageState extends State @override Widget build(BuildContext context) { super.build(context); + Brightness currentBrightness = MediaQuery.of(context).platformBrightness; + // 设置状态栏图标的亮度 + SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( + statusBarIconBrightness: currentBrightness == Brightness.light + ? Brightness.dark + : Brightness.light, + )); return Scaffold( extendBody: true, extendBodyBehindAppBar: true, @@ -129,7 +137,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { curve: Curves.easeInOutCubicEmphasized, duration: const Duration(milliseconds: 500), height: snapshot.data ? top + 52 : top, - padding: EdgeInsets.fromLTRB(14, top, 14, 0), + padding: EdgeInsets.fromLTRB(14, top + 6, 14, 0), child: UserInfoWidget( top: top, userLogin: isUserLoggedIn,