-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #314 from woltapp/select-bottom-nav-bar-on-browser…
…-address-bar [Coffee Maker App] Update bottom nav bar tab from the browser address bar
- Loading branch information
Showing
20 changed files
with
657 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
coffee_maker_navigator_2/lib/app/router/entities/app_navigation_stack.dart
This file was deleted.
Oops, something went wrong.
45 changes: 38 additions & 7 deletions
45
coffee_maker_navigator_2/lib/app/router/entities/app_route_configuration.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,46 @@ | ||
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_path.dart'; | ||
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_uri_template.dart'; | ||
|
||
/// This class provides a structured way to manage and represent the current navigation state, | ||
/// including both the route and any relevant parameters. | ||
/// | ||
/// [AppRouteConfiguration] represents the configuration of a specific route in the application, | ||
/// holding both the static structure of the route as defined by the [AppRouteUriTemplate] and | ||
/// the dynamic aspects such as query parameters. | ||
/// | ||
/// In the context of Flutter's Navigator 2.0, this configuration is essential for translating | ||
/// between the application's navigation state and the URL displayed in the browser. It enables | ||
/// deep linking, dynamic navigation, and synchronization between the app's state and the browser URL. | ||
/// | ||
/// **Components:** | ||
/// - [appRouteUriTemplate]: A value from the [AppRouteUriTemplate] enum, representing the static | ||
/// template of the route. It defines the modal or screen that should be navigated to based | ||
/// on the URI path. | ||
/// - [queryParams]: A map of query parameters, allowing additional dynamic information to be passed | ||
/// with the route (e.g., selected tab, order id, etc.). This supports more complex navigation | ||
/// patterns and enables passing state information directly through the URL. | ||
/// | ||
/// **Usage:** | ||
/// - **URL Generation:** The `toUri()` method converts the route configuration into a full URI, | ||
/// combining the path from [AppRouteUriTemplate] with the actual query parameter values. This URI | ||
/// is used to update the browser's address bar, ensuring that the visible URL reflects the current | ||
/// state of the application. | ||
/// - **Consistency with Defined Routes:** By utilizing [AppRouteUriTemplate], this class ensures that | ||
/// all route configurations are consistent with the predefined route templates, making navigation | ||
/// predictable and easier to manage. | ||
class AppRouteConfiguration { | ||
final AppRoutePath appRoutePath; | ||
final Map<String, String> queryParams; | ||
|
||
static const queryParamId = 'id'; | ||
final AppRouteUriTemplate appRouteUriTemplate; | ||
final QueryParams queryParams; | ||
|
||
const AppRouteConfiguration({ | ||
required this.appRoutePath, | ||
required this.appRouteUriTemplate, | ||
this.queryParams = const {}, | ||
}); | ||
|
||
Uri toUri() => Uri(path: appRoutePath.path, queryParameters: queryParams); | ||
/// Converts the route configuration to a URI, combining the path name from the template | ||
/// and any provided query parameters. This is used for generating URLs that reflect | ||
/// the application's current state, aiding in deep linking and navigation state management. | ||
Uri toUri() => | ||
Uri(path: appRouteUriTemplate.path, queryParameters: queryParams); | ||
} | ||
|
||
typedef QueryParams = Map<String, String>; |
Oops, something went wrong.