-
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 #312 from woltapp/coffee-maker-add-browser-address…
…-bar-support-for-navigation [Coffee Maker App] Add Web support for app navigation (Update browser address bar)
- Loading branch information
Showing
26 changed files
with
759 additions
and
335 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
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
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: 59 additions & 0 deletions
59
coffee_maker_navigator_2/lib/app/router/entities/app_navigation_stack.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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_page.dart'; | ||
import 'package:coffee_maker_navigator_2/features/orders/domain/entities/coffee_maker_step.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
|
||
class AppNavigationStack extends Equatable { | ||
final List<AppRoutePage> pages; | ||
|
||
const AppNavigationStack({required this.pages}); | ||
|
||
@override | ||
List<Object?> get props => [pages]; | ||
|
||
AppRoutePage get lastPage => pages.last; | ||
|
||
factory AppNavigationStack.bootstrapStack() { | ||
return const AppNavigationStack( | ||
pages: [BootstrapRoutePage()], | ||
); | ||
} | ||
|
||
factory AppNavigationStack.ordersStack({ | ||
CoffeeMakerStep? step, | ||
String? coffeeOrderId, | ||
bool shouldShowOnboardingModal = false, | ||
}) { | ||
return AppNavigationStack( | ||
pages: [ | ||
const OrdersRoutePage(), | ||
if (shouldShowOnboardingModal) const OnboardingModalRoutePage(), | ||
if (step == CoffeeMakerStep.grind && coffeeOrderId != null) | ||
GrindCoffeeModalRoutePage( | ||
coffeeOrderId: coffeeOrderId, | ||
), | ||
if (step == CoffeeMakerStep.addWater && coffeeOrderId != null) | ||
AddWaterRoutePage(coffeeOrderId), | ||
if (step == CoffeeMakerStep.ready && coffeeOrderId != null) | ||
ReadyCoffeeModalRoutePage( | ||
coffeeOrderId: coffeeOrderId, | ||
), | ||
], | ||
); | ||
} | ||
|
||
factory AppNavigationStack.loginStack() { | ||
return const AppNavigationStack( | ||
pages: [LoginRoutePage()], | ||
); | ||
} | ||
|
||
factory AppNavigationStack.tutorialsStack([CoffeeMakerStep? step]) { | ||
return AppNavigationStack( | ||
pages: [ | ||
const OrdersRoutePage(), | ||
const TutorialsRoutePage(), | ||
if (step != null) SingleTutorialRoutePage(step), | ||
], | ||
); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:coffee_maker_navigator_2/app/router/entities/app_route_path.dart'; | ||
|
||
class AppRouteConfiguration { | ||
final AppRoutePath appRoutePath; | ||
final Map<String, String> queryParams; | ||
|
||
static const queryParamId = 'id'; | ||
|
||
const AppRouteConfiguration({ | ||
required this.appRoutePath, | ||
this.queryParams = const {}, | ||
}); | ||
|
||
Uri toUri() => Uri(path: appRoutePath.path, queryParameters: queryParams); | ||
} |
Oops, something went wrong.