@@ -213,7 +213,11 @@ class LoadingPlaceholderPage extends StatelessWidget {
213
213
}
214
214
}
215
215
216
- /// A "no content here" message for when a page has no content to show.
216
+ /// A placeholder for when a page body has no content to show.
217
+ ///
218
+ /// Pass [message] for a "no-content-here" message,
219
+ /// or pass true for [loading] if the content hasn't finished loading yet,
220
+ /// but don't pass both.
217
221
///
218
222
/// Suitable for the inbox, the message-list page, etc.
219
223
///
@@ -227,14 +231,30 @@ class LoadingPlaceholderPage extends StatelessWidget {
227
231
// TODO(#311) If the message list gets a bottom nav, the bottom inset will
228
232
// always be handled externally too; simplify implementation and dartdoc.
229
233
class PageBodyEmptyContentPlaceholder extends StatelessWidget {
230
- const PageBodyEmptyContentPlaceholder ({super .key, required this .message});
234
+ const PageBodyEmptyContentPlaceholder ({
235
+ super .key,
236
+ this .message,
237
+ this .loading = false ,
238
+ }) : assert ((message != null ) ^ loading);
231
239
232
- final String message;
240
+ final String ? message;
241
+ final bool loading;
233
242
234
243
@override
235
244
Widget build (BuildContext context) {
236
245
final designVariables = DesignVariables .of (context);
237
246
247
+ final child = loading
248
+ ? CircularProgressIndicator ()
249
+ : Text (
250
+ textAlign: TextAlign .center,
251
+ style: TextStyle (
252
+ color: designVariables.labelSearchPrompt,
253
+ fontSize: 17 ,
254
+ height: 23 / 17 ,
255
+ ).merge (weightVariableTextStyle (context, wght: 500 )),
256
+ message! );
257
+
238
258
return SafeArea (
239
259
minimum: EdgeInsets .fromLTRB (24 , 0 , 24 , 16 ),
240
260
child: Padding (
@@ -243,13 +263,6 @@ class PageBodyEmptyContentPlaceholder extends StatelessWidget {
243
263
alignment: Alignment .topCenter,
244
264
// TODO leading and trailing elements, like in Figma (given as SVGs):
245
265
// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=5957-167736&m=dev
246
- child: Text (
247
- textAlign: TextAlign .center,
248
- style: TextStyle (
249
- color: designVariables.labelSearchPrompt,
250
- fontSize: 17 ,
251
- height: 23 / 17 ,
252
- ).merge (weightVariableTextStyle (context, wght: 500 )),
253
- message))));
266
+ child: child)));
254
267
}
255
268
}
0 commit comments