Skip to content

Commit 561ecd5

Browse files
committed
🐛(fix) validation on forgot paasword.
1.:bug: Fix null bool related bug on forgot password page. 2.:green_apple: Add safe area on home and chat screen.
1 parent a3df4f6 commit 561ecd5

File tree

3 files changed

+29
-18
lines changed

3 files changed

+29
-18
lines changed

lib/page/Auth/forgetPasswordPage.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_twitter_clone/helper/theme.dart';
3+
import 'package:flutter_twitter_clone/helper/utility.dart';
34
import 'package:flutter_twitter_clone/state/authState.dart';
45
import 'package:flutter_twitter_clone/widgets/customWidgets.dart';
56
import 'package:provider/provider.dart';
@@ -104,6 +105,12 @@ class _ForgetPasswordPageState extends State<ForgetPasswordPage>{
104105
customSnackBar(_scaffoldKey, 'Email field cannot be empty');
105106
return;
106107
}
108+
var isValidEmail = validateEmal(_emailController.text, );
109+
if(!isValidEmail){
110+
customSnackBar(_scaffoldKey, 'Please enter valid email address');
111+
return;
112+
}
113+
107114
_focusNode.unfocus();
108115
var state = Provider.of<AuthState>(context,listen: false);
109116
state.forgetPassword(_emailController.text,scaffoldKey:_scaffoldKey);

lib/page/homePage.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ class _HomePageState extends State<HomePage> {
4141
state.databaseInit();
4242
state.getDataFromDatabase();
4343
}
44+
4445
void initProfile() {
4546
var state = Provider.of<AuthState>(context, listen: false);
4647
state.databaseInit();
4748
}
49+
4850
void initSearch() {
4951
var searchState = Provider.of<SearchState>(context, listen: false);
5052
searchState.getDataFromDatabase();
@@ -64,7 +66,7 @@ class _HomePageState extends State<HomePage> {
6466

6567
Widget _body() {
6668
var state = Provider.of<AppState>(context);
67-
return Container(child: _getPage(state.pageIndex));
69+
return SafeArea(child: Container(child: _getPage(state.pageIndex)));
6870
}
6971

7072
Widget _getPage(int index) {

lib/page/message/chatScreenPage.dart

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ class _ChatScreenPageState extends State<ChatScreenPage> {
131131
Clipboard.setData(text);
132132
_scaffoldKey.currentState.hideCurrentSnackBar();
133133
_scaffoldKey.currentState.showSnackBar(
134-
SnackBar(
135-
backgroundColor: TwitterColor.white,
136-
content: Text(
137-
'Message copied',
138-
style: TextStyle(color:Colors.black),
134+
SnackBar(
135+
backgroundColor: TwitterColor.white,
136+
content: Text(
137+
'Message copied',
138+
style: TextStyle(color: Colors.black),
139+
),
139140
),
140-
),
141-
);
141+
);
142142
},
143143
child: SizedBox(),
144144
),
@@ -287,17 +287,19 @@ class _ChatScreenPageState extends State<ChatScreenPage> {
287287
})
288288
],
289289
),
290-
body: Stack(
291-
children: <Widget>[
292-
Align(
293-
alignment: Alignment.topRight,
294-
child: Padding(
295-
padding: EdgeInsets.only(bottom: 50),
296-
child: _chatScreenBody(),
290+
body: SafeArea(
291+
child: Stack(
292+
children: <Widget>[
293+
Align(
294+
alignment: Alignment.topRight,
295+
child: Padding(
296+
padding: EdgeInsets.only(bottom: 50),
297+
child: _chatScreenBody(),
298+
),
297299
),
298-
),
299-
_bottomEntryField()
300-
],
300+
_bottomEntryField()
301+
],
302+
),
301303
),
302304
),
303305
);

0 commit comments

Comments
 (0)