Skip to content

Icon for "switch account" in main menu #1338

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

Merged
merged 2 commits into from
Mar 3, 2025
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.
4 changes: 4 additions & 0 deletions assets/icons/arrow_left_right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 1 addition & 5 deletions lib/widgets/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,7 @@ class _SwitchAccountButton extends _MenuButton {
const _SwitchAccountButton();

@override
// TODO(design): choose an icon
IconData? get icon => null;

@override
Widget buildLeading(BuildContext context) => const SizedBox.shrink();
IconData? get icon => ZulipIcons.arrow_left_right;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

icons: Add switch account icon in main menu

The "icons" prefix isn't right for describing this commit — that's used for introducing icons to the tree, like your first commit. (For examples, see git log --oneline --stat --full-diff assets/icons/. Or from the other direction: git log --oneline --stat --grep 'icons:'.)

Instead, match the prefix used for other changes aimed at this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seeing changes in home.dart file using git log --oneline --stat --full-diff lib/widgets/home.dart, I think commit summary home: Add switch account icon in main menu would be appropriate!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's a good summary line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message for the second commit now reads:

home: Add switch account icon in main menu
Fixes #1178.

The summary line needs to be set off from the rest of the commit message by a blank line.


@override
String label(ZulipLocalizations zulipLocalizations) {
Expand Down
77 changes: 40 additions & 37 deletions lib/widgets/icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,116 +27,119 @@ abstract final class ZulipIcons {
/// The Zulip custom icon "arrow_down".
static const IconData arrow_down = IconData(0xf101, fontFamily: "Zulip Icons");

/// The Zulip custom icon "arrow_left_right".
static const IconData arrow_left_right = IconData(0xf102, fontFamily: "Zulip Icons");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commit doesn't pass tools/check:

$ git checkout main~
$ tools/check
[…]
Running icons...

Error: there were icon updates:
 M lib/widgets/icons.dart
Running android...

FAILED: icons

To rerun the suites that failed, run:
  $ tools/check icons

It's important that each commit make sense on its own, including passing all tests. See our guide on coherent commits:
https://zulip.readthedocs.io/en/latest/contributing/commit-discipline.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result that i get when I run tools/check on my branch:

All tests passed!                                                                                                                                             
Running flutter_version...
Running build_runner...
Running l10n...
Running drift...
Running pigeon...
Running icons...

Running android...
Passed!

Though running this command makes changes to my pubspec.lock file. Should I commit that file as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result that i get when I run tools/check on my branch:

Right, it passes at the tip of the branch. In order to make each commit coherent, all tests need to pass at each individual commit along the way as well.

See the steps I wrote above, and the linked doc. If you have further questions, #git help or #mobile-dev-help would be good places to ask (you'll get faster responses than on GitHub).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though running this command makes changes to my pubspec.lock file. Should I commit that file as well?

Typically that happens when you're using a new version of Flutter than the one that pubspec.lock was last updated for. You'll see the same changes happen when you run the app, too 🙂.

And you'll see the same changes when running the app, or tools/check, on main without your PR. So they're independent of your other changes, and shouldn't be committed together.

If you'd like to upgrade the Flutter version in the repo, a PR for that would be welcome. See the instructions in our README.


/// The Zulip custom icon "arrow_right".
static const IconData arrow_right = IconData(0xf102, fontFamily: "Zulip Icons");
static const IconData arrow_right = IconData(0xf103, fontFamily: "Zulip Icons");

/// The Zulip custom icon "at_sign".
static const IconData at_sign = IconData(0xf103, fontFamily: "Zulip Icons");
static const IconData at_sign = IconData(0xf104, fontFamily: "Zulip Icons");

/// The Zulip custom icon "attach_file".
static const IconData attach_file = IconData(0xf104, fontFamily: "Zulip Icons");
static const IconData attach_file = IconData(0xf105, fontFamily: "Zulip Icons");

/// The Zulip custom icon "bot".
static const IconData bot = IconData(0xf105, fontFamily: "Zulip Icons");
static const IconData bot = IconData(0xf106, fontFamily: "Zulip Icons");

/// The Zulip custom icon "camera".
static const IconData camera = IconData(0xf106, fontFamily: "Zulip Icons");
static const IconData camera = IconData(0xf107, fontFamily: "Zulip Icons");

/// The Zulip custom icon "check".
static const IconData check = IconData(0xf107, fontFamily: "Zulip Icons");
static const IconData check = IconData(0xf108, fontFamily: "Zulip Icons");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/// The Zulip custom icon "three_person".
static const IconData three_person = IconData(0xf123, fontFamily: "Zulip Icons");
static const IconData three_person = IconData(0xf124, fontFamily: "Zulip Icons");

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

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

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

// END GENERATED ICON DATA
}
Expand Down