Finish loader as Gif image in all cases where the network is busy
parent
cd7c354458
commit
bf412e1edf
@ -0,0 +1 @@
|
||||
8bbc713f808a1e4202d48e35ddf46f23
|
||||
@ -0,0 +1,43 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_gifimage/flutter_gifimage.dart';
|
||||
|
||||
class GifLoaderContainer extends StatefulWidget {
|
||||
@override
|
||||
_GifLoaderContainerState createState() => _GifLoaderContainerState();
|
||||
}
|
||||
|
||||
class _GifLoaderContainerState extends State<GifLoaderContainer>
|
||||
with TickerProviderStateMixin {
|
||||
GifController controller1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
controller1 = GifController(vsync: this);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
controller1.repeat(
|
||||
min: 0, max: 12, period: Duration(milliseconds: 750), reverse: true);
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller1.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
//progress-loading.gif
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 40),
|
||||
child: GifImage(
|
||||
controller: controller1,
|
||||
image: AssetImage(
|
||||
"assets/images/progress-loading.gif"), //NetworkImage("http://img.mp.itc.cn/upload/20161107/5cad975eee9e4b45ae9d3c1238ccf91e.jpg"),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'gif_loader_container.dart';
|
||||
|
||||
class GifLoaderDialogUtils {
|
||||
static AlertDialog dialog = AlertDialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
content: GifLoaderContainer(),
|
||||
);
|
||||
|
||||
static showMyDialog(BuildContext context) {
|
||||
showDialog(context: context, child: dialog);
|
||||
}
|
||||
|
||||
static hideDialog(BuildContext context) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue