-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b680e0
commit 7e3dd88
Showing
7 changed files
with
66 additions
and
4 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
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:buzz/buzz.dart'; | ||
import 'package:buzz/utils.dart'; | ||
|
||
abstract class FeedbacksCommand extends Command {} | ||
|
||
class ShowSnackBarCommand extends FeedbacksCommand { | ||
ShowSnackBarCommand( | ||
this.title, { | ||
required this.message, | ||
}); | ||
|
||
final String title; | ||
final String message; | ||
} | ||
|
||
abstract class FeedbacksExecutor { | ||
void snackBar(String title, String message); | ||
} | ||
|
||
class FeedbacksCommandHandler extends TypedEventHandler<FeedbacksCommand> { | ||
FeedbacksCommandHandler({ | ||
required this.feedbacksExecutor, | ||
}); | ||
|
||
final FeedbacksExecutor feedbacksExecutor; | ||
|
||
@override | ||
void handle(FeedbacksCommand command) { | ||
if (command is ShowSnackBarCommand) { | ||
feedbacksExecutor.snackBar(command.title, command.message); | ||
Buzz.fire(OnShowedSnackBarEvent()); | ||
} | ||
|
||
//TODO: Add more cases | ||
} | ||
} | ||
|
||
class OnShowedSnackBarEvent extends AppEvent {} | ||
|
||
class DefaultFeedbacksExecutor extends FeedbacksExecutor { | ||
@override | ||
void snackBar(String title, String message) { | ||
developerLog('$title:$message'); | ||
} | ||
} |