Skip to content

Conversation

@yelmuratoff
Copy link
Owner

No description provided.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 11, 2025

Reviewer's Guide by Sourcery

This pull request migrates the project to use the Octopus router, refactors the project structure, updates dependencies, implements logging and error handling using ISpectify, refactors settings and authentication flows, implements a splash screen, and adds a shimmer effect. It also refactors the Toaster widget to use flutter_toast package.

Sequence diagram for the new user login process

sequenceDiagram
    participant User
    participant AuthBloc
    participant AuthRepository
    participant AuthRemoteDataSource
    participant SecureStorageManager

    User->>AuthBloc: LoginAuthEvent(username, password)
    AuthBloc->>AuthRepository: login(username, password)
    AuthRepository->>AuthRemoteDataSource: login(username, password)
    AuthRemoteDataSource-->>AuthRepository: TokenPair
    AuthRepository->>SecureStorageManager: setToken(TokenPair)
    SecureStorageManager-->>AuthRepository: void
    AuthRepository-->>AuthBloc: TokenPair
    AuthBloc-->>User: Authentication successful
Loading

Sequence diagram for the logout process

sequenceDiagram
    participant User
    participant AuthBloc
    participant AuthRepository
    participant SecureStorageManager

    User->>AuthBloc: LogoutAuthEvent()
    AuthBloc->>AuthRepository: logout()
    AuthRepository->>SecureStorageManager: deleteToken()
    SecureStorageManager-->>AuthRepository: void
    AuthRepository-->>AuthBloc: void
    AuthBloc-->>User: Logout successful
Loading

Updated class diagram for DependenciesContainer

classDiagram
    class DependenciesContainer {
        -SharedPreferences sharedPreferences
        -PackageInfo packageInfo
        -RestClientBase restClient
        -AuthBloc authBloc
        -UserCubit userCubit
        -SettingsBloc settingsBloc
        +DependenciesContainer(
            SharedPreferences sharedPreferences,
            PackageInfo packageInfo,
            RestClientBase restClient,
            AuthBloc authBloc,
            UserCubit userCubit,
            SettingsBloc settingsBloc
        )
        +String toString()
    }
Loading

Updated class diagram for SettingsBloc

classDiagram
    class SettingsBloc {
        -ILocaleRepository _localeRepo
        -IThemeRepository _themeRepo
        +SettingsBloc(ILocaleRepository localeRepository, IThemeRepository themeRepository, SettingsState initialState)
        +Future<void> _updateTheme(UpdateThemeSettingsEvent event, Emitter<SettingsState> emit)
        +Future<void> _updateLocale(UpdateLocaleSettingsEvent event, Emitter<SettingsState> emit)
    }

    class SettingsEvent {
        <<abstract>>
    }

    class UpdateThemeSettingsEvent {
        -AppTheme appTheme
        +UpdateThemeSettingsEvent(AppTheme appTheme)
    }

    class UpdateLocaleSettingsEvent {
        -Locale locale
        +UpdateLocaleSettingsEvent(Locale locale)
    }

    SettingsBloc --|> Bloc
    SettingsEvent --|> Equatable
    UpdateThemeSettingsEvent --|> SettingsEvent
    UpdateLocaleSettingsEvent --|> SettingsEvent
Loading

File-Level Changes

Change Details Files
Migrated to Octopus router and refactored routing logic.
  • Replaced go_router with Octopus for routing.
  • Implemented nested navigation using BucketNavigator.
  • Created RootScreen with BottomNavigationBar for tab navigation.
  • Defined routes in Routes enum.
  • Implemented TabGuard to manage tab navigation.
  • Added RouteWrapper interface for wrapping routes with providers.
  • Implemented OctopusExtensionX to simplify navigation.
  • Removed go_router dependency.
lib/src/app/router/utils/utils.dart
lib/src/app/presentation/widgets/material_context.dart
lib/src/app/presentation/screens/root_screen.dart
lib/src/app/router/routes/router.dart
lib/src/app/router/guards/tab.dart
lib/src/app/router/widgets/route_wrapper.dart
Updated project structure and dependencies.
  • Migrated BLoC architecture.
  • Updated dependencies.
  • Removed unused dependencies.
  • Added ui package as a local dependency.
  • Updated flutter_native_splash configuration.
  • Updated flavorizr configuration.
  • Removed dev dependency.
  • Removed go_router_builder dependency.
