Skip to content

Commit 88154c9

Browse files
committed
home: Add empty-state illustrations and org icon
Use null-aware element in placeholder children Add leading and trailing support to empty content placeholder Add workflow to fix iOS build files
1 parent fbaa59e commit 88154c9

10 files changed

Lines changed: 90 additions & 4 deletions

assets/images/dm-arrow.svg.vec

2.48 KB
Binary file not shown.
3.71 KB
Binary file not shown.

assets/images/empty-dm.svg.vec

6.89 KB
Binary file not shown.

assets/images/empty-inbox.svg.vec

1.67 KB
Binary file not shown.

lib/widgets/inbox.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:vector_graphics/vector_graphics.dart';
23

34
import '../api/model/model.dart';
45
import '../generated/l10n/zulip_localizations.dart';
@@ -192,6 +193,19 @@ class _InboxPageState extends State<InboxPageBody> with PerAccountStoreAwareStat
192193

193194
if (items.isEmpty) {
194195
return PageBodyEmptyContentPlaceholder(
196+
illustration: VectorGraphic(
197+
loader: const AssetBytesLoader(
198+
'assets/images/empty-inbox.svg.vec',
199+
),
200+
width: 150,
201+
height: 150,
202+
colorFilter: ColorFilter.mode(
203+
DesignVariables.of(context)
204+
.labelSearchPrompt
205+
.withValues(alpha: 0.8),
206+
BlendMode.srcIn,
207+
),
208+
),
195209
// TODO(#315) add e.g. "You might be interested in recent conversations."
196210
header: zulipLocalizations.inboxEmptyPlaceholderHeader,
197211
message: zulipLocalizations.inboxEmptyPlaceholderMessage);

lib/widgets/page.dart

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,26 @@ class LoadingPlaceholderPage extends StatelessWidget {
252252
class PageBodyEmptyContentPlaceholder extends StatelessWidget {
253253
const PageBodyEmptyContentPlaceholder({
254254
super.key,
255+
this.illustration,
255256
this.header,
256257
this.headerWithLinkMarkup,
257258
this.onTapHeaderLink,
258259
this.message,
259260
this.messageWithLinkMarkup,
260261
this.onTapMessageLink,
262+
this.trailing,
261263
}) : assert(
262264
(header != null)
263265
^ (headerWithLinkMarkup != null && onTapHeaderLink != null));
264266

267+
final Widget? illustration;
265268
final String? header;
266269
final String? headerWithLinkMarkup;
267270
final VoidCallback? onTapHeaderLink;
268271
final String? message;
269272
final String? messageWithLinkMarkup;
270273
final VoidCallback? onTapMessageLink;
274+
final Widget? trailing;
271275

272276
TextStyle _headerStyle(BuildContext context) {
273277
final designVariables = DesignVariables.of(context);
@@ -335,10 +339,18 @@ class PageBodyEmptyContentPlaceholder extends StatelessWidget {
335339
spacing: 16,
336340
crossAxisAlignment: CrossAxisAlignment.center,
337341
children: [
338-
// TODO leading and trailing elements, like in Figma (given as SVGs):
339-
// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=5957-167736&m=dev
342+
?illustration,
343+
// TODO leading and trailing elements...
340344
header,
341345
?message,
342-
]))));
346+
...[
347+
const SizedBox(height: 8),
348+
?trailing,
349+
],
350+
]
351+
),
352+
),
353+
),
354+
);
343355
}
344356
}

lib/widgets/recent_dm_conversations.dart

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:vector_graphics/vector_graphics.dart';
23

34
import '../generated/l10n/zulip_localizations.dart';
45
import '../model/narrow.dart';
@@ -108,8 +109,35 @@ class _RecentDmConversationsPageBodyState extends State<RecentDmConversationsPag
108109
children: [
109110
if (sorted.isEmpty)
110111
PageBodyEmptyContentPlaceholder(
112+
illustration: VectorGraphic(
113+
loader: const AssetBytesLoader(
114+
'assets/images/empty-dm.svg.vec',
115+
),
116+
width: 150,
117+
height: 150,
118+
colorFilter: ColorFilter.mode(
119+
DesignVariables.of(context)
120+
.labelSearchPrompt
121+
.withValues(alpha: 0.8),
122+
BlendMode.srcIn,
123+
),
124+
),
111125
header: zulipLocalizations.recentDmConversationsEmptyPlaceholderHeader,
112-
message: zulipLocalizations.recentDmConversationsEmptyPlaceholderMessage)
126+
message: zulipLocalizations.recentDmConversationsEmptyPlaceholderMessage,
127+
trailing: VectorGraphic(
128+
loader: const AssetBytesLoader(
129+
'assets/images/dm-arrow.svg.vec',
130+
),
131+
width: 150,
132+
height: 150,
133+
colorFilter: ColorFilter.mode(
134+
DesignVariables.of(context)
135+
.labelSearchPrompt
136+
.withValues(alpha: 0.8),
137+
BlendMode.srcIn,
138+
),
139+
),
140+
)
113141
else
114142
SafeArea(
115143
// Don't pad the bottom here; we want the list content to do that.

lib/widgets/subscription_list.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:vector_graphics/vector_graphics.dart';
23

34
import '../api/model/model.dart';
45
import '../generated/l10n/zulip_localizations.dart';
@@ -137,6 +138,19 @@ class _SubscriptionListPageBodyState extends State<SubscriptionListPageBody> wit
137138
if (pinned.isEmpty && unpinned.isEmpty) {
138139
if (includeAllChannelsButton) {
139140
return PageBodyEmptyContentPlaceholder(
141+
illustration: VectorGraphic(
142+
loader: const AssetBytesLoader(
143+
'assets/images/empty-channel.svg.vec',
144+
),
145+
width: 150,
146+
height: 150,
147+
colorFilter: ColorFilter.mode(
148+
DesignVariables.of(context)
149+
.labelSearchPrompt
150+
.withValues(alpha: 0.8),
151+
BlendMode.srcIn,
152+
),
153+
),
140154
header: zulipLocalizations.channelsEmptyPlaceholderHeader,
141155
messageWithLinkMarkup:
142156
zulipLocalizations.channelsEmptyPlaceholderMessage(

pubspec.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,6 +1275,22 @@ packages:
12751275
url: "https://pub.dev"
12761276
source: hosted
12771277
version: "4.5.3"
1278+
vector_graphics:
1279+
dependency: "direct main"
1280+
description:
1281+
name: vector_graphics
1282+
sha256: "2306c03da2ba81724afeb589c351ebbc0aa7d86005925be8f8735856dbe5e42d"
1283+
url: "https://pub.dev"
1284+
source: hosted
1285+
version: "1.2.2"
1286+
vector_graphics_codec:
1287+
dependency: transitive
1288+
description:
1289+
name: vector_graphics_codec
1290+
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
1291+
url: "https://pub.dev"
1292+
source: hosted
1293+
version: "1.1.13"
12781294
vector_math:
12791295
dependency: transitive
12801296
description:

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ dependencies:
6363
unorm_dart: ^0.3.1+1
6464
url_launcher: ^6.1.11
6565
url_launcher_android: ">=6.1.0"
66+
vector_graphics: 1.2.2
6667
video_player: ^2.10.0
6768
wakelock_plus: ^1.2.8
6869
zulip_plugin:
@@ -121,6 +122,7 @@ flutter:
121122
uses-material-design: true
122123

123124
assets:
125+
- assets/images/
124126
- assets/KaTeX/LICENSE
125127
- assets/Noto_Color_Emoji/LICENSE
126128
- assets/Pygments/AUTHORS.txt

0 commit comments

Comments
 (0)