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

refactor: localizations and shadow styles #10

Merged
merged 5 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 0 additions & 3 deletions lib/app/constants/ui.dart

This file was deleted.

5 changes: 2 additions & 3 deletions lib/app/features/auth/views/pages/auth_page/auth_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/extensions/theme_data.dart';
import 'package:ice/app/features/auth/data/models/auth_state.dart';
Expand All @@ -21,6 +20,7 @@ import 'package:ice/app/shared/widgets/auth_header/auth_header.dart';
import 'package:ice/app/shared/widgets/button/button.dart';
import 'package:ice/app/shared/widgets/inputs/text_fields.dart';
import 'package:ice/app/shared/widgets/modal_wrapper.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/app/shared/widgets/secured_by/secured_by.dart';
import 'package:ice/app/shared/widgets/socials/socials.dart';
import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart';
Expand Down Expand Up @@ -53,8 +53,7 @@ class AuthPage extends HookConsumerWidget {
final PhoneNumberController numberController = PhoneNumberController();

return Scaffold(
body: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
body: ScreenSideOffset(
child: Column(
children: <Widget>[
AuthHeaderWidget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/extensions/theme_data.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart';
import 'package:ice/generated/assets.gen.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
Expand All @@ -21,8 +21,7 @@ class CheckEmail extends HookConsumerWidget {
TextEditingController(text: '1234');

return Scaffold(
body: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
body: ScreenSideOffset(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expand Down
237 changes: 120 additions & 117 deletions lib/app/features/auth/views/pages/enter_code/enter_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/extensions/theme_data.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/app/shared/widgets/terms_privacy/terms_privacy.dart';
import 'package:ice/generated/assets.gen.dart';
import 'package:pin_code_fields/pin_code_fields.dart';
Expand All @@ -24,127 +24,130 @@ class EnterCode extends HookConsumerWidget {
final ValueNotifier<bool> invalidCode = useState(false);

return Scaffold(
body: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
children: <Widget>[
const SizedBox(
height: 65,
),
Image.asset(
Assets.images.enterCode.path,
),
const SizedBox(
height: 9,
),
Text(
context.i18n.enter_code_title,
style: context.theme.appTextThemes.headline1,
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(context.i18n.enter_code_description),
Text(
phoneNumber,
style: context.theme.appTextThemes.subtitle,
),
Padding(
padding: const EdgeInsets.only(top: 30, bottom: 19),
child: SizedBox(
width: 248,
child: PinCodeTextField(
appContext: context,
length: 4,
animationType: AnimationType.fade,
cursorColor: Colors.black,
cursorWidth: 3,
cursorHeight: 25,
textStyle: context.theme.appTextThemes.inputFieldText,
pinTheme: PinTheme(
shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(16),
fieldHeight: 56,
fieldWidth: 50,
borderWidth: 1,
inactiveColor: invalidCode.value
? context.theme.appColors.attentionRed
: context.theme.appColors.strokeElements,
disabledColor: context.theme.appColors.strokeElements,
activeColor: invalidCode.value
? context.theme.appColors.attentionRed
: context.theme.appColors.primaryAccent,
errorBorderColor: context.theme.appColors.attentionRed,
activeFillColor: Colors.white,
inactiveFillColor: Colors.white,
selectedFillColor: Colors.white,
errorBorderWidth: 1,
activeBorderWidth: 1,
inactiveBorderWidth: 1,
disabledBorderWidth: 1,
selectedBorderWidth: 1,
body: ScreenSideOffset(
child: Container(
alignment: Alignment.center,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
children: <Widget>[
const SizedBox(
height: 65,
),
Image.asset(
Assets.images.enterCode.path,
),
const SizedBox(
height: 9,
),
Text(
context.i18n.enter_code_title,
style: context.theme.appTextThemes.headline1,
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(context.i18n.enter_code_description),
Text(
phoneNumber,
style: context.theme.appTextThemes.subtitle,
),
Padding(
padding: const EdgeInsets.only(top: 30, bottom: 19),
child: SizedBox(
width: 248,
child: PinCodeTextField(
appContext: context,
length: 4,
animationType: AnimationType.fade,
cursorColor: Colors.black,
cursorWidth: 3,
cursorHeight: 25,
textStyle: context.theme.appTextThemes.inputFieldText,
pinTheme: PinTheme(
shape: PinCodeFieldShape.box,
borderRadius: BorderRadius.circular(16),
fieldHeight: 56,
fieldWidth: 50,
borderWidth: 1,
inactiveColor: invalidCode.value
? context.theme.appColors.attentionRed
: context.theme.appColors.strokeElements,
disabledColor: context.theme.appColors.strokeElements,
activeColor: invalidCode.value
? context.theme.appColors.attentionRed
: context.theme.appColors.primaryAccent,
errorBorderColor:
context.theme.appColors.attentionRed,
activeFillColor: Colors.white,
inactiveFillColor: Colors.white,
selectedFillColor: Colors.white,
errorBorderWidth: 1,
activeBorderWidth: 1,
inactiveBorderWidth: 1,
disabledBorderWidth: 1,
selectedBorderWidth: 1,
),
animationDuration: const Duration(milliseconds: 300),
keyboardType: TextInputType.number,
errorAnimationController: errorController,
controller: codeController,
onCompleted: (String completed) {
if (completed != '1111') {
invalidCode.value = true;
errorController.add(
ErrorAnimationType.shake,
);
} else {
invalidCode.value = false;
}
},
onChanged: (String text) {
if (invalidCode.value) {
invalidCode.value = false;
}
},
beforeTextPaste: (String? text) {
return true;
},
),
animationDuration: const Duration(milliseconds: 300),
keyboardType: TextInputType.number,
errorAnimationController: errorController,
controller: codeController,
onCompleted: (String completed) {
if (completed != '1111') {
invalidCode.value = true;
errorController.add(
ErrorAnimationType.shake,
);
} else {
invalidCode.value = false;
}
},
onChanged: (String text) {
if (invalidCode.value) {
invalidCode.value = false;
}
},
beforeTextPaste: (String? text) {
return true;
},
),
),
),
if (invalidCode.value)
if (invalidCode.value)
Text(
context.i18n.enter_code_invalid_code,
style: context.theme.appTextThemes.body.copyWith(
color: context.theme.appColors.attentionRed,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
context.i18n.enter_code_available_in,
style: context.theme.appTextThemes.subtitle2,
),
Text(
context.i18n.enter_code_invalid_code,
style: context.theme.appTextThemes.body
.copyWith(color: context.theme.appColors.attentionRed),
' 30s', // TODO: Add countdown timer
style: context.theme.appTextThemes.subtitle2
.copyWith(color: context.theme.appColors.primaryAccent),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
context.i18n.enter_code_available_in,
style: context.theme.appTextThemes.subtitle2,
),
Text(
' 30s', // TODO: Add countdown timer
style: context.theme.appTextThemes.subtitle2
.copyWith(color: context.theme.appColors.primaryAccent),
),
],
),
Image.asset(
Assets.images.iceRound.path,
),
const Padding(
padding: EdgeInsets.only(bottom: 48),
child: TermsPrivacy(),
),
],
],
),
Image.asset(
Assets.images.iceRound.path,
),
const Padding(
padding: EdgeInsets.only(bottom: 48),
child: TermsPrivacy(),
),
],
),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/extensions/theme_data.dart';
import 'package:ice/app/features/auth/views/pages/fill_profile/controllers/inviter_controller.dart';
Expand All @@ -12,6 +11,7 @@ import 'package:ice/app/features/auth/views/pages/fill_profile/validators.dart';
import 'package:ice/app/shared/utility/image_picker_and_cropper/image_picker_and_cropper.dart';
import 'package:ice/app/shared/widgets/button/button.dart';
import 'package:ice/app/shared/widgets/inputs/text_fields.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/app/shared/widgets/text_field_wrapper/text_field_wrapper.dart';
import 'package:ice/generated/assets.gen.dart';
import 'package:image_cropper/image_cropper.dart';
Expand Down Expand Up @@ -83,8 +83,7 @@ class FillProfile extends HookConsumerWidget {

return Scaffold(
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
child: ScreenSideOffset(
child: Column(
children: <Widget>[
const SizedBox(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/features/auth/views/pages/nostr_login/nostr_login.dart';
import 'package:ice/app/shared/widgets/auth_header/auth_header.dart';
import 'package:ice/app/shared/widgets/button/button.dart';
import 'package:ice/app/shared/widgets/modal_wrapper.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/generated/assets.gen.dart';

class NostrAuth extends HookConsumerWidget {
Expand All @@ -28,8 +28,7 @@ class NostrAuth extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Scaffold(
body: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
body: ScreenSideOffset(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:ice/app/constants/ui.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/features/auth/views/pages/nostr_login/controllers/name_controller.dart';
import 'package:ice/app/shared/widgets/auth_header/auth_header.dart';
import 'package:ice/app/shared/widgets/button/button.dart';
import 'package:ice/app/shared/widgets/inputs/text_fields.dart';
import 'package:ice/app/shared/widgets/screen_side_offset/screen_side_offset.dart';
import 'package:ice/generated/assets.gen.dart';

class NostrLogin extends HookConsumerWidget {
Expand All @@ -16,8 +16,7 @@ class NostrLogin extends HookConsumerWidget {
final PrivateKeyController privateKeyController = PrivateKeyController();
return Scaffold(
body: SingleChildScrollView(
child: Container(
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
child: ScreenSideOffset(
child: Column(
children: <Widget>[
AuthHeaderWidget(
Expand Down
Loading
Loading