Hi @frideosapps thank's for this wonderful library, this is exactly what I was looking for. My use case is that I would like to sync audio and text (mostly), save the progress of the user, etc ... I think I can achieve that with the callbacks (onStart => play song, onPause => pause song, ... )
First, if I understand the docs correctly, I can only do play (startStages),rewind (resetStages), and skip next stage (getNextStage
). It would be nice to have on the low level widget StagedObject a method like getPreviousStage
and on an upper level have StagedWidget, have the corresponding utility methods and callbacks .
Second, for the features like (pause, onComplete, onDuration / onCurrentPosition, seek) I guess it will have some repercussions on StreamedObject and ValueBuilder to have more control over the stream.
What do you think ? I'm playing around your code right now to make a PR but for some reason I can't reset the player.
Here is my raw code
import 'package:frideos/frideos.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
var reset = "reset";
Stage stage;
@override
void initState() {
staged
..setStagesMap(stagesMap)
..startStages();
stage = staged.getStage(0);
super.initState();
}
@override
void dispose() {
staged.dispose();
super.dispose();
}
var staged = StagedObject();
var stagesMap = <int, Stage>{
0: Stage(
widget: Container(
key: const Key('0'),
child: const Text('Stage 0'),
),
time: 2000,
onShow: () {
//tester.pump();
}),
1: Stage(
widget: Container(
key: const Key('1'),
child: const Text(
'Stage 1',
// style: TextStyle(fontSize: 50),
),
),
time: 2000,
onShow: () {}),
2: Stage(
widget: Container(
key: const Key('2'),
child: const Text(
'Stage 2',
// style: TextStyle(fontSize: 50),
),
),
time: 2000,
onShow: () {}),
};
// var stagesMap = ;
@override
Widget build(BuildContext context) {
assert(stage != null);
return Scaffold(
floatingActionButton: FloatingActionButton(
child: Icon(Icons.refresh),
onPressed: () {
staged
// ..setStagesMap(stagesMap)
..resetStages();
setState(() {
reset = "reset";
staged = staged;
});
print(reset);
// print(reset);
},
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Center(
child: ValueBuilder(
streamed: staged,
builder: (context, snapshot) => snapshot.data),
),
],
),
);
}
}