@@ -213,7 +213,11 @@ class LoadingPlaceholderPage extends StatelessWidget {
213213 }
214214}
215215
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.
217221///
218222/// Suitable for the inbox, the message-list page, etc.
219223///
@@ -227,14 +231,30 @@ class LoadingPlaceholderPage extends StatelessWidget {
227231// TODO(#311) If the message list gets a bottom nav, the bottom inset will
228232// always be handled externally too; simplify implementation and dartdoc.
229233class 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);
231239
232- final String message;
240+ final String ? message;
241+ final bool loading;
233242
234243 @override
235244 Widget build (BuildContext context) {
236245 final designVariables = DesignVariables .of (context);
237246
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+
238258 return SafeArea (
239259 minimum: EdgeInsets .fromLTRB (24 , 0 , 24 , 16 ),
240260 child: Padding (
@@ -243,13 +263,6 @@ class PageBodyEmptyContentPlaceholder extends StatelessWidget {
243263 alignment: Alignment .topCenter,
244264 // TODO leading and trailing elements, like in Figma (given as SVGs):
245265 // 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)));
254267 }
255268}
0 commit comments