Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep for bottom tabs and main menu #1099

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/icons/ZulipIcons.ttf
Binary file not shown.
5 changes: 5 additions & 0 deletions assets/icons/contacts.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/hash_italic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/inbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/icons/menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions lib/widgets/action_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ class MessageActionSheetCancelButton extends StatelessWidget {
foregroundColor: designVariables.contextMenuCancelText,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(7)),
splashFactory: NoSplash.splashFactory,
).copyWith(backgroundColor: WidgetStateColor.resolveWith((states) =>
designVariables.contextMenuCancelBg.withFadedAlpha(
states.contains(WidgetState.pressed) ? 0.20 : 0.15))),
).copyWith(backgroundColor: WidgetStateColor.fromMap({
WidgetState.pressed: designVariables.contextMenuCancelPressedBg,
~WidgetState.pressed: designVariables.contextMenuCancelBg,
})),
onPressed: () {
Navigator.pop(context);
},
Expand Down
92 changes: 1 addition & 91 deletions lib/widgets/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ import 'package:flutter/scheduler.dart';
import '../generated/l10n/zulip_localizations.dart';
import '../log.dart';
import '../model/localizations.dart';
import '../model/narrow.dart';
import '../model/store.dart';
import '../notifications/display.dart';
import 'about_zulip.dart';
import 'actions.dart';
import 'app_bar.dart';
import 'dialog.dart';
import 'home.dart';
import 'inbox.dart';
import 'login.dart';
import 'message_list.dart';
import 'page.dart';
import 'recent_dm_conversations.dart';
import 'store.dart';
import 'subscription_list.dart';
import 'text.dart';
import 'theme.dart';

class ZulipApp extends StatefulWidget {
Expand Down Expand Up @@ -339,88 +334,3 @@ class ChooseAccountPageOverflowButton extends StatelessWidget {
});
}
}

class HomePage extends StatelessWidget {
const HomePage({super.key});

static Route<void> buildRoute({required int accountId}) {
return MaterialAccountWidgetRoute(accountId: accountId,
page: const HomePage());
}

@override
Widget build(BuildContext context) {
final store = PerAccountStoreWidget.of(context);
final zulipLocalizations = ZulipLocalizations.of(context);

final colorScheme = ColorScheme.of(context);

InlineSpan bold(String text) => TextSpan(
style: const TextStyle().merge(weightVariableTextStyle(context, wght: 700)),
text: text);

int? testStreamId;
if (store.connection.realmUrl.origin == 'https://chat.zulip.org') {
testStreamId = 7; // i.e. `#test here`; TODO cut this scaffolding hack
}

return Scaffold(
appBar: ZulipAppBar(title: const Text("Home")),
body: ElevatedButtonTheme(
data: ElevatedButtonThemeData(style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(colorScheme.secondaryContainer),
foregroundColor: WidgetStatePropertyAll(colorScheme.onSecondaryContainer))),
child: Center(
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
DefaultTextStyle.merge(
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18),
child: Column(children: [
Text.rich(TextSpan(
text: 'Connected to: ',
children: [bold(store.realmUrl.toString())])),
])),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const CombinedFeedNarrow())),
child: Text(zulipLocalizations.combinedFeedPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const MentionsNarrow())),
child: Text(zulipLocalizations.mentionsPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const StarredMessagesNarrow())),
child: Text(zulipLocalizations.starredMessagesPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
InboxPage.buildRoute(context: context)),
child: const Text("Inbox")), // TODO(i18n)
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
SubscriptionListPage.buildRoute(context: context)),
child: const Text("Subscribed channels")),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
RecentDmConversationsPage.buildRoute(context: context)),
child: Text(zulipLocalizations.recentDmConversationsPageTitle)),
if (testStreamId != null) ...[
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: ChannelNarrow(testStreamId!))),
child: const Text("#test here")), // scaffolding hack, see above
],
]))));
}
}
97 changes: 97 additions & 0 deletions lib/widgets/home.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import 'package:flutter/material.dart';

