Skip to content

Commit

Permalink
#229 The mobile keypad does not close when tapping elsewhere on the s…
Browse files Browse the repository at this point in the history
…creen.

It is essential for the mobile keypad to close when the user taps anywhere on the screen;(especially Login, Registration and OTP screen) .
  • Loading branch information
lijogeorgep authored and georgepadayatti committed Nov 23, 2023
1 parent 1364fac commit 3edbf7d
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 68 deletions.
39 changes: 22 additions & 17 deletions lib/app/modules/login/views/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,28 @@ class LoginView extends BaseView<LoginController> {
final LoginController _loginController = Get.find();
@override
Widget body(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Center(
child: SingleChildScrollView(
child: Form(
key: _loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Logo(),
const SizedBox(height: 22),
_mobileNumberWidget(),
const SizedBox(height: 30),
_loginButtonWidget(context),
_RegisterWidget(),
],
return GestureDetector(
onTap: (){
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Center(
child: SingleChildScrollView(
child: Form(
key: _loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Logo(),
const SizedBox(height: 22),
_mobileNumberWidget(),
const SizedBox(height: 30),
_loginButtonWidget(context),
_RegisterWidget(),
],
),
),
),
),
Expand Down
37 changes: 21 additions & 16 deletions lib/app/modules/otp/views/otp_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,27 @@ class OtpView extends BaseView<OtpController> {

@override
Widget body(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const SizedBox(height: 22),
_otpTextFormWidget(),
const SizedBox(height: 15),
_resendOtpWidget(),
const SizedBox(height: 15),
_confirmButtonWidget(context),
_cancelButtonWidget(),
],
return GestureDetector(
onTap: (){
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const SizedBox(height: 22),
_otpTextFormWidget(),
const SizedBox(height: 15),
_resendOtpWidget(),
const SizedBox(height: 15),
_confirmButtonWidget(context),
_cancelButtonWidget(),
],
),
),
),
),
Expand Down
75 changes: 40 additions & 35 deletions lib/app/modules/register/views/register_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,45 +53,50 @@ class RegisterView extends BaseView<RegisterController> {

return true;
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Column(
children: [
Expanded(
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _registerController.pageController,
onPageChanged: (page) {
_registerController.selectedPage.value = page;
_registerController.selectedIndex.value = page;
},
children: [
_firstPage(context),
_secondPage(context),
_thirdPage(context),
],
child: GestureDetector(
onTap:(){
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Column(
children: [
Expanded(
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: _registerController.pageController,
onPageChanged: (page) {
_registerController.selectedPage.value = page;
_registerController.selectedIndex.value = page;
},
children: [
_firstPage(context),
_secondPage(context),
_thirdPage(context),
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Obx(
() => PageViewDotIndicator(
currentItem: _registerController.selectedPage.value,
count: _registerController.pageCount,
unselectedColor: Colors.black26,
selectedColor: Colors.black,
duration: const Duration(milliseconds: 200),
boxShape: BoxShape.circle,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Obx(
() => PageViewDotIndicator(
currentItem: _registerController.selectedPage.value,
count: _registerController.pageCount,
unselectedColor: Colors.black26,
selectedColor: Colors.black,
duration: const Duration(milliseconds: 200),
boxShape: BoxShape.circle,
),
),
),
),
const SizedBox(
height: 16,
),
],
const SizedBox(
height: 16,
),
],
),
bottomNavigationBar: _bottomNavigationBar(context),
),
bottomNavigationBar: _bottomNavigationBar(context),
),
);
}
Expand Down

0 comments on commit 3edbf7d

Please sign in to comment.