1+ import 'package:blogapp/Screen/HomeScreen.dart' ;
2+ import 'package:blogapp/Screen/ProfileScreen.dart' ;
13import 'package:flutter/material.dart' ;
24
35class HomePage extends StatefulWidget {
@@ -8,18 +10,59 @@ class HomePage extends StatefulWidget {
810}
911
1012class _HomePageState extends State <HomePage > {
13+ int currentState = 0 ;
14+ List <Widget > widgets = [HomeScreen (), ProfileScreen ()];
15+ List <String > titleString = ["Home Page" , "Profile Page" ];
16+
1117 @override
1218 Widget build (BuildContext context) {
1319 return Scaffold (
20+ drawer: Drawer (
21+ child: ListView (
22+ children: < Widget > [
23+ DrawerHeader (
24+ child: Column (
25+ children: < Widget > [
26+ Container (
27+ height: 100 ,
28+ width: 100 ,
29+ decoration: BoxDecoration (
30+ color: Colors .black,
31+ borderRadius: BorderRadius .circular (50 ),
32+ ),
33+ ),
34+ SizedBox (
35+ height: 10 ,
36+ ),
37+ Text ("@username" ),
38+ ],
39+ ),
40+ ),
41+ ListTile (
42+ title: Text ("all post" ),
43+ ),
44+ ],
45+ ),
46+ ),
47+ appBar: AppBar (
48+ backgroundColor: Colors .teal,
49+ title: Text (titleString[currentState]),
50+ centerTitle: true ,
51+ actions: < Widget > [
52+ IconButton (icon: Icon (Icons .notifications), onPressed: () {}),
53+ ],
54+ ),
1455 floatingActionButtonLocation: FloatingActionButtonLocation .centerDocked,
1556 floatingActionButton: FloatingActionButton (
16- onPressed: null ,
57+ backgroundColor: Colors .teal,
58+ onPressed: () {},
1759 child: Text (
1860 "+" ,
19- style: TextStyle (fontSize: 35 ),
61+ style: TextStyle (fontSize: 40 ),
2062 ),
2163 ),
2264 bottomNavigationBar: BottomAppBar (
65+ color: Colors .teal,
2366 shape: CircularNotchedRectangle (),
2467 notchMargin: 12 ,
2568 child: Container (
@@ -31,22 +74,30 @@ class _HomePageState extends State<HomePage> {
3174 children: < Widget > [
3275 IconButton (
3376 icon: Icon (Icons .home),
34- onPressed: null ,
35- iconSize: 35 ,
77+ color: currentState == 0 ? Colors .white : Colors .white54,
78+ onPressed: () {
79+ setState (() {
80+ currentState = 0 ;
81+ });
82+ },
83+ iconSize: 40 ,
3684 ),
3785 IconButton (
3886 icon: Icon (Icons .person),
39- onPressed: null ,
40- iconSize: 35 ,
87+ color: currentState == 1 ? Colors .white : Colors .white54,
88+ onPressed: () {
89+ setState (() {
90+ currentState = 1 ;
91+ });
92+ },
93+ iconSize: 40 ,
4194 )
4295 ],
4396 ),
4497 ),
4598 ),
4699 ),
47- body: Center (
48- child: Text ("Welcome on blog app" ),
49- ),
100+ body: widgets[currentState],
50101 );
51102 }
52103}
0 commit comments