Skip to content

Commit f6f1b2c

Browse files
CubeRomanMagellanMagellan
andauthored
SK-605: Update UI for forgot password up flow (#102)
* SK-567: flutter sdk development (#90) * create monorepo * add api * remove client old api * add tokens management * rename sama_chat_api to sama_sdk * SK-578: share to image (#91) * create monorepo * add api * remove client old api * add tokens management * rename sama_chat_api to sama_sdk * add image share to support * fix Popup with Send Image after share again --------- Co-authored-by: Magellan <magellan@connectycube.com> * add check for deleted user opponent (#93) Co-authored-by: Magellan <magellan@connectycube.com> * add MediaAttachmentBloc to menu (#95) Co-authored-by: Magellan <magellan@connectycube.com> * SK-589: implement ability to take a photo (#92) * create monorepo * add api * remove client old api * add tokens management * rename sama_chat_api to sama_sdk * add image share to support * add image_picker * add camera picker * update agpVersion --------- Co-authored-by: Magellan <magellan@connectycube.com> * SK-587: Hard back does not work (#94) * add pop invoke * minor fix didPop * add swipe ios impl --------- Co-authored-by: Magellan <magellan@connectycube.com> * fix app routing (#96) Co-authored-by: Magellan <magellan@connectycube.com> * add blocking (#97) Co-authored-by: Magellan <magellan@connectycube.com> * add auto complete (#98) Co-authored-by: Magellan <magellan@connectycube.com> * fix reply bubble (#99) Co-authored-by: Magellan <magellan@connectycube.com> * update login page * add expending to reset password --------- Co-authored-by: Magellan <magellan@connectycube.com>
1 parent 07fd29d commit f6f1b2c

6 files changed

Lines changed: 337 additions & 366 deletions

File tree

sama_chat_client/lib/src/features/login/view/login_form.dart

Lines changed: 26 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'package:go_router/go_router.dart';
66

77
import '../../../navigation/constants.dart';
88
import '../../../shared/ui/colors.dart';
9-
import '../../../shared/ui/view/text_field_form.dart';
9+
import '../../../shared/ui/view/text_button_forms.dart';
1010
import '../bloc/login_bloc.dart';
1111
import '../models/models.dart';
1212

@@ -193,21 +193,18 @@ class _PasswordInputState extends State<_PasswordInput> {
193193
context.read<LoginBloc>().add(LoginPasswordChanged(password)),
194194
iconData: Icons.lock_outline,
195195
obscureText: isPasswordInvisible,
196-
suffix: Padding(
197-
padding: const EdgeInsets.only(right: 8),
198-
child: IconButton(
199-
onPressed: () {
200-
setState(() {
201-
isPasswordInvisible = !isPasswordInvisible;
202-
});
203-
},
204-
icon: Icon(
205-
isPasswordInvisible
206-
? Icons.visibility_off_outlined
207-
: Icons.visibility_outlined,
208-
color: dullGray,
209-
size: 20,
210-
),
196+
suffix: IconButton(
197+
onPressed: () {
198+
setState(() {
199+
isPasswordInvisible = !isPasswordInvisible;
200+
});
201+
},
202+
icon: Icon(
203+
isPasswordInvisible
204+
? Icons.visibility_off_outlined
205+
: Icons.visibility_outlined,
206+
color: dullGray,
207+
size: 22,
211208
),
212209
),
213210
hint: 'Password',
@@ -265,40 +262,19 @@ class _LoginButton extends StatelessWidget {
265262
var isSignUpValid = state.isValidSignup && isSignup;
266263
return state.status.isInProgress
267264
? const CircularProgressIndicator()
268-
: Container(
269-
decoration: const BoxDecoration(
270-
borderRadius: BorderRadius.all(
271-
Radius.circular(12),
272-
),
273-
),
274-
height: 46,
275-
width: double.infinity,
276-
child: FilledButton(
277-
style: ButtonStyle(
278-
backgroundColor: WidgetStatePropertyAll(
279-
isSignInValid || isSignUpValid
280-
? slateBlue
281-
: whiteAluminum),
282-
foregroundColor: WidgetStatePropertyAll(
283-
isSignInValid || isSignUpValid ? white : gainsborough),
284-
shape: WidgetStatePropertyAll<RoundedRectangleBorder>(
285-
RoundedRectangleBorder(
286-
borderRadius: BorderRadius.circular(22),
287-
),
288-
),
289-
),
290-
key: const Key('loginForm_continue_raisedButton'),
291-
onPressed: isSignInValid || isSignUpValid
292-
? () {
293-
context.read<LoginBloc>().add(
294-
LoginSubmitted(isSignup, isSighupWithLogin),
295-
);
296-
}
297-
: null,
298-
child: Text(isSignup ? 'Create account' : 'Login',
299-
style: const TextStyle(fontSize: 16)),
300-
),
301-
);
265+
: ButtonForm(
266+
onPressed: isSignInValid || isSignUpValid
267+
? () {
268+
context.read<LoginBloc>().add(
269+
LoginSubmitted(isSignup, isSighupWithLogin),
270+
);
271+
}
272+
: null,
273+
backgroundColor: WidgetStatePropertyAll(
274+
isSignInValid || isSignUpValid ? slateBlue : whiteAluminum),
275+
foregroundColor: WidgetStatePropertyAll(
276+
isSignInValid || isSignUpValid ? white : gainsborough),
277+
hint: isSignup ? 'Create account' : 'Login');
302278
},
303279
);
304280
}

sama_chat_client/lib/src/features/reset_password/view/reset_password_page.dart

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,24 @@ class ResetPasswordPage extends StatelessWidget {
5454
context.read<ResetPasswordBloc>().add(const OnBackCurrentForm());
5555
}
5656
}),
57-
body: Container(
58-
alignment: Alignment.topCenter,
59-
padding: const EdgeInsets.symmetric(horizontal: 28),
60-
child: ConstrainedBox(
61-
constraints: const BoxConstraints(maxWidth: 400),
62-
child: SingleChildScrollView(
63-
child: forms[state.currentForm],
57+
body: LayoutBuilder(builder: (context, constraint) {
58+
return Container(
59+
alignment: Alignment.topCenter,
60+
padding: const EdgeInsets.symmetric(horizontal: 28),
61+
child: ConstrainedBox(
62+
constraints: const BoxConstraints(maxWidth: 400),
63+
child: SingleChildScrollView(
64+
child: ConstrainedBox(
65+
constraints:
66+
BoxConstraints(minHeight: constraint.maxHeight),
67+
child: IntrinsicHeight(
68+
child: forms[state.currentForm],
69+
),
70+
),
71+
),
6472
),
65-
),
66-
),
73+
);
74+
}),
6775
bottomNavigationBar: SafeArea(
6876
child: SizedBox(
6977
height: 18,

sama_chat_client/lib/src/features/reset_password/view/send_email_form.dart

Lines changed: 44 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_bloc/flutter_bloc.dart';
33
import 'package:formz/formz.dart';
4+
import '../../../shared/ui/view/text_button_forms.dart';
45
import '../../../shared/utils/date_utils.dart';
56
import '../bloc/timer_bloc/timer_bloc.dart';
67
import '../models/models.dart';
@@ -37,7 +38,9 @@ class SendEmailForm extends StatelessWidget {
3738
const Padding(padding: EdgeInsets.all(8)),
3839
_EmailInput(),
3940
const Padding(padding: EdgeInsets.all(8)),
40-
_ContinueButton()
41+
const Spacer(),
42+
_ContinueButton(),
43+
const Padding(padding: EdgeInsets.all(16))
4144
],
4245
),
4346
);
@@ -50,46 +53,19 @@ class _EmailInput extends StatelessWidget {
5053
return BlocBuilder<ResetPasswordBloc, ResetPasswordState>(
5154
buildWhen: (previous, current) => previous.email != current.email,
5255
builder: (context, state) {
53-
return Container(
54-
padding: const EdgeInsets.all(8),
55-
decoration: const BoxDecoration(
56-
borderRadius: BorderRadius.all(
57-
Radius.circular(12),
58-
),
59-
color: gainsborough,
60-
),
61-
child: TextField(
62-
keyboardType: TextInputType.emailAddress,
56+
return TextFieldForm(
6357
onChanged: (email) =>
6458
context.read<ResetPasswordBloc>().add(EmailChanged(email)),
65-
enableSuggestions: false,
66-
autocorrect: false,
67-
decoration: InputDecoration(
68-
border: InputBorder.none,
69-
label: const Row(
70-
children: [
71-
Icon(
72-
Icons.email_outlined,
73-
size: 16,
74-
color: dullGray,
75-
),
76-
Padding(padding: EdgeInsets.all(4)),
77-
Text(
78-
'Email',
79-
style: TextStyle(color: dullGray, fontSize: 16),
80-
)
81-
],
82-
),
83-
errorText: state.email.displayError != null
84-
? state.email.displayError == EmailValidationError.empty
85-
? 'Email is too short'
86-
: state.email.displayError ==
87-
EmailValidationError.incorrect
88-
? 'The format of the email address is incorrect'
89-
: null
90-
: null),
91-
),
92-
);
59+
iconData: Icons.email_outlined,
60+
keyboardType: TextInputType.emailAddress,
61+
hint: 'Email',
62+
error: state.email.displayError != null
63+
? state.email.displayError == EmailValidationError.empty
64+
? 'Email is too short'
65+
: state.email.displayError == EmailValidationError.incorrect
66+
? 'The format of the email address is incorrect'
67+
: null
68+
: null);
9369
},
9470
);
9571
}
@@ -107,53 +83,37 @@ class _ContinueButton extends StatelessWidget {
10783
builder: (context, state) {
10884
return state.status.isInProgress
10985
? const CircularProgressIndicator()
110-
: Container(
111-
decoration: const BoxDecoration(
112-
borderRadius: BorderRadius.all(
113-
Radius.circular(12),
114-
),
115-
),
116-
height: 46,
117-
width: double.infinity,
118-
child: FilledButton(
119-
style: ButtonStyle(
120-
backgroundColor: WidgetStatePropertyAll(
121-
state.isEmailValid ? slateBlue : whiteAluminum),
122-
foregroundColor: WidgetStatePropertyAll(
123-
state.isEmailValid ? white : gainsborough),
124-
shape: WidgetStatePropertyAll<RoundedRectangleBorder>(
125-
RoundedRectangleBorder(
126-
borderRadius: BorderRadius.circular(12.0),
127-
),
128-
),
129-
),
130-
onPressed: state.isEmailValid
131-
? () {
132-
hideKeyboard();
133-
var time = context.read<TimerBloc>().state.duration;
134-
if (time != 0) {
135-
ScaffoldMessenger.of(context)
136-
..hideCurrentSnackBar()
137-
..showSnackBar(
138-
SnackBar(
139-
content: ValueListenableBuilder<String>(
140-
valueListenable: snackBarText,
141-
builder: (context, currentText, child) {
142-
return Text(currentText,
143-
textAlign: TextAlign.center);
144-
},
145-
),
86+
: ButtonForm(
87+
onPressed: state.isEmailValid
88+
? () {
89+
hideKeyboard();
90+
var time = context.read<TimerBloc>().state.duration;
91+
if (time != 0) {
92+
ScaffoldMessenger.of(context)
93+
..hideCurrentSnackBar()
94+
..showSnackBar(
95+
SnackBar(
96+
content: ValueListenableBuilder<String>(
97+
valueListenable: snackBarText,
98+
builder: (context, currentText, child) {
99+
return Text(currentText,
100+
textAlign: TextAlign.center);
101+
},
146102
),
147-
);
148-
} else {
149-
context
150-
.read<ResetPasswordBloc>()
151-
.add(const EmailSubmitted());
152-
}
103+
),
104+
);
105+
} else {
106+
context
107+
.read<ResetPasswordBloc>()
108+
.add(const EmailSubmitted());
153109
}
154-
: null,
155-
child: const Text('Continue'),
156-
));
110+
}
111+
: null,
112+
backgroundColor: WidgetStatePropertyAll(
113+
state.isEmailValid ? slateBlue : whiteAluminum),
114+
foregroundColor: WidgetStatePropertyAll(
115+
state.isEmailValid ? white : gainsborough),
116+
hint: 'Continue');
157117
},
158118
));
159119
}

0 commit comments

Comments
 (0)