Skip to content

Commit

Permalink
feat: WIP improve responsive info home
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Sep 2, 2023
1 parent 1c44958 commit d6de12c
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 44 deletions.
8 changes: 8 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"services": "services",
"gallery": "gallery"
},
"home": {
"slogan": "We take care of your pet\nas if it were ours",
"appointment": "Make an appointment",
"semantic_logo": "Logo of pet grooming salon Mimos",
"contact_number": "123456798",
"contact_number_tooltip": "Open dialer and call to {}",
"whatsapp_tooltip": "Open whatsapp and send a message to {}"
},
"errors": {
"not_found": "No se ha encontrado el recurso",
"server": "Error en el servidor",
Expand Down
8 changes: 8 additions & 0 deletions assets/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"services": "servicios",
"gallery": "galería"
},
"home": {
"slogan": "La peluquería que mima a tus mascotas\nDonde cuidamos a tu peludet",
"appointment": "Marca tu cita",
"semantic_logo": "Logo de la peluquería canina Mimos",
"contact_number": "123456798",
"contact_number_tooltip": "Abrir marcador y llamar a {}",
"whatsapp_tooltip": "Abrir WhatsApp y enviar mensaje a {}"
},
"errors": {
"not_found": "No se ha encontrado el recurso",
"server": "Error en el servidor",
Expand Down
8 changes: 8 additions & 0 deletions assets/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
"services": "serviços",
"gallery": "galeria"
},
"home": {
"slogan": "La peluquería que mima a tus mascotas\nDonde cuidamos a tu peludet",
"appointment": "Marque um horário",
"semantic_logo": "Logo da peluquería canina Mimos",
"contact_number": "123456798",
"contact_number_tooltip": "Abrir discador e ligar a {}",
"whatsapp_tooltip": "Abrir WhatsApp e enviar mensagem a {}"
},
"errors": {
"not_found": "No se ha encontrado el recurso",
"server": "Error en el servidor",
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/styles/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final themeData = ThemeData(
textStyle: MaterialStateProperty.all(TextStyles.labelLarge),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(36),
borderRadius: BorderRadius.circular(56),
),
),
),
Expand Down
16 changes: 0 additions & 16 deletions lib/ui/utils/responsive_sizes.dart

This file was deleted.

18 changes: 0 additions & 18 deletions lib/ui/widgets/components/buttons/home_button.dart

This file was deleted.

18 changes: 17 additions & 1 deletion lib/ui/widgets/components/buttons/primary_button.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import 'package:dog_gromming_website/ui/styles/app_colors.dart';
import 'package:dog_gromming_website/ui/styles/spacing.dart';
import 'package:dog_gromming_website/ui/widgets/components/texts/display_s_text.dart';
import 'package:flutter/material.dart';

class PrimaryButton extends StatelessWidget {
final VoidCallback onPressed;
final String label;
final bool isBigButton;
const PrimaryButton({
super.key,
required this.onPressed,
required this.label,
this.isBigButton = false,
});

@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
child: Text(label),
style: ElevatedButton.styleFrom(
padding: EdgeInsets.symmetric(
horizontal: isBigButton ? Spacing.sp24 : Spacing.sp16,
vertical: isBigButton ? Spacing.sp16 : Spacing.sp8,
),
),
child: isBigButton
? DisplaySText(
label,
color: AppColors.white,
)
: Text(label),
);
}
}
42 changes: 34 additions & 8 deletions lib/ui/widgets/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import 'package:dog_gromming_website/ui/styles/app_colors.dart';
import 'package:dog_gromming_website/ui/styles/insets.dart';
import 'package:dog_gromming_website/ui/styles/sizes.dart';
import 'package:dog_gromming_website/ui/widgets/components/assets/svg_image.dart';
import 'package:dog_gromming_website/ui/widgets/components/box_spacer.dart';
import 'package:dog_gromming_website/ui/widgets/components/buttons/primary_button.dart';
import 'package:dog_gromming_website/ui/widgets/components/texts/body_l_text.dart';
import 'package:dog_gromming_website/ui/widgets/components/texts/body_m_text.dart';
import 'package:dog_gromming_website/ui/widgets/components/texts/headline_m_text.dart';
import 'package:dog_gromming_website/ui/widgets/components/texts/headline_s_text.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';

Expand All @@ -13,23 +16,46 @@ class HomeScreen extends StatelessWidget {

@override
Widget build(BuildContext context) {
return _ResponsiveWelcome(
return const _WelcomeBoard(
child: Padding(
padding: Insets.a16,
child: Column(
child: _WelcomeBody(),
),
);
}
}

class _WelcomeBody extends StatelessWidget {
const _WelcomeBody();

@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final isMedium = constraints.maxWidth < Sizes.medium.width;

return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: BodyLText('home.slogan'.tr())),
Expanded(
child: isMedium
? HeadlineSText('home.slogan'.tr())
: HeadlineMText('home.slogan'.tr()),
),
BoxSpacer.v16(),
Expanded(
flex: 3,
child: Column(
children: [
BodyMText('home.appointment'.tr()),
isMedium
? BodyMText('home.appointment'.tr())
: BodyLText('home.appointment'.tr()),
BoxSpacer.v16(),
Row(
mainAxisSize: MainAxisSize.min,
children: [
PrimaryButton(
isBigButton: !isMedium,
onPressed: () {},
label: 'home.contact_number'.tr(),
),
Expand All @@ -40,16 +66,16 @@ class HomeScreen extends StatelessWidget {
),
BoxSpacer.v16(),
],
),
),
);
},
);
}
}

class _ResponsiveWelcome extends StatelessWidget {
class _WelcomeBoard extends StatelessWidget {
final Widget child;

const _ResponsiveWelcome({required this.child});
const _WelcomeBoard({required this.child});

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit d6de12c

Please sign in to comment.