Skip to content

Commit 19553d9

Browse files
committed
page: Move no-content placeholder widget to page.dart, from home.dart
We can reuse this for the empty message list.
1 parent 1faeaba commit 19553d9

File tree

5 files changed

+38
-37
lines changed

5 files changed

+38
-37
lines changed

lib/widgets/home.dart

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -148,40 +148,6 @@ class _HomePageState extends State<HomePage> {
148148
}
149149
}
150150

151-
/// A "no content here" message, for the Inbox, Subscriptions, and DMs pages.
152-
///
153-
/// This should go near the root of the "page body"'s widget subtree.
154-
/// In particular, it handles the horizontal device insets.
155-
/// (The vertical insets are handled externally, by the app bar and bottom nav.)
156-
class PageBodyEmptyContentPlaceholder extends StatelessWidget {
157-
const PageBodyEmptyContentPlaceholder({super.key, required this.message});
158-
159-
final String message;
160-
161-
@override
162-
Widget build(BuildContext context) {
163-
final designVariables = DesignVariables.of(context);
164-
165-
return SafeArea(
166-
minimum: EdgeInsets.symmetric(horizontal: 24),
167-
child: Padding(
168-
padding: EdgeInsets.only(top: 48, bottom: 16),
169-
child: Align(
170-
alignment: Alignment.topCenter,
171-
// TODO leading and trailing elements, like in Figma (given as SVGs):
172-
// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=5957-167736&m=dev
173-
child: Text(
174-
textAlign: TextAlign.center,
175-
style: TextStyle(
176-
color: designVariables.labelSearchPrompt,
177-
fontSize: 17,
178-
height: 23 / 17,
179-
).merge(weightVariableTextStyle(context, wght: 500)),
180-
message))));
181-
}
182-
}
183-
184-
185151
const kTryAnotherAccountWaitPeriod = Duration(seconds: 5);
186152

187153
class _LoadingPlaceholderPage extends StatefulWidget {

lib/widgets/inbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import '../model/narrow.dart';
66
import '../model/recent_dm_conversations.dart';
77
import '../model/unreads.dart';
88
import 'action_sheet.dart';
9-
import 'home.dart';
109
import 'icons.dart';
1110
import 'message_list.dart';
11+
import 'page.dart';
1212
import 'sticky_header.dart';
1313
import 'store.dart';
1414
import 'text.dart';

lib/widgets/page.dart

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import 'package:flutter/material.dart';
33

44
import 'store.dart';
5+
import 'text.dart';
6+
import 'theme.dart';
57

68
/// An [InheritedWidget] for near the root of a page's widget subtree,
79
/// providing its [BuildContext].
@@ -210,3 +212,36 @@ class LoadingPlaceholderPage extends StatelessWidget {
210212
);
211213
}
212214
}
215+
216+
/// A "no content here" message, for the Inbox, Subscriptions, and DMs pages.
217+
///
218+
/// This should go near the root of the "page body"'s widget subtree.
219+
/// In particular, it handles the horizontal device insets.
220+
/// (The vertical insets are handled externally, by the app bar and bottom nav.)
221+
class PageBodyEmptyContentPlaceholder extends StatelessWidget {
222+
const PageBodyEmptyContentPlaceholder({super.key, required this.message});
223+
224+
final String message;
225+
226+
@override
227+
Widget build(BuildContext context) {
228+
final designVariables = DesignVariables.of(context);
229+
230+
return SafeArea(
231+
minimum: EdgeInsets.symmetric(horizontal: 24),
232+
child: Padding(
233+
padding: EdgeInsets.only(top: 48, bottom: 16),
234+
child: Align(
235+
alignment: Alignment.topCenter,
236+
// TODO leading and trailing elements, like in Figma (given as SVGs):
237+
// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=5957-167736&m=dev
238+
child: Text(
239+
textAlign: TextAlign.center,
240+
style: TextStyle(
241+
color: designVariables.labelSearchPrompt,
242+
fontSize: 17,
243+
height: 23 / 17,
244+
).merge(weightVariableTextStyle(context, wght: 500)),
245+
message))));
246+
}
247+
}

lib/widgets/recent_dm_conversations.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import '../model/narrow.dart';
55
import '../model/recent_dm_conversations.dart';
66
import '../model/unreads.dart';
77
import 'content.dart';
8-
import 'home.dart';
98
import 'icons.dart';
109
import 'message_list.dart';
1110
import 'new_dm_sheet.dart';
11+
import 'page.dart';
1212
import 'store.dart';
1313
import 'text.dart';
1414
import 'theme.dart';

lib/widgets/subscription_list.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import '../generated/l10n/zulip_localizations.dart';
55
import '../model/narrow.dart';
66
import '../model/unreads.dart';
77
import 'action_sheet.dart';
8-
import 'home.dart';
98
import 'icons.dart';
109
import 'message_list.dart';
10+
import 'page.dart';
1111
import 'store.dart';
1212
import 'text.dart';
1313
import 'theme.dart';

0 commit comments

Comments
 (0)