-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_bar_screen.dart
97 lines (92 loc) · 2.9 KB
/
custom_bar_screen.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
import 'package:flutter/material.dart';
import 'package:flutter_ui_source/custom_bar/custom_button_with_gradient.dart';
import 'package:flutter_ui_source/google_maps/constant/app_constant.dart';
class CustomBarScreen extends StatefulWidget {
const CustomBarScreen({Key? key}) : super(key: key);
@override
State<CustomBarScreen> createState() => _CustomBarScreenState();
}
class _CustomBarScreenState extends State<CustomBarScreen> {
int currentIndex = 0;
List<BottomNavigationBarItem> items(curIndex) => List.generate(
3,
(index) => BottomNavigationBarItem(
icon: Container(
alignment: Alignment.center,
constraints: const BoxConstraints(
maxHeight: 40,
maxWidth: 40,
),
margin: const EdgeInsets.all(0),
// padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
gradient: curIndex == index ? AppConstant.linearGradient : null,
borderRadius:
curIndex == index ? BorderRadius.circular(15) : null,
),
child: Icon(
index == 0
? Icons.add_a_photo_rounded
: index == 1
? Icons.account_balance_sharp
: Icons.settings,
),
),
label: '',
),
);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
// appBar: AppBar(
// backgroundColor: Colors.white,
// title: const Text('Custom Bar'),
// ),
bottomNavigationBar: Theme(
data: Theme.of(context).copyWith(
bottomAppBarTheme: const BottomAppBarTheme(
elevation: 0,
color: Colors.blue, // set the color of the bottom navigation bar
),
),
child: BottomNavigationBar(
selectedFontSize: 10,
items: items(currentIndex),
currentIndex: currentIndex,
onTap: (index) {
setState(() {
currentIndex = index;
});
},
// useLegacyColorScheme: true,
//enableFeedback: false,
// backgroundColor: Colors.white,
//elevation: 8,
// iconSize: 30,
selectedIconTheme: const IconThemeData(
size: 16.67,
color: Colors.white,
),
unselectedIconTheme: const IconThemeData(
size: 16.67,
color: Colors.grey,
),
),
),
body: Padding(
padding: const EdgeInsets.only(top: 100.0, left: 25, right: 25),
child: Column(
children: [
CustomButtonWithGradient(
gradient: AppConstant.linearGradient,
onPressed: () {},
radius: 25,
child: const Text('Download'),
),
],
),
),
);
}
}