I am trying to build an app where the user has the option to pass card and read some activities passing flashcards. I can only show the first card but I don't know how to remove the first one and show the next document. How can I remove the first document item that is showing and move to another document when I pass the first card? I am able to show the first one but I can show the others documents from firrstore.
return StreamBuilder(
stream: firestoreInstance
.collection('categorias')
.doc(widget.category.toString())
.collection('Subclass')
.doc(widget.docId)
.collection('Cards')
.snapshots(),
builder: (context, snapshot) {
if (snapshot.data == null)
return Center(child: CircularProgressIndicator());
if (snapshot.data.docs.length == 0) {
return Center(
child: const Text(
'',
textAlign: TextAlign.center,
),
);
} else {
snapQuery = snapshot.data.documents[0];
String description = snapQuery.data()['description'];
String title = snapQuery.data()['title'];
String font = snapQuery.data()['fonte'];
String obs = snapQuery.data()['obs'];
String tema = snapQuery.data()['tema'];
String cat = snapQuery.data()['cat'];
return Card(
elevation: 0,
margin: EdgeInsets.only(left: 32.0, right: 32.0, top: 20),
color: Color(0x00000000),
child: FlipCard(
flipOnTouch: false,
key: cardKey,
direction: FlipDirection.HORIZONTAL,
speed: 1000,
onFlipDone: (status) {
print(status);
},
front: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
child: ListView(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Image.asset(
'images/law_icon.png',
width: 69,
height: 69,
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.only(top: 32.0),
child: Text(
title,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 21,
fontFamily: 'Notosans',
fontWeight: FontWeight.normal)),
),
),
],
),
SizedBox(
height: 200,
),
Expanded(
child: Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10),
width: MediaQuery.of(context).size.width,
height: 100,
child: adFront == null
? Image.asset(
'images/anuncie.png',
fit: BoxFit.cover,
)
: Image.network(
adFront,
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 10,
),
],
),
),
back: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
child: Stack(
children: [
ListView(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 40,
color: Color(0xff007487),
child: Center(
child: Text(
tema,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 18,
fontFamily: 'Notosans',
fontWeight: FontWeight.normal,
color: Colors.white),
),
),
),
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12.0),
child: Text(
cat,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 18,
fontFamily: 'Notosans',
fontWeight: FontWeight.normal)),
),
),
Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
description,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 12,
fontFamily: 'Notosans',
fontWeight: FontWeight.bold),
),
),
SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.all(12.0),
child: Text(
obs,
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 12,
fontFamily: 'Notosans',
fontWeight: FontWeight.normal),
),
),
SizedBox(
height: 10,
),
Positioned(
child: Align(
alignment: FractionalOffset.bottomCenter,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 12),
width: MediaQuery.of(context).size.width,
height: 100,
child: adBack == null
? Image.asset(
'images/anuncie.png',
fit: BoxFit.cover,
)
: Image.network(
adBack,
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 2,
),
Align(
alignment: FractionalOffset.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
font,
style: TextStyle(
fontSize: 12,
fontFamily: 'Notosans',
fontStyle: FontStyle.normal),
),
)),
],
),
],
),
)));
}
},
);
User contributions licensed under CC BY-SA 3.0