You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to build an auto save feature for my app so every change should be saved instantly.
Until now I saved with an user event button click and had a dirty workarond to make it work:
I sent an event every x miliseconds to check the notifier state iny my Bloc and update the Bloc state like this.
Is there a way to listen to path updates like notifier.OnDrawingUpdated or something like that? I cannot see a way to handle state properly.
class _ScribbleEditorState extends State<ScribbleEditor> {
Timer? timer;
@override
void initState() {
super.initState();
// In the auto save mode it would even need to check for dirty state and persist in my bloc.
timer = Timer.periodic(
const Duration(milliseconds: 100),
(Timer t) =>
context.read<ScribbleDetailsBloc>().add(UpdateState()),
);
}
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 12),
child: Scribble(
notifier: widget._notifier,
drawPen: true,
drawEraser: true,
),
);
}
@override
void dispose() {
timer?.cancel();
super.dispose();
}
Hi,
I want to build an auto save feature for my app so every change should be saved instantly.
Until now I saved with an user event button click and had a dirty workarond to make it work:
Is there a way to listen to path updates like notifier.OnDrawingUpdated or something like that? I cannot see a way to handle state properly.
You can see the hack here.
I need something like:
what should be fired when the user stops drawing the line.
Also its pretty hard to listen to changes in general like canUndo or Redo because of the same reason.
I have to manage all state in my bloc, scribble drawings but also a lot of other things.
The text was updated successfully, but these errors were encountered: