我有这个异常的问题,我被卡住了,我需要你的帮助。我在流构建器中使用导航器,我已经在流构建器中使用它,但是这次我有一个异常,我不知道如何解决它。它尝试添加处置功能,但我不知道如何关闭流构建器。
这是我的状态Widget build(BuildContext context) {
changestate();
return Scaffold(
backgroundColor: Theme.of(context).backgroundColor,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 40),
Text('VOUS', style: TextStyle(fontSize: 50)),
Text(
'devez ' + legage,
style: TextStyle(fontSize: 35),
),
SizedBox(height: 30),
Image(image: AssetImage('assets/images/hands/2htop.png')),
SizedBox(height: 30),
Expanded(
child: StreamBuilder(
stream: Firestore.instance
.collection('rooms')
.document(pincode)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData &&
snapshot.data['nb screen'] == 1) {
gotdata++;
newduel(context);
}
return StreamBuilder<QuerySnapshot>(
stream: Firestore.instance
.collection('rooms')
.document(pincode)
.collection('users')
.snapshots(),
builder: (BuildContext context,
AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData)
return Text("Chargement....");
else {
return new GridView.count(
crossAxisCount: 5,
children: snapshot.data.documents
.map((DocumentSnapshot document) {
return Container(
child: OvalPic(
document['photo'], document['couleur']),
);
}).toList());
}
},
);
},
),
),
Container(
child: (ffull2 == 0)
? AnimatedLiquidLinearProgressIndicator()
: fgbutton(mypink, 'DUEL SUIVANT', context)),
SizedBox(height: 30)
],
),
),
);
}
void changestate() {
if (dejareload == 0) {
dejareload++;
Future.delayed(
const Duration(seconds: 3),
() => setState(() {
ffull2 = 1;
}));
}
}
这就是newduel中的内容:
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (context) => Votes()));
错误是: