-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add service to hold data while navigating
- Loading branch information
1 parent
9d08169
commit 0888b14
Showing
6 changed files
with
117 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:stacked/stacked.dart'; | ||
|
||
class FoodDetailHolder extends BaseViewModel { | ||
late String _foodTag; | ||
late String _foodImagePath; | ||
late String _foodName; | ||
|
||
String get foodTag => _foodTag; | ||
String get foodImagePath => _foodImagePath; | ||
String get foodName => _foodName; | ||
|
||
setAllProperties(String foodTag, String foodImagePath, String foodName) { | ||
_foodImagePath = foodImagePath; | ||
_foodTag = foodTag; | ||
_foodName = foodName; | ||
notifyListeners(); | ||
} | ||
} |
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
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,11 +1,17 @@ | ||
import 'package:logger/logger.dart'; | ||
import 'package:stacked/stacked.dart'; | ||
import 'package:zerosandones/core/locator.dart'; | ||
import 'package:zerosandones/core/logger.dart'; | ||
import 'package:zerosandones/core/services/temp.dart'; | ||
|
||
class ItemDetailPageViewModel extends BaseViewModel { | ||
late Logger log; | ||
|
||
ItemDetailPageViewModel() { | ||
log = getLogger(runtimeType.toString()); | ||
} | ||
final _foodDetailHolder = locator<FoodDetailHolder>(); | ||
String get foodName => _foodDetailHolder.foodName; | ||
String get foodImagePath => _foodDetailHolder.foodImagePath; | ||
String get foodTag => _foodDetailHolder.foodTag; | ||
} |