pubspec.yaml
flavorizr.yaml
automation/build.mk
lib/src/features/initialization/models/dependencies.dart
lib/src/features/initialization/models/initialization_hook.dart
lib/src/features/initialization/logic/composition_root.dart
lib/src/features/initialization/factories/dependencies_factories.dart
lib/src/features/initialization/factories/repositories_factories.dart
lib/src/features/initialization/presentation/dependencies_scope.dart
lib/src/features/initialization/models/repositories.dart
Refactored logging and error handling using ISpectify.
  • Replaced Talker with ISpectify for logging.
  • Implemented ISpectifyBlocObserver for BLoC logging.
  • Updated DioClient to use ISpectifyDioLogger.
  • Removed talker related dependencies.
  • Updated error handling in bootstrap.dart.
  • Updated logging in various files.
lib/bootstrap.dart
lib/src/core/rest_client/dio_rest_client/src/dio_client.dart
lib/src/common/utils/extensions/talker.dart
lib/src/features/initialization/presentation/widget/initialization_failed_app.dart
Refactored settings and authentication flows.
  • Moved settings-related files to a dedicated directory.
  • Updated imports and class names to reflect the new structure.
  • Updated authentication flow to use the new router.
  • Removed SettingsScope from InitializationFailedApp.
  • Updated AuthBloc and UserCubit imports.
  • Updated SettingsBloc imports.
lib/src/features/settings/presentation/settings_screen.dart
lib/src/features/settings/presentation/bloc/settings_bloc.dart
lib/src/features/auth/presentation/auth_screen.dart
Implemented splash screen and initial navigation logic.
  • Created SplashScreen widget.
  • Implemented logic to navigate to AuthScreen or RootScreen based on token availability.
  • Updated Assets to include splash screen image.
  • Updated flutter_native_splash.yaml to configure splash screen.
lib/src/features/initialization/presentation/page/splash.dart
flutter_native_splash.yaml
Added ui package and implemented shimmer effect.
  • Added ui package as a local dependency.
  • Implemented shimmer effect using Shimmer widget.
  • Added ShimmerBox widget for creating shimmer boxes.
  • Updated theme extensions to use ui package.
  • Updated color extensions to use ui package.
pubspec.yaml
lib/src/common/utils/extensions/colors_extension.dart
packages/ui/lib/src/widgets/shimmer/shimmer.dart
packages/ui/lib/src/widgets/shimmer/shimmer_box.dart
packages/ui/lib/src/widgets/shimmer/animation.dart
packages/ui/lib/src/widgets/shimmer/animator.dart
packages/ui/lib/src/theme/theme.dart
packages/ui/lib/src/extensions/theme.dart
Refactored Toaster widget.
  • Refactored Toaster widget to use flutter_toast package.
  • Added FToastBuilder to use in MaterialApp builder method.
  • Added ToastGravity enum to define the position of the Toast on the screen.
  • Added PositionedToastBuilder typedef to build custom Toast.
lib/src/common/presentation/widgets/dialogs/toaster.dart
lib/src/common/presentation/widgets/dialogs/toaster/flutter_toast.dart

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@yelmuratoff yelmuratoff merged commit 0c18c3b into main Mar 11, 2025
1 check failed
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @yelmuratoff - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a state management solution like Riverpod or BLoC for managing the app's state, especially for settings and user authentication.
  • The project has undergone a significant refactor, consider adding a summary of the changes in the description.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

/// List of extensions for `BuildContext`
extension ContextExtension on BuildContext {
/// `pop` pops the current `BuildContext` from the `Navigator`.
void pop() {
Copy link

Choose a reason for hiding this comment

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

question: Clarify the order and rationale for multiple pop calls.

The pop() extension calls octopus.pop() before attempting Navigator.maybePop. It might be helpful to ensure that this order is intentional and that both are needed, so that unexpected behavior in navigation can be avoided.

[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->

TODO: Put a short description of the package here that helps potential users
Copy link

Choose a reason for hiding this comment

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

suggestion: Remember to fill in the TODO placeholders in the README.

The README contains several TODOs. Please replace them with actual content.

Suggested implementation:

This package provides a collection of customizable user interface components and utilities designed for building responsive Flutter applications. It includes a variety of widgets, themes, and animations that streamline the development of modern, visually appealing UIs.

For every other TODO found in the README, ensure that you replace these placeholders with concrete explanations, documentation links, or usage examples that provide value to the potential users of the package.

@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
Copy link

Choose a reason for hiding this comment

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

suggestion: Update the changelog with a description of the initial release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants