Skip to content

Commit bb213e6

Browse files
committed
home: Make buttons higher contrast with page background in dark theme
An improvement that Greg pointed out: https://chat.zulip.org/#narrow/stream/48-mobile/topic/dark.20theme/near/1936853 This makes them the same color as the third-party login buttons, in 7c9c894.
1 parent c9f9c38 commit bb213e6

File tree

1 file changed

+60
-54
lines changed

1 file changed

+60
-54
lines changed

lib/widgets/app.dart

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ class HomePage extends StatelessWidget {
299299
final store = PerAccountStoreWidget.of(context);
300300
final zulipLocalizations = ZulipLocalizations.of(context);
301301

302+
final colorScheme = ColorScheme.of(context);
303+
302304
InlineSpan bold(String text) => TextSpan(
303305
style: const TextStyle().merge(weightVariableTextStyle(context, wght: 700)),
304306
text: text);
@@ -310,63 +312,67 @@ class HomePage extends StatelessWidget {
310312

311313
return Scaffold(
312314
appBar: ZulipAppBar(title: const Text("Home")),
313-
body: Center(
314-
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
315-
DefaultTextStyle.merge(
316-
textAlign: TextAlign.center,
317-
style: const TextStyle(fontSize: 18),
318-
child: Column(children: [
319-
const Text('🚧 Under construction 🚧'),
320-
const SizedBox(height: 12),
321-
Text.rich(TextSpan(
322-
text: 'Connected to: ',
323-
children: [bold(store.realmUrl.toString())])),
324-
Text.rich(TextSpan(
325-
text: 'Zulip server version: ',
326-
children: [bold(store.zulipVersion)])),
327-
Text(zulipLocalizations.subscribedToNChannels(store.subscriptions.length)),
328-
])),
329-
const SizedBox(height: 16),
330-
ElevatedButton(
331-
onPressed: () => Navigator.push(context,
332-
MessageListPage.buildRoute(context: context,
333-
narrow: const CombinedFeedNarrow())),
334-
child: Text(zulipLocalizations.combinedFeedPageTitle)),
335-
const SizedBox(height: 16),
336-
ElevatedButton(
337-
onPressed: () => Navigator.push(context,
338-
MessageListPage.buildRoute(context: context,
339-
narrow: const MentionsNarrow())),
340-
child: Text(zulipLocalizations.mentionsPageTitle)),
341-
const SizedBox(height: 16),
342-
ElevatedButton(
343-
onPressed: () => Navigator.push(context,
344-
MessageListPage.buildRoute(context: context,
345-
narrow: const StarredMessagesNarrow())),
346-
child: Text(zulipLocalizations.starredMessagesPageTitle)),
347-
const SizedBox(height: 16),
348-
ElevatedButton(
349-
onPressed: () => Navigator.push(context,
350-
InboxPage.buildRoute(context: context)),
351-
child: const Text("Inbox")), // TODO(i18n)
352-
const SizedBox(height: 16),
353-
ElevatedButton(
354-
onPressed: () => Navigator.push(context,
355-
SubscriptionListPage.buildRoute(context: context)),
356-
child: const Text("Subscribed channels")),
357-
const SizedBox(height: 16),
358-
ElevatedButton(
359-
onPressed: () => Navigator.push(context,
360-
RecentDmConversationsPage.buildRoute(context: context)),
361-
child: Text(zulipLocalizations.recentDmConversationsPageTitle)),
362-
if (testStreamId != null) ...[
315+
body: ElevatedButtonTheme(
316+
data: ElevatedButtonThemeData(style: ButtonStyle(
317+
backgroundColor: WidgetStatePropertyAll(colorScheme.secondaryContainer),
318+
foregroundColor: WidgetStatePropertyAll(colorScheme.onSecondaryContainer))),
319+
child: Center(
320+
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
321+
DefaultTextStyle.merge(
322+
textAlign: TextAlign.center,
323+
style: const TextStyle(fontSize: 18),
324+
child: Column(children: [
325+
const Text('🚧 Under construction 🚧'),
326+
const SizedBox(height: 12),
327+
Text.rich(TextSpan(
328+
text: 'Connected to: ',
329+
children: [bold(store.realmUrl.toString())])),
330+
Text.rich(TextSpan(
331+
text: 'Zulip server version: ',
332+
children: [bold(store.zulipVersion)])),
333+
Text(zulipLocalizations.subscribedToNChannels(store.subscriptions.length)),
334+
])),
335+
const SizedBox(height: 16),
336+
ElevatedButton(
337+
onPressed: () => Navigator.push(context,
338+
MessageListPage.buildRoute(context: context,
339+
narrow: const CombinedFeedNarrow())),
340+
child: Text(zulipLocalizations.combinedFeedPageTitle)),
341+
const SizedBox(height: 16),
342+
ElevatedButton(
343+
onPressed: () => Navigator.push(context,
344+
MessageListPage.buildRoute(context: context,
345+
narrow: const MentionsNarrow())),
346+
child: Text(zulipLocalizations.mentionsPageTitle)),
363347
const SizedBox(height: 16),
364348
ElevatedButton(
365349
onPressed: () => Navigator.push(context,
366350
MessageListPage.buildRoute(context: context,
367-
narrow: ChannelNarrow(testStreamId!))),
368-
child: const Text("#test here")), // scaffolding hack, see above
369-
],
370-
])));
351+
narrow: const StarredMessagesNarrow())),
352+
child: Text(zulipLocalizations.starredMessagesPageTitle)),
353+
const SizedBox(height: 16),
354+
ElevatedButton(
355+
onPressed: () => Navigator.push(context,
356+
InboxPage.buildRoute(context: context)),
357+
child: const Text("Inbox")), // TODO(i18n)
358+
const SizedBox(height: 16),
359+
ElevatedButton(
360+
onPressed: () => Navigator.push(context,
361+
SubscriptionListPage.buildRoute(context: context)),
362+
child: const Text("Subscribed channels")),
363+
const SizedBox(height: 16),
364+
ElevatedButton(
365+
onPressed: () => Navigator.push(context,
366+
RecentDmConversationsPage.buildRoute(context: context)),
367+
child: Text(zulipLocalizations.recentDmConversationsPageTitle)),
368+
if (testStreamId != null) ...[
369+
const SizedBox(height: 16),
370+
ElevatedButton(
371+
onPressed: () => Navigator.push(context,
372+
MessageListPage.buildRoute(context: context,
373+
narrow: ChannelNarrow(testStreamId!))),
374+
child: const Text("#test here")), // scaffolding hack, see above
375+
],
376+
]))));
371377
}
372378
}

0 commit comments

Comments
 (0)