Skip to content

Commit

Permalink
chore: auth header widget
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-hector committed Dec 19, 2023
1 parent a9843a5 commit 088e200
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 21 deletions.
25 changes: 4 additions & 21 deletions lib/app/features/auth/views/pages/auth_page/auth_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:ice/app/features/auth/providers/auth_provider.dart';
import 'package:ice/app/features/auth/views/pages/check_email/check_email.dart';
import 'package:ice/app/features/auth/views/pages/fill_profile/fill_profile.dart';
import 'package:ice/app/features/auth/views/pages/select_country/select_country.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/email_input.dart';
import 'package:ice/app/shared/widgets/modal_wrapper.dart';
Expand Down Expand Up @@ -62,27 +63,9 @@ class AuthPage extends HookConsumerWidget {
margin: const EdgeInsets.symmetric(horizontal: kDefaultPadding),
child: Column(
children: <Widget>[
const SizedBox(
height: 65,
),
Image.asset(
Assets.images.iceRound.path,
),
const SizedBox(
height: 19,
),
Text(
'Get started',
style: context.theme.appTextThemes.headline1,
),
Text(
'Choose your login method',
style: context.theme.appTextThemes.body2.copyWith(
color: context.theme.appColors.tertararyText,
),
),
const SizedBox(
height: 35,
AuthHeaderWidget(
title: 'Get started',
description: 'Choose your login method',
),
EmailInput(formKey: emailFormKey),
const SizedBox(
Expand Down
55 changes: 55 additions & 0 deletions lib/app/shared/widgets/auth_header/auth_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/material.dart';
import 'package:ice/app/extensions/build_context.dart';
import 'package:ice/app/extensions/theme_data.dart';
import 'package:ice/generated/assets.gen.dart';

class AuthHeaderWidget extends StatelessWidget {
AuthHeaderWidget({
this.topPadding = 65.0,
this.bottomPadding = 30.0,
this.title = '',
String? description,
String? imagePath,
}) : description = description ?? '', // Ensure description is not null
imagePath = imagePath ?? Assets.images.iceRound.path;

final double topPadding;
final double bottomPadding;
final String title;
final String description;
final String imagePath;

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: topPadding),
child: Image.asset(
imagePath,
),
),
Padding(
padding: const EdgeInsets.only(top: 19, bottom: 3),
child: Text(
title,
style: context.theme.appTextThemes.headline1,
),
),
Visibility(
visible: description
.isNotEmpty, // Show the Text widget only if description is not empty
child: Text(
description,
style: context.theme.appTextThemes.body2.copyWith(
color: context.theme.appColors.tertararyText,
),
),
),
SizedBox(
height: bottomPadding,
),
],
);
}
}

0 comments on commit 088e200

Please sign in to comment.