-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
113 lines (109 loc) · 3.59 KB
/
main.dart
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
// Remove the debug banner
debugShowCheckedModeBanner: false,
title: 'Rounded Bottom Navigation Bar',
theme: ThemeData(
primarySwatch: Colors.blueGrey,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Rounded Bottom Navigation Bar')),
body: const Center(
child: Text(
'Your text here!',
style: TextStyle(fontSize: 36, color: Colors.blue),
),
),
// implement BottomAppBar
bottomNavigationBar: BottomAppBar(
color: Colors.grey,
notchMargin: 6,
shape: const AutomaticNotchedShape(
// make rounded corners
RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(24)),
),
// create a notch for the floating action button
StadiumBorder(),
),
child: IconTheme(
data: const IconThemeData(color: Colors.white, size: 24),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
onPressed: () {
debugPrint('Home');
},
tooltip: 'Home',
icon: const Icon(Icons.home)),
IconButton(
padding: const EdgeInsets.fromLTRB(4, 0, 10, 0),
onPressed: () {
debugPrint('Search');
},
tooltip: 'Search',
icon: const Icon(Icons.search)),
// separator
const SizedBox(
width: 1,
height: 30,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.black26),
),
),
IconButton(
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
onPressed: () {
debugPrint('Profile');
},
tooltip: 'Profile',
color: Colors.deepPurple,
icon: const Icon(Icons.account_circle)),
IconButton(
padding: const EdgeInsets.fromLTRB(4, 0, 10, 0),
onPressed: () {
debugPrint('Settings');
},
tooltip: 'Settings',
color: Colors.indigo,
icon: const Icon(Icons.settings)),
],
),
),
),
),
// floating action button
floatingActionButton: FloatingActionButton.small(
onPressed: () {
debugPrint('Add new Item');
},
backgroundColor: Colors.black54,
tooltip: 'Add new Item',
foregroundColor: Colors.blue,
hoverColor: Colors.black38,
child: const Icon(Icons.add),
),
// position the floating action button
floatingActionButtonLocation: FloatingActionButtonLocation.endDocked,
);
}
}