File tree Expand file tree Collapse file tree 7 files changed +25
-27
lines changed Expand file tree Collapse file tree 7 files changed +25
-27
lines changed Original file line number Diff line number Diff line change @@ -253,9 +253,7 @@ class HomePage extends StatelessWidget {
253
253
}
254
254
255
255
return Scaffold (
256
- appBar: ZulipAppBar (
257
- title: const Text ("Home" ),
258
- isLoading: store.isLoading),
256
+ appBar: ZulipAppBar (title: const Text ("Home" )),
259
257
body: Center (
260
258
child: Column (mainAxisAlignment: MainAxisAlignment .center, children: [
261
259
DefaultTextStyle .merge (
Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
2
3
+ import 'store.dart' ;
4
+
3
5
/// A custom [AppBar] with a loading indicator.
4
6
///
5
7
/// This should be used for most of the pages with access to [PerAccountStore] .
@@ -12,11 +14,21 @@ class ZulipAppBar extends AppBar {
12
14
super .backgroundColor,
13
15
super .shape,
14
16
super .actions,
15
- required bool isLoading,
16
- }) : super (
17
- bottom: PreferredSize (
18
- preferredSize: const Size .fromHeight (4.0 ),
19
- child: (isLoading)
20
- ? LinearProgressIndicator (backgroundColor: backgroundColor, minHeight: 4.0 )
21
- : const SizedBox .shrink ()));
17
+ }) : super (bottom: _ZulipAppBarBottom (backgroundColor: backgroundColor));
18
+ }
19
+
20
+ class _ZulipAppBarBottom extends StatelessWidget implements PreferredSizeWidget {
21
+ const _ZulipAppBarBottom ({this .backgroundColor});
22
+
23
+ final Color ? backgroundColor;
24
+
25
+ @override
26
+ Size get preferredSize => const Size .fromHeight (4.0 );
27
+
28
+ @override
29
+ Widget build (BuildContext context) {
30
+ final store = PerAccountStoreWidget .of (context);
31
+ if (! store.isLoading) return const SizedBox .shrink ();
32
+ return LinearProgressIndicator (minHeight: 4.0 , backgroundColor: backgroundColor);
33
+ }
22
34
}
Original file line number Diff line number Diff line change @@ -161,9 +161,7 @@ class _InboxPageState extends State<InboxPage> with PerAccountStoreAwareStateMix
161
161
}
162
162
163
163
return Scaffold (
164
- appBar: ZulipAppBar (
165
- title: const Text ('Inbox' ),
166
- isLoading: store.isLoading),
164
+ appBar: ZulipAppBar (title: const Text ('Inbox' )),
167
165
body: SafeArea (
168
166
// Don't pad the bottom here; we want the list content to do that.
169
167
bottom: false ,
Original file line number Diff line number Diff line change @@ -271,7 +271,6 @@ class _MessageListPageState extends State<MessageListPage> implements MessageLis
271
271
return Scaffold (
272
272
appBar: ZulipAppBar (
273
273
title: MessageListAppBarTitle (narrow: narrow),
274
- isLoading: store.isLoading,
275
274
backgroundColor: appBarBackgroundColor,
276
275
shape: removeAppBarBottomBorder
277
276
? const Border ()
Original file line number Diff line number Diff line change @@ -103,9 +103,7 @@ class ProfilePage extends StatelessWidget {
103
103
];
104
104
105
105
return Scaffold (
106
- appBar: ZulipAppBar (
107
- title: Text (user.fullName),
108
- isLoading: store.isLoading),
106
+ appBar: ZulipAppBar (title: Text (user.fullName)),
109
107
body: SingleChildScrollView (
110
108
child: Center (
111
109
child: ConstrainedBox (
@@ -123,11 +121,8 @@ class _ProfileErrorPage extends StatelessWidget {
123
121
124
122
@override
125
123
Widget build (BuildContext context) {
126
- final store = PerAccountStoreWidget .of (context);
127
124
return Scaffold (
128
- appBar: ZulipAppBar (
129
- title: const Text ('Error' ),
130
- isLoading: store.isLoading),
125
+ appBar: ZulipAppBar (title: const Text ('Error' )),
131
126
body: const SingleChildScrollView (
132
127
child: Padding (
133
128
padding: EdgeInsets .symmetric (horizontal: 16 , vertical: 32 ),
Original file line number Diff line number Diff line change @@ -56,13 +56,11 @@ class _RecentDmConversationsPageState extends State<RecentDmConversationsPage> w
56
56
57
57
@override
58
58
Widget build (BuildContext context) {
59
- final store = PerAccountStoreWidget .of (context);
60
59
final zulipLocalizations = ZulipLocalizations .of (context);
61
60
final sorted = model! .sorted;
62
61
return Scaffold (
63
62
appBar: ZulipAppBar (
64
- title: Text (zulipLocalizations.recentDmConversationsPageTitle),
65
- isLoading: store.isLoading),
63
+ title: Text (zulipLocalizations.recentDmConversationsPageTitle)),
66
64
body: SafeArea (
67
65
// Don't pad the bottom here; we want the list content to do that.
68
66
bottom: false ,
Original file line number Diff line number Diff line change @@ -90,9 +90,7 @@ class _SubscriptionListPageState extends State<SubscriptionListPage> with PerAcc
90
90
_sortSubs (unpinned);
91
91
92
92
return Scaffold (
93
- appBar: ZulipAppBar (
94
- title: const Text ("Channels" ),
95
- isLoading: store.isLoading),
93
+ appBar: ZulipAppBar (title: const Text ("Channels" )),
96
94
body: SafeArea (
97
95
// Don't pad the bottom here; we want the list content to do that.
98
96
bottom: false ,
You can’t perform that action at this time.
0 commit comments