1-
21import 'package:flutter/material.dart' ;
32
43import 'store.dart' ;
@@ -227,14 +226,49 @@ class LoadingPlaceholderPage extends StatelessWidget {
227226// TODO(#311) If the message list gets a bottom nav, the bottom inset will
228227// always be handled externally too; simplify implementation and dartdoc.
229228class PageBodyEmptyContentPlaceholder extends StatelessWidget {
230- const PageBodyEmptyContentPlaceholder ({super .key, required this .message});
229+ const PageBodyEmptyContentPlaceholder ({
230+ super .key,
231+ this .message,
232+ this .messageWithLinkMarkup,
233+ this .onTapLink,
234+ }) : assert (
235+ (message != null )
236+ ^ (messageWithLinkMarkup != null && onTapLink != null ));
231237
232- final String message;
238+ final String ? message;
239+ final String ? messageWithLinkMarkup;
240+ final VoidCallback ? onTapLink;
233241
234- @override
235- Widget build (BuildContext context) {
242+ TextStyle _messageStyle (BuildContext context) {
236243 final designVariables = DesignVariables .of (context);
237244
245+ return TextStyle (
246+ color: designVariables.labelSearchPrompt,
247+ fontSize: 17 ,
248+ height: 23 / 17 ,
249+ ).merge (weightVariableTextStyle (context, wght: 500 ));
250+ }
251+
252+ Widget ? _buildMessage (BuildContext context) {
253+ if (message != null ) {
254+ return Text (
255+ textAlign: TextAlign .center,
256+ style: _messageStyle (context),
257+ message! );
258+ }
259+ if (messageWithLinkMarkup != null ) {
260+ return TextWithLink (
261+ onTap: onTapLink! ,
262+ textAlign: TextAlign .center,
263+ style: _messageStyle (context),
264+ markup: messageWithLinkMarkup! );
265+ }
266+ assert (false );
267+ return null ;
268+ }
269+
270+ @override
271+ Widget build (BuildContext context) {
238272 return SafeArea (
239273 minimum: EdgeInsets .fromLTRB (24 , 0 , 24 , 16 ),
240274 child: Padding (
@@ -243,13 +277,6 @@ class PageBodyEmptyContentPlaceholder extends StatelessWidget {
243277 alignment: Alignment .topCenter,
244278 // TODO leading and trailing elements, like in Figma (given as SVGs):
245279 // 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))));
280+ child: _buildMessage (context))));
254281 }
255282}
0 commit comments