Skip to content

Instantly share code, notes, and snippets.

@antklim
Last active November 9, 2020 23:44
Show Gist options
  • Save antklim/6ef1649a7e460205bc306f70e4407002 to your computer and use it in GitHub Desktop.
Save antklim/6ef1649a7e460205bc306f70e4407002 to your computer and use it in GitHub Desktop.
class _CalculusScreenState extends State<CalculusScreen> {
CalculatorUseCase useCase = CalculatorUseCase();
void onMemorise() {
setState(() {
useCase.memorise();
});
}
void onResetMemory() {
setState(() {
useCase.resetMemory();
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
...
// providing use case to the children elements
MemoryInfo(memory: useCase.memory),
CalculatorInput(useCase: useCase),
MemoryManagement(onMemorise: onMemorise, onResetMemory: onResetMemory),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment