1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
import 'package:flutter/material.dart';
import 'package:flutter_homescreen/layout_size_helper.dart';
class HomePage extends StatelessWidget {
final Function(int index) onSetNavigationIndex;
const HomePage({Key? key, required this.onSetNavigationIndex})
: super(key: key);
@override
Widget build(BuildContext context) {
var themeHelper = LayoutSizeHelper(context);
return Container(
color: Colors.lightBlue.shade50,
constraints: BoxConstraints.expand(),
alignment: Alignment.center,
child: Wrap(
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(
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(themeHelper.largePadding),
primary: Colors.lightBlue.shade400,
side: BorderSide(
width: themeHelper.defaultBorder,
color: Colors.lightBlue.shade400),
),
onPressed: () {
onSetNavigationIndex(tabPosition);
},
child: Icon(
icon,
color: Colors.lightBlue.shade800,
size: themeHelper.largeIconSize,
),
),
);
}
}
|