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) {
ThemeUtils.setSystemDarkUIStyle();
return Scaffold(
backgroundColor: AppColor.primaryLightColor,
body: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
color: Colors.white,
child: SafeArea(
child: _supportScrollForm(context)
? Stack(children: [
Center(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: _buildCenterForm(context)
)
),
Obx(() {
if (controller.isBackButtonActivated) {
return LoginBackButton(
onBackAction: () => controller.handleBackButtonAction(context)
);
}
return const SizedBox.shrink();
})
])
: Stack(children: [
_buildCenterForm(context),
Obx(() {
if (controller.isBackButtonActivated) {
return LoginBackButton(
onBackAction: () => controller.handleBackButtonAction(context)
);
}
return const SizedBox.shrink();
})
]),
return PopScope(
canPop: false,
onPopInvoked: (didPop) => !didPop
? controller.handleBackButtonAction(context)
: null,
child: Scaffold(
backgroundColor: AppColor.primaryLightColor,
body: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
color: Colors.white,
child: SafeArea(
child: _supportScrollForm(context)
? Stack(children: [
Center(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: _buildCenterForm(context)
)
),
Obx(() {
if (controller.isBackButtonActivated) {
return LoginBackButton(
onBackAction: () => controller.handleBackButtonAction(context)
);
}
return const SizedBox.shrink();
})
])
: Stack(children: [
_buildCenterForm(context),
Obx(() {
if (controller.isBackButtonActivated) {
return LoginBackButton(
onBackAction: () => controller.handleBackButtonAction(context)
);
}
return const SizedBox.shrink();
})
]),
),
),
),
));
)),
);
}
Widget _buildCenterForm(BuildContext context) {