[PR #4923] [MERGED] refactor(mobile): build context extensions #10562

Closed
opened 2026-02-05 14:24:10 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/4923
Author: @shenlong-tanwen
Created: 11/9/2023
Status: Merged
Merged: 11/9/2023
Merged by: @alextran1502

Base: mainHead: refactor/mobile-build-context


📝 Commits (6)

  • 2dad9fb refactor: move all extensions to separate package
  • dfcf620 refactor(mobile): add BuildContext extension
  • c98dbdc refactor(mobile): use theme getters from context
  • f6eb6c4 refactor(mobile): use media query size from context
  • fb0fa65 refactor(mobile): use auto router methods from context
  • 48e32f3 refactor(mobile): use navigator methods from context

📊 Changes

106 files changed (+660 additions, -628 deletions)

View changed files

mobile/lib/extensions/build_context_extensions.dart (+54 -0)
📝 mobile/lib/extensions/collection_extensions.dart (+0 -21)
📝 mobile/lib/extensions/datetime_extensions.dart (+0 -0)
📝 mobile/lib/extensions/flutter_map_extensions.dart (+0 -0)
mobile/lib/extensions/string_extensions.dart (+30 -0)
📝 mobile/lib/modules/activities/views/activities_page.dart (+5 -8)
📝 mobile/lib/modules/album/ui/add_to_album_bottom_sheet.dart (+5 -6)
📝 mobile/lib/modules/album/ui/album_action_outlined_button.dart (+6 -7)
📝 mobile/lib/modules/album/ui/album_thumbnail_card.dart (+8 -6)
📝 mobile/lib/modules/album/ui/album_thumbnail_listtile.dart (+3 -4)
📝 mobile/lib/modules/album/ui/album_title_text_field.dart (+3 -2)
📝 mobile/lib/modules/album/ui/album_viewer_appbar.dart (+15 -19)
📝 mobile/lib/modules/album/ui/album_viewer_editable_title.dart (+4 -4)
📝 mobile/lib/modules/album/views/album_options_part.dart (+10 -11)
📝 mobile/lib/modules/album/views/album_viewer_page.dart (+5 -6)
📝 mobile/lib/modules/album/views/asset_selection_page.dart (+2 -1)
📝 mobile/lib/modules/album/views/create_album_page.dart (+25 -25)
📝 mobile/lib/modules/album/views/library_page.dart (+20 -21)
📝 mobile/lib/modules/album/views/select_additional_user_for_sharing_page.dart (+5 -6)
📝 mobile/lib/modules/album/views/select_user_for_sharing_page.dart (+10 -10)

...and 80 more files

📄 Description

Changes made in the PR:

  • Extensions are moved now to a common root folder under lib\extensions
  • All string extensions are moved to a common file named string_extensions.dart
  • builtin_extensions.dart renamed to collection_extensions.dart`
  • Added a new extension on BuildContext containing frequently used getters and methods involving the current context which currently includes:
    • AutoRouter methods are migrated to the extension
    • Navigator methods
    • MediaQuery size calls
    • Frequently used Theme calls

Also updates the MediaQuery.of(context) calls to MediaQuery.sizeof(context) inside the extension as recommended in https://github.com/flutter/flutter/pull/114459


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/4923 **Author:** [@shenlong-tanwen](https://github.com/shenlong-tanwen) **Created:** 11/9/2023 **Status:** ✅ Merged **Merged:** 11/9/2023 **Merged by:** [@alextran1502](https://github.com/alextran1502) **Base:** `main` ← **Head:** `refactor/mobile-build-context` --- ### 📝 Commits (6) - [`2dad9fb`](https://github.com/immich-app/immich/commit/2dad9fb423f8c19ef3a48cf6d712c4f1a5cfa1fe) refactor: move all extensions to separate package - [`dfcf620`](https://github.com/immich-app/immich/commit/dfcf620180c4a55f41e6b778b5299ce410828071) refactor(mobile): add BuildContext extension - [`c98dbdc`](https://github.com/immich-app/immich/commit/c98dbdc31d388a564519782c28aab7c8bc8b8a40) refactor(mobile): use theme getters from context - [`f6eb6c4`](https://github.com/immich-app/immich/commit/f6eb6c44fb6cc1bfbc43633cc856338dad44911a) refactor(mobile): use media query size from context - [`fb0fa65`](https://github.com/immich-app/immich/commit/fb0fa65b6dd81f2247e3f380ee25ba6cda208249) refactor(mobile): use auto router methods from context - [`48e32f3`](https://github.com/immich-app/immich/commit/48e32f378b57497de3b6279e79b2388d7d6f81b0) refactor(mobile): use navigator methods from context ### 📊 Changes **106 files changed** (+660 additions, -628 deletions) <details> <summary>View changed files</summary> ➕ `mobile/lib/extensions/build_context_extensions.dart` (+54 -0) 📝 `mobile/lib/extensions/collection_extensions.dart` (+0 -21) 📝 `mobile/lib/extensions/datetime_extensions.dart` (+0 -0) 📝 `mobile/lib/extensions/flutter_map_extensions.dart` (+0 -0) ➕ `mobile/lib/extensions/string_extensions.dart` (+30 -0) 📝 `mobile/lib/modules/activities/views/activities_page.dart` (+5 -8) 📝 `mobile/lib/modules/album/ui/add_to_album_bottom_sheet.dart` (+5 -6) 📝 `mobile/lib/modules/album/ui/album_action_outlined_button.dart` (+6 -7) 📝 `mobile/lib/modules/album/ui/album_thumbnail_card.dart` (+8 -6) 📝 `mobile/lib/modules/album/ui/album_thumbnail_listtile.dart` (+3 -4) 📝 `mobile/lib/modules/album/ui/album_title_text_field.dart` (+3 -2) 📝 `mobile/lib/modules/album/ui/album_viewer_appbar.dart` (+15 -19) 📝 `mobile/lib/modules/album/ui/album_viewer_editable_title.dart` (+4 -4) 📝 `mobile/lib/modules/album/views/album_options_part.dart` (+10 -11) 📝 `mobile/lib/modules/album/views/album_viewer_page.dart` (+5 -6) 📝 `mobile/lib/modules/album/views/asset_selection_page.dart` (+2 -1) 📝 `mobile/lib/modules/album/views/create_album_page.dart` (+25 -25) 📝 `mobile/lib/modules/album/views/library_page.dart` (+20 -21) 📝 `mobile/lib/modules/album/views/select_additional_user_for_sharing_page.dart` (+5 -6) 📝 `mobile/lib/modules/album/views/select_user_for_sharing_page.dart` (+10 -10) _...and 80 more files_ </details> ### 📄 Description #### Changes made in the PR: - Extensions are moved now to a common root folder under `lib\extensions` - All string extensions are moved to a common file named `string_extensions.dart` - `builtin_extensions.dart renamed to `collection_extensions.dart` - Added a new extension on `BuildContext` containing frequently used getters and methods involving the current context which currently includes: - `AutoRouter` methods are migrated to the extension - `Navigator` methods - `MediaQuery` size calls - Frequently used `Theme` calls Also updates the `MediaQuery.of(context)` calls to `MediaQuery.sizeof(context)` inside the extension as recommended in https://github.com/flutter/flutter/pull/114459 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:24:10 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#10562