aboutsummaryrefslogtreecommitdiffstats
path: root/lib/page_home.dart
diff options
context:
space:
mode:
authorFelipe Erias <felipeerias@igalia.com>2021-12-01 13:52:06 +0900
committerFelipe Erias <felipeerias@igalia.com>2021-12-01 13:52:06 +0900
commit51a805e0cf2d82795e738691dba9b3569bb9b555 (patch)
treebe72bed8ccac4b08ade046cb55390585d6174fd6 /lib/page_home.dart
parent91911d970149555f4d8b9bd841e879d693904cea (diff)
Add LayoutSizeHelper
Diffstat (limited to 'lib/page_home.dart')
-rw-r--r--lib/page_home.dart34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/page_home.dart b/lib/page_home.dart
index 1fbda1f..7b4bc79 100644
--- a/lib/page_home.dart
+++ b/lib/page_home.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import 'package:flutter_homescreen/layout_size_helper.dart';
class HomePage extends StatelessWidget {
final Function(int index) onSetNavigationIndex;
@@ -8,35 +9,34 @@ class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final double spacing = MediaQuery.of(context).size.width / 32;
- final double runSpacing = spacing / 2;
+ var themeHelper = LayoutSizeHelper(context);
return Container(
color: Colors.lightBlue.shade50,
constraints: BoxConstraints.expand(),
alignment: Alignment.center,
child: Wrap(
- spacing: spacing,
- runSpacing: runSpacing,
- children: <Widget>[
- createItem(context, Icons.drive_eta, 1),
- createItem(context, Icons.thermostat, 2),
- createItem(context, Icons.music_note, 3)
- ],
- ));
+ spacing: themeHelper.largePadding,
+ runSpacing: themeHelper.largePadding,
+ children: <Widget>[
+ createItem(themeHelper, Icons.drive_eta, 1),
+ createItem(themeHelper, Icons.thermostat, 2),
+ createItem(themeHelper, Icons.music_note, 3)
+ ],
+ ));
}
- Widget createItem(BuildContext context, IconData icon, int tabPosition) {
- final double size = MediaQuery.of(context).size.width / 6;
- final double padding = size / 4;
- final double border = padding / 4;
+ Widget createItem(
+ LayoutSizeHelper themeHelper, IconData icon, int tabPosition) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: OutlinedButton(
style: OutlinedButton.styleFrom(
shape: CircleBorder(),
- padding: EdgeInsets.all(padding),
+ padding: EdgeInsets.all(themeHelper.largePadding),
primary: Colors.lightBlue.shade400,
- side: BorderSide(width: border, color: Colors.lightBlue.shade400)
+ side: BorderSide(
+ width: themeHelper.defaultBorder,
+ color: Colors.lightBlue.shade400),
),
onPressed: () {
onSetNavigationIndex(tabPosition);
@@ -44,7 +44,7 @@ class HomePage extends StatelessWidget {
child: Icon(
icon,
color: Colors.lightBlue.shade800,
- size: size / 2,
+ size: themeHelper.largeIconSize,
),
),
);