opt: hide keyboard when switching login methods

This commit is contained in:
bggRGjQaUbCoE
2024-08-22 10:25:29 +08:00
parent d4eb95d477
commit 2db4c1caeb

View File

@@ -456,7 +456,16 @@ class _LoginPageState extends State<LoginPage> {
) )
: null, : null,
), ),
body: TabBarView( body: NotificationListener(
onNotification: (notification) {
if (notification is ScrollUpdateNotification) {
if (notification.metrics.axis == Axis.horizontal) {
FocusScope.of(context).unfocus();
}
}
return true;
},
child: TabBarView(
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
controller: _loginPageCtr.tabController, controller: _loginPageCtr.tabController,
children: [ children: [
@@ -465,6 +474,7 @@ class _LoginPageState extends State<LoginPage> {
tabViewOuter(loginByQRCode()), tabViewOuter(loginByQRCode()),
], ],
), ),
),
); );
}); });
} }
@@ -479,5 +489,4 @@ class _LoginPageState extends State<LoginPage> {
child: child, child: child,
))); )));
} }
} }