mirror of
https://github.com/NaserElziadna/doddle.git
synced 2026-03-13 07:41:06 +08:00
timer to send event to recorder every period of time
This commit is contained in:
@@ -70,13 +70,26 @@ class HomePage extends StatefulWidget {
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
DrawController? drawController;
|
||||
Timer? timer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
drawController = context.read<DoddlerBloc>().drawController;
|
||||
timer = Timer.periodic(Duration(milliseconds: 34), (Timer t) {
|
||||
context
|
||||
.read<RecorderBloc>()
|
||||
.add(TakeSnapshotEvent(globalKey: Doddler.globalKey));
|
||||
print("TakeSnapshotEvent");
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
timer?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
|
||||
Reference in New Issue
Block a user