TF-2387 Handle system back button on login view mobile

This commit is contained in:
dab246
2024-01-02 19:55:21 +07:00
committed by Dat H. Pham
parent 4667d43f50
commit 6d643881dd
+43 -37
View File
@@ -26,44 +26,50 @@ class LoginView extends BaseLoginView {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeUtils.setSystemDarkUIStyle(); ThemeUtils.setSystemDarkUIStyle();
return Scaffold( return PopScope(
backgroundColor: AppColor.primaryLightColor, canPop: false,
body: GestureDetector( onPopInvoked: (didPop) => !didPop
onTap: () => FocusScope.of(context).unfocus(), ? controller.handleBackButtonAction(context)
child: Container( : null,
color: Colors.white, child: Scaffold(
child: SafeArea( backgroundColor: AppColor.primaryLightColor,
child: _supportScrollForm(context) body: GestureDetector(
? Stack(children: [ onTap: () => FocusScope.of(context).unfocus(),
Center( child: Container(
child: SingleChildScrollView( color: Colors.white,
scrollDirection: Axis.vertical, child: SafeArea(
child: _buildCenterForm(context) child: _supportScrollForm(context)
) ? Stack(children: [
), Center(
Obx(() { child: SingleChildScrollView(
if (controller.isBackButtonActivated) { scrollDirection: Axis.vertical,
return LoginBackButton( child: _buildCenterForm(context)
onBackAction: () => controller.handleBackButtonAction(context) )
); ),
} Obx(() {
return const SizedBox.shrink(); if (controller.isBackButtonActivated) {
}) return LoginBackButton(
]) onBackAction: () => controller.handleBackButtonAction(context)
: Stack(children: [ );
_buildCenterForm(context), }
Obx(() { return const SizedBox.shrink();
if (controller.isBackButtonActivated) { })
return LoginBackButton( ])
onBackAction: () => controller.handleBackButtonAction(context) : Stack(children: [
); _buildCenterForm(context),
} Obx(() {
return const SizedBox.shrink(); if (controller.isBackButtonActivated) {
}) return LoginBackButton(
]), onBackAction: () => controller.handleBackButtonAction(context)
);
}
return const SizedBox.shrink();
})
]),
),
), ),
), )),
)); );
} }
Widget _buildCenterForm(BuildContext context) { Widget _buildCenterForm(BuildContext context) {