对不起,伙计们,我试图建立一个新页面,但其中包含变量“nextcode”。所以在新页面中,它将显示 nextcode 文本
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Lemari(nextcode)));
},
但在“Widget build(String Kode){”行中,它必须像这样“Widget build(BuildContext context){”
class Lemari extends StatelessWidget {
@override
Widget build(String Kode) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.blue[900],
title: Text('this is th next page'),
),
backgroundColor: Colors.white,
body: Center(
child: Column(
children: [
Container(height: 100, width: 100, color: Colors.red, child: Text('hhe'),),
]
),
),
);
}
}
那么有人可以帮助我吗?请 :(