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