import '../generated/l10n/zulip_localizations.dart';
import '../model/narrow.dart';
import 'app_bar.dart';
import 'inbox.dart';
import 'message_list.dart';
import 'page.dart';
import 'recent_dm_conversations.dart';
import 'store.dart';
import 'subscription_list.dart';
import 'text.dart';

class HomePage extends StatelessWidget {
const HomePage({super.key});

static Route<void> buildRoute({required int accountId}) {
return MaterialAccountWidgetRoute(accountId: accountId,
page: const HomePage());
}

@override
Widget build(BuildContext context) {
final store = PerAccountStoreWidget.of(context);
final zulipLocalizations = ZulipLocalizations.of(context);

final colorScheme = ColorScheme.of(context);

InlineSpan bold(String text) => TextSpan(
style: const TextStyle().merge(weightVariableTextStyle(context, wght: 700)),
text: text);

int? testStreamId;
if (store.connection.realmUrl.origin == 'https://chat.zulip.org') {
testStreamId = 7; // i.e. `#test here`; TODO cut this scaffolding hack
}

return Scaffold(
appBar: ZulipAppBar(title: const Text("Home")),
body: ElevatedButtonTheme(
data: ElevatedButtonThemeData(style: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(colorScheme.secondaryContainer),
foregroundColor: WidgetStatePropertyAll(colorScheme.onSecondaryContainer))),
child: Center(
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
DefaultTextStyle.merge(
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 18),
child: Column(children: [
Text.rich(TextSpan(
text: 'Connected to: ',
children: [bold(store.realmUrl.toString())])),
])),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const CombinedFeedNarrow())),
child: Text(zulipLocalizations.combinedFeedPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const MentionsNarrow())),
child: Text(zulipLocalizations.mentionsPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: const StarredMessagesNarrow())),
child: Text(zulipLocalizations.starredMessagesPageTitle)),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
InboxPage.buildRoute(context: context)),
child: const Text("Inbox")), // TODO(i18n)
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
SubscriptionListPage.buildRoute(context: context)),
child: const Text("Subscribed channels")),
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
RecentDmConversationsPage.buildRoute(context: context)),
child: Text(zulipLocalizations.recentDmConversationsPageTitle)),
if (testStreamId != null) ...[
const SizedBox(height: 16),
ElevatedButton(
onPressed: () => Navigator.push(context,
MessageListPage.buildRoute(context: context,
narrow: ChannelNarrow(testStreamId!))),
child: const Text("#test here")), // scaffolding hack, see above
],
]))));
}
}
52 changes: 32 additions & 20 deletions lib/widgets/icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,65 +48,77 @@ abstract final class ZulipIcons {
/// The Zulip custom icon "clock".
static const IconData clock = IconData(0xf108, fontFamily: "Zulip Icons");

/// The Zulip custom icon "contacts".
static const IconData contacts = IconData(0xf109, fontFamily: "Zulip Icons");

/// The Zulip custom icon "copy".
static const IconData copy = IconData(0xf109, fontFamily: "Zulip Icons");
static const IconData copy = IconData(0xf10a, fontFamily: "Zulip Icons");

/// The Zulip custom icon "format_quote".
static const IconData format_quote = IconData(0xf10a, fontFamily: "Zulip Icons");
static const IconData format_quote = IconData(0xf10b, fontFamily: "Zulip Icons");

/// The Zulip custom icon "globe".
static const IconData globe = IconData(0xf10b, fontFamily: "Zulip Icons");
static const IconData globe = IconData(0xf10c, fontFamily: "Zulip Icons");

/// The Zulip custom icon "group_dm".
static const IconData group_dm = IconData(0xf10c, fontFamily: "Zulip Icons");
static const IconData group_dm = IconData(0xf10d, fontFamily: "Zulip Icons");

/// The Zulip custom icon "hash_italic".
static const IconData hash_italic = IconData(0xf10e, fontFamily: "Zulip Icons");

/// The Zulip custom icon "hash_sign".
static const IconData hash_sign = IconData(0xf10d, fontFamily: "Zulip Icons");
static const IconData hash_sign = IconData(0xf10f, fontFamily: "Zulip Icons");

/// The Zulip custom icon "image".
static const IconData image = IconData(0xf10e, fontFamily: "Zulip Icons");
static const IconData image = IconData(0xf110, fontFamily: "Zulip Icons");

/// The Zulip custom icon "inbox".
static const IconData inbox = IconData(0xf111, fontFamily: "Zulip Icons");

/// The Zulip custom icon "language".
static const IconData language = IconData(0xf10f, fontFamily: "Zulip Icons");
static const IconData language = IconData(0xf112, fontFamily: "Zulip Icons");

/// The Zulip custom icon "lock".
static const IconData lock = IconData(0xf110, fontFamily: "Zulip Icons");
static const IconData lock = IconData(0xf113, fontFamily: "Zulip Icons");

/// The Zulip custom icon "menu".
static const IconData menu = IconData(0xf114, fontFamily: "Zulip Icons");

/// The Zulip custom icon "message_feed".
static const IconData message_feed = IconData(0xf111, fontFamily: "Zulip Icons");
static const IconData message_feed = IconData(0xf115, fontFamily: "Zulip Icons");

/// The Zulip custom icon "mute".
static const IconData mute = IconData(0xf112, fontFamily: "Zulip Icons");
static const IconData mute = IconData(0xf116, fontFamily: "Zulip Icons");

/// The Zulip custom icon "read_receipts".
static const IconData read_receipts = IconData(0xf113, fontFamily: "Zulip Icons");
static const IconData read_receipts = IconData(0xf117, fontFamily: "Zulip Icons");

/// The Zulip custom icon "send".
static const IconData send = IconData(0xf114, fontFamily: "Zulip Icons");
static const IconData send = IconData(0xf118, fontFamily: "Zulip Icons");

/// The Zulip custom icon "share".
static const IconData share = IconData(0xf115, fontFamily: "Zulip Icons");
static const IconData share = IconData(0xf119, fontFamily: "Zulip Icons");

/// The Zulip custom icon "share_ios".
static const IconData share_ios = IconData(0xf116, fontFamily: "Zulip Icons");
static const IconData share_ios = IconData(0xf11a, fontFamily: "Zulip Icons");

/// The Zulip custom icon "smile".
static const IconData smile = IconData(0xf117, fontFamily: "Zulip Icons");
static const IconData smile = IconData(0xf11b, fontFamily: "Zulip Icons");

/// The Zulip custom icon "star".
static const IconData star = IconData(0xf118, fontFamily: "Zulip Icons");
static const IconData star = IconData(0xf11c, fontFamily: "Zulip Icons");

/// The Zulip custom icon "star_filled".
static const IconData star_filled = IconData(0xf119, fontFamily: "Zulip Icons");
static const IconData star_filled = IconData(0xf11d, fontFamily: "Zulip Icons");

/// The Zulip custom icon "topic".
static const IconData topic = IconData(0xf11a, fontFamily: "Zulip Icons");
static const IconData topic = IconData(0xf11e, fontFamily: "Zulip Icons");

/// The Zulip custom icon "unmute".
static const IconData unmute = IconData(0xf11b, fontFamily: "Zulip Icons");
static const IconData unmute = IconData(0xf11f, fontFamily: "Zulip Icons");

/// The Zulip custom icon "user".
static const IconData user = IconData(0xf11c, fontFamily: "Zulip Icons");
static const IconData user = IconData(0xf120, fontFamily: "Zulip Icons");

// END GENERATED ICON DATA
}
Expand Down
Loading