1
1
import 'package:flutter/material.dart' ;
2
2
import 'package:firebase_auth/firebase_auth.dart' ;
3
3
import 'package:ncba_news/app_sections/feed.dart' ;
4
-
5
4
import 'app_screens/add_news.dart' ;
6
5
import 'app_screens/profile.dart' ;
7
6
import 'app_sections/admin.dart' ;
8
7
9
8
class MyHomePage extends StatefulWidget {
10
- const MyHomePage ({Key ? key}) : super ( key: key );
9
+ const MyHomePage ({super . key} );
11
10
12
11
@override
13
12
State <MyHomePage > createState () => _MyHomePageState ();
@@ -72,72 +71,78 @@ class _MyHomePageState extends State<MyHomePage> {
72
71
return Scaffold (
73
72
appBar: PreferredSize (
74
73
preferredSize: const Size .fromHeight (100.0 ),
75
- child: Padding (
76
- padding: const EdgeInsets .symmetric (horizontal: 16.0 , vertical: 8.0 ),
77
- child: Row (
78
- children: [
79
- Expanded (
80
- child: TextField (
81
- onTap: () {
82
- setState (() {
83
- _searchBarExpanded = true ;
84
- });
85
- },
86
- onTapOutside: (event) {
87
- setState (() {
88
- _searchBarExpanded = false ;
89
- });
90
- },
91
- onSubmitted: (value) {
92
- setState (() {
93
- _searchBarExpanded = false ;
94
- });
95
- },
96
- decoration: InputDecoration (
97
- contentPadding: const EdgeInsets .symmetric (horizontal: 20.0 , vertical: 10.0 ),
98
- hintText: 'Search' ,
99
- suffixIcon: IconButton (
100
- onPressed: () {},
101
- icon: const Icon (Icons .search),
102
- ),
103
- suffixIconConstraints: const BoxConstraints .tightFor (width: 50.0 ),
104
- filled: true ,
105
- border: OutlineInputBorder (
106
- borderRadius: BorderRadius .circular (30 ),
107
- borderSide: BorderSide .none,
108
- ),
109
- ),
110
- ),
111
- ),
112
- _searchBarExpanded
113
- ? Container ()
114
- : Row (
74
+ child: SafeArea (
75
+ child: Container (
76
+ color: Theme .of (context).appBarTheme.backgroundColor, // Set background color to avoid black overlay
77
+ child: Padding (
78
+ padding: const EdgeInsets .symmetric (horizontal: 16.0 , vertical: 8.0 ),
79
+ child: Row (
115
80
children: [
116
- const SizedBox (width: 5.0 ),
117
- Container (
118
- padding: const EdgeInsets .symmetric (horizontal: 10.0 , vertical: 4.0 ),
119
- decoration: BoxDecoration (
120
- color: Colors .grey[200 ],
121
- borderRadius: BorderRadius .circular (30 ),
122
- ),
123
- child: Row (
124
- children: [
125
- IconButton (
126
- onPressed: () {
127
- Navigator .push (context, MaterialPageRoute (builder: (context) => const Profile ()));
128
- },
129
- icon: const Icon (Icons .account_circle_outlined),
81
+ Expanded (
82
+ child: TextField (
83
+ onTap: () {
84
+ setState (() {
85
+ _searchBarExpanded = true ;
86
+ });
87
+ },
88
+ onTapOutside: (event) {
89
+ setState (() {
90
+ _searchBarExpanded = false ;
91
+ });
92
+ },
93
+ onSubmitted: (value) {
94
+ setState (() {
95
+ _searchBarExpanded = false ;
96
+ });
97
+ },
98
+ decoration: InputDecoration (
99
+ contentPadding: const EdgeInsets .symmetric (horizontal: 20.0 , vertical: 10.0 ),
100
+ hintText: 'Search' ,
101
+ suffixIcon: IconButton (
102
+ onPressed: () {},
103
+ icon: const Icon (Icons .search),
130
104
),
131
- IconButton (
132
- onPressed: _signOut,
133
- icon: const Icon (Icons .logout),
105
+ suffixIconConstraints: const BoxConstraints .tightFor (width: 50.0 ),
106
+ filled: true ,
107
+ fillColor: Colors .grey[200 ], // Ensure the fill color is set
108
+ border: OutlineInputBorder (
109
+ borderRadius: BorderRadius .circular (30 ),
110
+ borderSide: BorderSide .none,
134
111
),
135
- ] ,
112
+ ) ,
136
113
),
137
114
),
115
+ _searchBarExpanded
116
+ ? Container ()
117
+ : Row (
118
+ children: [
119
+ const SizedBox (width: 5.0 ),
120
+ Container (
121
+ padding: const EdgeInsets .symmetric (horizontal: 10.0 , vertical: 0.0 ),
122
+ decoration: BoxDecoration (
123
+ color: Colors .grey[200 ],
124
+ borderRadius: BorderRadius .circular (30 ),
125
+ ),
126
+ child: Row (
127
+ children: [
128
+ IconButton (
129
+ onPressed: () {
130
+ Navigator .push (context, MaterialPageRoute (builder: (context) => const Profile ()));
131
+ },
132
+ icon: const Icon (Icons .account_circle_outlined),
133
+ ),
134
+ IconButton (
135
+ onPressed: _signOut,
136
+ icon: const Icon (Icons .logout),
137
+ ),
138
+ ],
139
+ ),
140
+ ),
141
+ ],
142
+ ),
138
143
],
139
144
),
140
- ] ,
145
+ ) ,
141
146
),
142
147
),
143
148
),
@@ -164,7 +169,6 @@ class _MyHomePageState extends State<MyHomePage> {
164
169
currentPageIndex = index;
165
170
});
166
171
},
167
- // selectedIconTheme: const IconThemeData(color: Colors.black),
168
172
unselectedIconTheme: const IconThemeData (color: Colors .grey),
169
173
selectedItemColor: Colors .black,
170
174
items: [
0 commit comments