-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
134 lines (127 loc) · 4.29 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import 'package:flutter/material.dart';
import 'package:works/Tabs/Call.dart';
import 'package:works/Tabs/Camera.dart';
import 'package:works/Tabs/Chats.dart';
import 'package:works/Tabs/Status.dart';
void main() => runApp(MaterialApp(
theme: ThemeData(
primaryColor: Color(0xff075e54), // Your primary color
// Your accent color
),
home: Homepage()));
class Homepage extends StatefulWidget {
_HomepageState createState() => _HomepageState();
}
class _HomepageState extends State<Homepage>
with SingleTickerProviderStateMixin {
late TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 4, vsync: this, initialIndex: 1);
_tabController.addListener(_handleTabChange);
}
@override
void dispose() {
_tabController.removeListener(_handleTabChange);
_tabController.dispose();
super.dispose();
}
void _handleTabChange() {
setState(() {
// Update the FloatingActionButton based on the current tab index
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("WhatsApp", style: TextStyle(color: Colors.white)),
backgroundColor: Color(0xff075e54),
actions: <Widget>[
IconButton(
onPressed: () {}, icon: Icon(Icons.search), color: Colors.white),
IconButton(
onPressed: () {},
icon: Icon(Icons.more_vert),
color: Colors.white),
],
bottom: TabBar(
indicatorColor: Colors.white,
controller: _tabController,
tabs: [
Tab(
child: Icon(Icons.camera_alt, color: Color(0xfff8f2f2)),
),
Tab(
child: Text(
'CHATS',
style: TextStyle(color: Color(0xfff8f2f2)),
)),
Tab(
child: Text(
'STATUS',
style: TextStyle(color: Color(0xfff8f2f2)),
)),
Tab(
child: Text(
'CALL',
style: TextStyle(color: Color(0xfff8f2f2)),
))
],
),
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
Camera(),
Chats(),
Status(),
Call(),
],
),
floatingActionButton: _tabController.index == 0
? FloatingActionButton(
backgroundColor: Color(0xff075e54),
child: Icon(Icons.camera_alt, color: Color(0xfff8f2f2)),
onPressed: () {},
)
: _tabController.index == 1
? FloatingActionButton(
backgroundColor: Color(0xff075e54),
child: Icon(Icons.message, color: Color(0xfff8f2f2)),
onPressed: () {},
)
: _tabController.index == 2
? Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
FloatingActionButton(
backgroundColor: Color(0xfff8f2f2),
child: Icon(Icons.edit,
color: Colors
.blueGrey), // Closing parenthesis added here
onPressed: () {},
),
SizedBox(height: 7),
FloatingActionButton(
backgroundColor: Color(0xff075e54),
child: Icon(Icons.camera_alt,
color: Color(
0xfff8f2f2)), // Closing parenthesis added here
onPressed: () {},
)
],
)
: _tabController.index == 3
? FloatingActionButton(
backgroundColor: Color(0xff075e54),
child: Icon(Icons.add_call,
color: Color(
0xfff8f2f2)), // Closing parenthesis added here
onPressed: () {},
)
: null,
); // Added null condition for other tab indices
}
}