Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resend verification code #507

Merged
merged 5 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/base/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ abstract final class Strings {
static const loginForgotYourPasscode = 'Forgot your passcode?';
static const loginForgot = 'Forgot?';

static const loginResendVerificationEmail = 'Resend verification email';
static const loginVerificationEmailSent = 'Verification email sent';
static String loginVerificationEMailBody(String email) =>
fremartini marked this conversation as resolved.
Show resolved Hide resolved
'We have sent an email to $email, please check your spam folder';

// Tickets
static const ticketsMyTickets = 'My tickets';
static const shopText = 'Shop';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';

abstract final class AppColor {
abstract final class AppColors {
static const primary = Color(0xff362619);
static const secondary = Color(0xff785B38);
static const background = Color(0xffE5E2D7);
Expand Down
114 changes: 114 additions & 0 deletions lib/base/style/app_text_styles.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import 'package:coffeecard/base/style/app_colors.dart';
import 'package:coffeecard/base/style/text_style_builder.dart';
import 'package:flutter/material.dart';

abstract final class AppTextStyle {
static final _heading = TextStyleBuilder.heading;
static final _body = TextStyleBuilder.body;
static final _mono = TextStyleBuilder.mono;

// Heading text
static final pageTitle = _heading.size(24).color(AppColors.white).style;

static final ownedTicket = _heading.size(24).color(AppColors.primary).style;

static final loginTitle = _heading.size(18).color(AppColors.white).style;

static final comingSoonShopCardTitle =
loginTitle.copyWith(color: AppColors.gray);

static final sectionTitle = loginTitle.copyWith(color: AppColors.primary);

static final environmentNotifier =
_heading.size(12).color(AppColors.primary).style;

// Body text
static final bottomNavBarLabel = _body.inheritSize().medium().style;

static final price = _body.size(18).color(AppColors.primary).bold().style;

static final _textFieldBase = _body.size(16).color(AppColors.primary);

static final textField = _textFieldBase.style;

static final textFieldBold = _textFieldBase.bold().style;

static final openingHoursIndicator =
_body.size(14).color(AppColors.primary).medium().style;

static final settingKey = _body.size(14).color(AppColors.primary).style;

static final settingKeyDestructive =
settingKey.copyWith(color: AppColors.errorOnBright);

static final settingValue = settingKey.copyWith(color: AppColors.secondary);

static final receiptItemKey =
_body.size(14).color(AppColors.primary).bold().style;

static final receiptItemValue = settingKey;

static final loginExplainer = settingKey.copyWith(color: AppColors.white);

static final loginError = settingKey.copyWith(color: AppColors.errorOnDark);

static final _buttonBase = _body.size(14).bold();

static final buttonText = _buttonBase.color(AppColors.white).style;

static final buttonTextDark = _buttonBase.color(AppColors.primary).style;

static final buttonTextDisabled = _buttonBase.color(AppColors.gray).style;

static final explainer = _body.size(12).color(AppColors.secondary).style;

static final explainerBright = _body
.size(12)
.color(AppColors.white)
.decoration(TextDecoration.none)
.style;

static final explainerDark = _body.size(12).color(AppColors.primary).style;

static final explainerBold =
_body.size(12).color(AppColors.secondary).bold().style;

static final loginLink =
_body.size(12).color(AppColors.white).underline().style;

static final overLine = _body.size(12).color(AppColors.primary).style;

static final newLabel = _body.size(12).color(AppColors.ticket).bold().style;

static final comingSoonLabel = newLabel.copyWith(color: AppColors.gray);

static final label = _body.size(11).color(AppColors.secondary).style;

static final labelUnfocused = _body.size(11).color(AppColors.gray).style;

static final explainerSmall = _body.size(11).color(AppColors.primary).style;

// Mono text
static final numpadDigit =
_mono.size(33).color(AppColors.primary).bold().style;

static final ticketsCount =
_mono.size(24).color(AppColors.primary).bold().style;

static final mixMatchTicketCount =
_mono.size(18).color(AppColors.primary).bold().style;

static final mixMatchTicketCountBright =
_mono.size(18).color(AppColors.white).bold().style;

static final numpadText =
_mono.size(16).color(AppColors.primary).bold().style;

static final leaderboardScore = _mono.size(14).color(AppColors.primary).style;

static final receiptItemDate =
_mono.size(12).color(AppColors.secondary).style;

static final rankingNumber =
_mono.size(12).color(AppColors.primary).bold().style;
}
112 changes: 0 additions & 112 deletions lib/base/style/text_styles.dart

This file was deleted.

18 changes: 9 additions & 9 deletions lib/base/style/theme.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import 'package:coffeecard/base/style/colors.dart';
import 'package:coffeecard/base/style/app_colors.dart';
import 'package:flutter/material.dart';

final ThemeData analogTheme = ThemeData(
appBarTheme: const AppBarTheme(centerTitle: false, elevation: 0),
primaryColor: AppColor.primary,
primaryColor: AppColors.primary,
brightness: Brightness.light,
visualDensity: VisualDensity.adaptivePlatformDensity,
primaryTextTheme:
const TextTheme(titleLarge: TextStyle(color: AppColor.white)),
primaryIconTheme: const IconThemeData(color: AppColor.primary),
canvasColor: AppColor.background,
const TextTheme(titleLarge: TextStyle(color: AppColors.white)),
primaryIconTheme: const IconThemeData(color: AppColors.primary),
canvasColor: AppColors.background,
textSelectionTheme:
const TextSelectionThemeData(cursorColor: AppColor.secondary),
disabledColor: AppColor.lightGray,
const TextSelectionThemeData(cursorColor: AppColors.secondary),
disabledColor: AppColors.lightGray,
pageTransitionsTheme: const PageTransitionsTheme(
// No intent of supporting aditional platforms
// ignore: avoid-missing-enum-constant-in-map
Expand All @@ -22,6 +22,6 @@ final ThemeData analogTheme = ThemeData(
},
),
colorScheme: ColorScheme.fromSwatch(
primarySwatch: AppColor.createMaterialColor(AppColor.primary),
).copyWith(background: AppColor.background),
primarySwatch: AppColors.createMaterialColor(AppColors.primary),
).copyWith(background: AppColors.background),
);
18 changes: 13 additions & 5 deletions lib/core/errors/failures.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import 'package:coffeecard/base/strings.dart';
import 'package:equatable/equatable.dart';

sealed class Failure extends Equatable {
abstract class Failure extends Equatable {
final String reason;

const Failure(this.reason);
Expand All @@ -22,7 +22,9 @@
}

class ServerFailure extends NetworkFailure {
const ServerFailure(super.reason);
final int statuscode;

const ServerFailure(super.reason, this.statuscode);

factory ServerFailure.fromResponse(Response response) {
try {
Expand All @@ -32,12 +34,18 @@
final message = jsonString['message'] as String?;

if (message == null) {
return const ServerFailure(Strings.unknownErrorOccured);
return ServerFailure(

Check warning on line 37 in lib/core/errors/failures.dart

View check run for this annotation

Codecov / codecov/patch

lib/core/errors/failures.dart#L37

Added line #L37 was not covered by tests
Strings.unknownErrorOccured,
response.statusCode,

Check warning on line 39 in lib/core/errors/failures.dart

View check run for this annotation

Codecov / codecov/patch

lib/core/errors/failures.dart#L39

Added line #L39 was not covered by tests
);
}

return ServerFailure(message);
return ServerFailure(message, response.statusCode);

Check warning on line 43 in lib/core/errors/failures.dart

View check run for this annotation

Codecov / codecov/patch

lib/core/errors/failures.dart#L43

Added line #L43 was not covered by tests
} on Exception {
return const ServerFailure(Strings.unknownErrorOccured);
return ServerFailure(
Strings.unknownErrorOccured,
response.statusCode,
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/core/widgets/form/form.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:coffeecard/base/strings.dart';
import 'package:coffeecard/base/style/colors.dart';
import 'package:coffeecard/base/style/app_colors.dart';
import 'package:coffeecard/cubits/form/form_bloc.dart';
import 'package:coffeecard/utils/input_validator.dart';
import 'package:coffeecard/widgets/components/section_title.dart';
Expand Down
16 changes: 8 additions & 8 deletions lib/core/widgets/form/form_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class _FormTextFieldState extends State<_FormTextField> {
UnderlineInputBorder get _defaultBorder {
return const UnderlineInputBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
borderSide: BorderSide(color: AppColor.gray),
borderSide: BorderSide(color: AppColors.gray),
);
}

Expand All @@ -75,7 +75,7 @@ class _FormTextFieldState extends State<_FormTextField> {
if (widget.showCheckMark) {
return const Icon(
Icons.check_circle_outline,
color: AppColor.secondary,
color: AppColors.secondary,
);
}
return null;
Expand Down Expand Up @@ -111,7 +111,7 @@ class _FormTextFieldState extends State<_FormTextField> {
onEditingComplete: widget.onEditingComplete,
cursorWidth: 1,
style: TextStyle(
color: AppColor.primary,
color: AppColors.primary,
letterSpacing: _isPasscode ? 3 : 0,
),
maxLength: widget.maxLength,
Expand All @@ -120,15 +120,15 @@ class _FormTextFieldState extends State<_FormTextField> {
enabledBorder: _defaultBorder,
focusedBorder: const UnderlineInputBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
borderSide: BorderSide(color: AppColor.secondary, width: 2),
borderSide: BorderSide(color: AppColors.secondary, width: 2),
),
labelText: widget.label,
labelStyle: const TextStyle(
color: AppColor.secondary,
color: AppColors.secondary,
letterSpacing: 0,
),
filled: true,
fillColor: AppColor.white.withOpacity(opacityLevel),
fillColor: AppColors.white.withOpacity(opacityLevel),
contentPadding: const EdgeInsets.only(
top: 8,
bottom: 12,
Expand All @@ -138,7 +138,7 @@ class _FormTextFieldState extends State<_FormTextField> {
helperText: widget.hint,
helperMaxLines: 2,
helperStyle: const TextStyle(
color: AppColor.secondary,
color: AppColors.secondary,
fontSize: 12,
fontWeight: FontWeight.w500,
),
Expand All @@ -163,7 +163,7 @@ class _FormTextFieldSpinner extends StatelessWidget {
height: 12,
child: Center(
child: CircularProgressIndicator(
color: AppColor.secondary,
color: AppColors.secondary,
strokeWidth: 2.2,
),
),
Expand Down
Loading