Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

fix: cta style #39

Merged
merged 9 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 7 additions & 1 deletion lib/home/widgets/welcome_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ class _WelcomeView extends StatelessWidget {
),
const SizedBox(height: 40),
PrimaryCTA(
icon: vertexIcons.arrowForward.image(),
icon: const CircleAvatar(
backgroundColor: VertexColors.white,
child: Icon(
Icons.arrow_forward,
omartinma marked this conversation as resolved.
Show resolved Hide resolved
color: VertexColors.googleBlue,
),
),
label: l10n.startAsking,
onPressed: () =>
context.read<HomeBloc>().add(const FromWelcomeToQuestion()),
Expand Down
21 changes: 21 additions & 0 deletions packages/app_ui/lib/src/theme/vertex_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class VertexTheme {
textTheme: _textTheme,
inputDecorationTheme: _inputDecorationTheme,
useMaterial3: true,
elevatedButtonTheme: _elevatedButtonTheme,
textButtonTheme: _textButtonTheme,
);
}

Expand Down Expand Up @@ -55,4 +57,23 @@ class VertexTheme {
contentPadding: const EdgeInsets.symmetric(vertical: 32),
);
}

static ElevatedButtonThemeData get _elevatedButtonTheme {
return ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
textStyle: _textTheme.bodyMedium,
backgroundColor: VertexColors.googleBlue,
foregroundColor: VertexColors.white,
),
);
}

static TextButtonThemeData get _textButtonTheme {
return TextButtonThemeData(
style: TextButton.styleFrom(
textStyle: _textTheme.bodyMedium,
foregroundColor: VertexColors.white,
),
);
}
}
33 changes: 13 additions & 20 deletions packages/app_ui/lib/src/widgets/primary_cta.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';

/// {@template primary_cta}
Expand All @@ -14,8 +13,8 @@ class PrimaryCTA extends StatelessWidget {
super.key,
});

/// The image that will be displayed on the left side of the button.
final Image? icon;
/// The widget that will be displayed on the left side of the button.
final Widget? icon;

/// The text that will be displayed on the right side of the button.
final String label;
Expand All @@ -27,31 +26,25 @@ class PrimaryCTA extends StatelessWidget {
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
style: ButtonStyle(
backgroundColor: const MaterialStatePropertyAll(
VertexColors.googleBlue,
),
padding: MaterialStatePropertyAll(
EdgeInsets.only(
left: icon != null ? 24 : 32,
top: 20,
bottom: 20,
right: 32,
),
style: ElevatedButton.styleFrom(
padding: EdgeInsets.only(
left: icon != null ? 8 : 32,
top: 20,
bottom: 20,
right: 32,
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) icon!,
if (icon != null)
Padding(
padding: const EdgeInsets.only(right: 16),
child: icon,
),
Text(
label,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: VertexColors.white,
),
),
],
),
Expand Down
15 changes: 6 additions & 9 deletions packages/app_ui/lib/src/widgets/tertiary_cta.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';

/// {@template tertiary_cta}
/// TertiaryCTA
/// side.
/// {@endtemplate}
class TertiaryCTA extends StatelessWidget {
/// {@macro tertiary_cta}
Expand All @@ -30,16 +28,15 @@ class TertiaryCTA extends StatelessWidget {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (icon != null) icon!,
Expanded(
if (icon != null)
Padding(
padding: const EdgeInsets.only(right: 4),
child: icon,
),
Flexible(
child: Text(
label,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: VertexColors.white,
),
),
),
],
Expand Down