Widget build(BuildContext context) {
CollectionReference quizes =
FirebaseFirestore.instance.collection('LiveQuizes');
SizeConfig().init(context);
return Scaffold(
body: SingleChildScrollView(
physics: BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
child: StreamBuilder<QuerySnapshot>(
stream: quizes.snapshots(),
builder:
(BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
Fluttertoast.showToast(
msg: "Something went wrong", toastLength: Toast.LENGTH_LONG);
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: SpinKitRing(
color: Colors.blue,
lineWidth: 4,
size: 40,
),
);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(
top: 10,
left: 15,
),
child: Text("Live Quizes", style: drawerStyle),
),
ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: snapshot.data.docs.length,
itemBuilder: (BuildContext context, int index) =>
quizDetailswidget(context, snapshot.data.docs[index]),
),
],
);
},
),
),
);
}
Here i have used StreamBuilder to get he details dynamically but when this condition is matched snapshot.connectionState == ConnectionState.waiting i want to show the circular loader i have used the package Spinket but the problem is that the loader is not showing in the center. The loader is centered horizontally but not vertically
question from:
https://stackoverflow.com/questions/65951238/center-widget-in-flutter-not-showing-in-center-of-the-device 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…