pratiktimer / setWallpaperplugin

Apache License 2.0
26 stars 16 forks source link

How we can use this plugin with Dio plugin #4

Closed muss01 closed 3 years ago

muss01 commented 5 years ago

I need to show the user the progress bar!

pratiktimer commented 5 years ago

Define Stream progressString; in Stateful Widget call progressString = Wallpaper.ImageDownloadProgress(iimgurl); progressString.listen((data) { setState(() { res = data; downloading = true; }); print("DataReceived: " + data); }, onDone: () async { lock = await Wallpaper.lockScreen(); setState(() { downloading = false; lock = lock; }); print("Task Done"); }, onError: (error) { setState(() { downloading = false; }); print("Some Error"); });

pratiktimer commented 5 years ago

Widget Dialog() { return Positioned( top: 200, left: 70, child: downloading ? Container( height: 120.0, width: 200.0, child: Card( color: Colors.black, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ CircularProgressIndicator(), SizedBox(height: 20.0), Text( "Downloading File : $res", style: TextStyle(color: Colors.white), ) ], ), ), ) : Text(""), ); }