summaryrefslogtreecommitdiffstats
path: root/lib/page_home.dart
diff options
context:
space:
mode:
authorFelipe Erias <felipeerias@igalia.com>2021-11-12 12:06:32 +0900
committerFelipe Erias <felipeerias@igalia.com>2021-11-12 12:06:32 +0900
commit6cdae5992de2b9865a3a05885e91338160243674 (patch)
tree084dafb4361bb668726c3f54075184ec3aa6c6c6 /lib/page_home.dart
parent239ad725cd6e2b64974be4ab3949b38cb32eff7e (diff)
Home screen buttons navigate to the appropriate section
Diffstat (limited to 'lib/page_home.dart')
-rw-r--r--lib/page_home.dart43
1 files changed, 39 insertions, 4 deletions
diff --git a/lib/page_home.dart b/lib/page_home.dart
index 57b8e88..ede3e36 100644
--- a/lib/page_home.dart
+++ b/lib/page_home.dart
@@ -1,12 +1,47 @@
import 'package:flutter/material.dart';
class HomePage extends StatelessWidget {
- // TODO placeholder
+ final Function(int index) onSetNavigationIndex;
+
+ const HomePage({Key? key, required this.onSetNavigationIndex})
+ : super(key: key);
+
@override
Widget build(BuildContext context) {
- return Text(
- 'HOME',
- style: Theme.of(context).textTheme.headline1,
+ final double spacing = MediaQuery.of(context).size.width / 32;
+ final double runSpacing = spacing / 2;
+ return 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)
+ ],
+ ));
+ }
+
+ Widget createItem(BuildContext context, IconData icon, int tabPosition) {
+ final double size = MediaQuery.of(context).size.width / 6;
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0),
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ shape: CircleBorder(),
+ padding: EdgeInsets.all(size / 4),
+ primary: Colors.blue,
+ onPrimary: Colors.red,
+ ),
+ onPressed: () {
+ onSetNavigationIndex(tabPosition);
+ },
+ child: Icon(
+ icon,
+ color: Colors.white,
+ size: size / 2,
+ ),
+ ),
);
}
}