Skip to content

Commit

Permalink
Fixed UI issues for Un/Pw flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Jan 4, 2024
1 parent 33fd476 commit ea41e4c
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 48 deletions.
4 changes: 2 additions & 2 deletions assets/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1581,9 +1581,9 @@ msgstr "Get Lantern Pro"
msgid "try_lantern_pro"
msgstr "Try Lantern for free! "

msgid "continue_for_free"
msgstr "Continue for Free "

msgid "new_to_lantern"
msgstr "New to Lantern? "



Expand Down
23 changes: 18 additions & 5 deletions lib/account/auth/sign_in.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:email_validator/email_validator.dart';
import 'package:flutter/gestures.dart';
import '../../common/common.dart';

@RoutePage<void>(name: 'SignIn')
Expand Down Expand Up @@ -57,7 +58,7 @@ class _SignInState extends State<SignIn> {
label: widget.authFlow.isReset
? "lantern_pro_email".i18n
: "enter_email".i18n,
autovalidateMode: AutovalidateMode.onUserInteraction,

textInputAction: TextInputAction.done,
keyboardType: TextInputType.emailAddress,
prefixIcon: SvgPicture.asset(ImagePaths.email),
Expand All @@ -80,10 +81,22 @@ class _SignInState extends State<SignIn> {
const SizedBox(height: 24),
if (widget.authFlow.isSignIn &&
sessionModel.hasUserSignedInNotifier.value == false)
AppTextButton(
text: 'create_account'.i18n.toUpperCase(),
onPressed: openPlans,
)
RichText(
text: TextSpan(
text: 'new_to_lantern'.i18n,
style:
tsBody1.copyWith(fontWeight: FontWeight.w400, color: grey5),
children: [
TextSpan(
text: "create_account".i18n.toUpperCase(),
style: tsBody1.copyWith(
fontWeight: FontWeight.w500, color: pink5),
recognizer: TapGestureRecognizer()..onTap = openPlans,
),
],
),
),

],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/account/auth/verification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _VerificationState extends State<Verification> {
const SizedBox(height: 14),
if (!widget.authFlow.isVerifyEmail)
AppTextButton(
text: 'change_email'.i18n,
text: 'change_email'.i18n.toUpperCase(),
onPressed: () {
context.popRoute();
},
Expand Down
2 changes: 1 addition & 1 deletion lib/common/ui/base_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class BaseScreen extends StatelessWidget {
.short,
)
: title,
elevation: 1,
elevation: .5,
shadowColor: grey3,
foregroundColor: foregroundColor,
backgroundColor: backgroundColor,
Expand Down
2 changes: 1 addition & 1 deletion lib/common/ui/custom/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class _CTextFieldState extends State<CTextField> {
widget.textCapitalization ?? TextCapitalization.none,
decoration: InputDecoration(
contentPadding:
widget.contentPadding ?? const EdgeInsetsDirectional.all(0),
widget.contentPadding ?? const EdgeInsetsDirectional.all(10),
isDense: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
// we handle floating labels using our custom method below
Expand Down
75 changes: 39 additions & 36 deletions lib/common/ui/pin_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,7 @@ class PinField extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
onLongPress: () {
Clipboard.getData('text/plain').then((valueFromClipboard) {
if (valueFromClipboard != null &&
valueFromClipboard.text!.length == length) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: CText('Paste from clipboard?'.i18n, style: tsBody1),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: CText(
'No'.i18n,
style: tsButtonGrey,
),
),
TextButton(
onPressed: () {
controller.text = valueFromClipboard.text!;
Navigator.pop(context);
},
child: CText(
'Yes'.i18n,
style: tsButtonPink,
),
),
],
);
},
);
}
});
},
onLongPress: () => getClipboardData(context),
child: PinCodeTextField(
maxLength: length,
keyboardType: keyboardType,
Expand Down Expand Up @@ -85,4 +50,42 @@ class PinField extends StatelessWidget {
),
);
}

Future<void> getClipboardData(BuildContext context) async {
final copiedData = await Clipboard.getData('text/plain');
if (copiedData?.text != null) {
final code = copiedData!.text;
// ignore: use_build_context_synchronously
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: CText('Paste from clipboard?'.i18n, style: tsBody1),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: CText(
'No'.i18n,
style: tsButtonGrey,
),
),
TextButton(
onPressed: () {
controller.text = code!;
Navigator.pop(context);
onDone?.call(controller.text);
},
child: CText(
'Yes'.i18n,
style: tsButtonPink,
),
),
],
);
},
);
}
}
}
3 changes: 2 additions & 1 deletion lib/vpn/vpn_server_location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ class ServerLocationWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CText(
'Server Location'.i18n,
'${'Server Location'.i18n}:',
style: tsSubtitle3.copiedWith(
color: unselectedTabIconColor,
),
),
const SizedBox(width: 8),
Container(
transform: Matrix4.translationValues(0.0, 2.0, 0.0),
child: Icon(
Expand Down
2 changes: 1 addition & 1 deletion lib/vpn/vpn_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class VPNStatus extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CText(
'VPN Status'.i18n,
'${'VPN Status'.i18n}:',
style: tsSubtitle3.copiedWith(
color: unselectedTabIconColor,
),
Expand Down

0 comments on commit ea41e4c

Please sign in to comment.