Skip to content

Commit

Permalink
feat: ramp onboarding screen updates (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Merculiar authored Oct 26, 2024
1 parent e06dfc7 commit 2ecbf58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,29 +93,27 @@ class _RampOnboardingScreenState extends State<RampOnboardingScreen> {
header: FormPageHeader(
title: Text(context.l10n.rampBasicInfoRequired),
description: Text(context.l10n.yourEmailDisclaimer),
iconAlignment: Alignment.topCenter,
icon: Assets.images.profileGraphic,
),
child: Column(
children: [
_ProfileTextField(
emailController: _firstNameController,
rampType: widget.rampType,
inputType: TextInputType.name,
placeholder: context.l10n.yourFirstNamePlaceholder,
textCapitalization: TextCapitalization.words,
),
const SizedBox(height: 14),
_ProfileTextField(
emailController: _lastNameController,
rampType: widget.rampType,
inputType: TextInputType.name,
placeholder: context.l10n.yourLastNamePlaceholder,
textCapitalization: TextCapitalization.words,
),
const SizedBox(height: 14),
_ProfileTextField(
emailController: _emailController,
rampType: widget.rampType,
inputType: TextInputType.emailAddress,
placeholder: context.l10n.yourEmailPlaceholder,
),
Expand Down Expand Up @@ -146,20 +144,17 @@ class _RampOnboardingScreenState extends State<RampOnboardingScreen> {
class _ProfileTextField extends StatelessWidget {
const _ProfileTextField({
required this.emailController,
required this.rampType,
required this.inputType,
required this.placeholder,
this.textCapitalization = TextCapitalization.none,
});

final TextEditingController emailController;
final RampType rampType;
final TextInputType inputType;
final TextCapitalization textCapitalization;
final String placeholder;

static const _onRampTextfieldColor = Color(0xFFB84D12);
static const _offRampTextfieldColor = Color(0xFF9D8A59);
static const _rampTextfieldColor = Color(0xFF9D8A59);

@override
Widget build(BuildContext context) => CpTextField(
Expand All @@ -173,10 +168,7 @@ class _ProfileTextField extends StatelessWidget {
inputType: inputType,
textInputAction: TextInputAction.next,
textCapitalization: textCapitalization,
backgroundColor: switch (rampType) {
RampType.onRamp => _onRampTextfieldColor,
RampType.offRamp => _offRampTextfieldColor,
},
backgroundColor: _rampTextfieldColor,
placeholder: placeholder,
placeholderColor: Colors.white,
textColor: Colors.white,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import '../../../gen/assets.gen.dart';
import '../../../l10n/l10n.dart';
import '../../../ui/form_page.dart';
import '../models/ramp_type.dart';
Expand All @@ -23,15 +24,11 @@ class RampPage extends StatelessWidget {
RampType.offRamp => context.l10n.ramp_btnCashOut,
};

final colorTheme = switch (type) {
RampType.onRamp => FormPageColorTheme.orange,
RampType.offRamp => FormPageColorTheme.gold,
};

return FormPage(
title: Text(title.toUpperCase()),
colorTheme: colorTheme,
colorTheme: FormPageColorTheme.gold,
header: header,
backgroundImage: Assets.images.blank,
child: child,
);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/espressocash_app/lib/ui/form_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ class FormPageHeader extends StatelessWidget {
required this.title,
required this.description,
required this.icon,
this.iconAlignment = Alignment.bottomCenter,
});

final AssetGenImage icon;
final AlignmentGeometry iconAlignment;
final Widget title;
final Widget description;

Expand All @@ -91,7 +93,7 @@ class FormPageHeader extends StatelessWidget {
children: [
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
alignment: iconAlignment,
child: icon.image(),
),
),
Expand Down

0 comments on commit 2ecbf58

Please sign in to comment.