Skip to content

Commit

Permalink
feat: WIP show info on home
Browse files Browse the repository at this point in the history
  • Loading branch information
deandreamatias committed Aug 31, 2023
1 parent 427512d commit 3c5bfe1
Showing 1 changed file with 52 additions and 4 deletions.
56 changes: 52 additions & 4 deletions lib/ui/widgets/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,72 @@
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/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:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';

class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});

@override
Widget build(BuildContext context) {
return const _ResponsiveWelcome();
return _ResponsiveWelcome(
child: Padding(
padding: Insets.a16,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: BodyLText('home.slogan'.tr())),
BoxSpacer.v16(),
Expanded(
child: Column(
children: [
BodyMText('home.appointment'.tr()),
BoxSpacer.v16(),
Row(
mainAxisSize: MainAxisSize.min,
children: [
PrimaryButton(
onPressed: () {},
label: 'home.contact_number'.tr(),
),
],
),
],
),
),
BoxSpacer.v16(),
],
),
),
);
}
}

class _ResponsiveWelcome extends StatelessWidget {
const _ResponsiveWelcome();
final Widget child;

const _ResponsiveWelcome({required this.child});

@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
final double screenWidth = constraints.maxWidth;
final double screenHeight = constraints.maxHeight;
// TODO: Implement small landscape layout

final double rectWidth = screenWidth * 0.8;
final double rectHeight = screenHeight * 0.7;
final double circleRadius = rectWidth * 0.25;
double circleRadius = screenWidth * 0.2;

// Verify if the circle radius is off the screen
// (behaind the top nav bar)
if (constraints.maxHeight < rectHeight + circleRadius * 1.34) {
circleRadius = screenHeight * 0.2;
}

return Stack(
children: [
Expand All @@ -38,6 +80,12 @@ class _ResponsiveWelcome extends StatelessWidget {
color: AppColors.primary,
borderRadius: BorderRadius.vertical(top: Radius.circular(8)),
),
child: Column(
children: [
BoxSpacer(verticalSpacing: circleRadius * 0.66),
Expanded(child: Center(child: child)),
],
),
),
),
Positioned(
Expand Down

0 comments on commit 3c5bfe1

Please sign in to comment.