Json 如何将参数发送到另一个屏幕?颤振

Json 如何将参数发送到另一个屏幕?颤振,json,firebase,flutter,flutter-layout,Json,Firebase,Flutter,Flutter Layout,我正在尝试将“参与者”的参数发送到另一个屏幕,我可以使用ListView并加载事件列表,但它与参与者的工作方式不同,现在如果列表工作,但当我点击并希望看到“参与者”的信息时,所有内容都显示为空: 在这一部分中,我创建了参与者并生成了列表,以便能够将其可视化,通过点击,我发送了相关信息(根据我) Widget\u crearListadoParticipantes(){ 回归未来建设者( 未来:eventosProvider.cargarParticipantes(evento,participa

我正在尝试将“参与者”的参数发送到另一个屏幕,我可以使用ListView并加载事件列表,但它与参与者的工作方式不同,现在如果列表工作,但当我点击并希望看到“参与者”的信息时,所有内容都显示为空:

在这一部分中,我创建了参与者并生成了列表,以便能够将其可视化,通过点击,我发送了相关信息(根据我)

Widget\u crearListadoParticipantes(){
回归未来建设者(
未来:eventosProvider.cargarParticipantes(evento,participantes),
生成器:(上下文,快照){
if(snapshot.hasData){
最终参与者=snapshot.data;
返回ListView.builder(
itemCount:participantes.length,
itemBuilder:(上下文,i){
返回参与者(上下文、参与者[i],事件);
}
);
}else if(snapshot.hasrerror){
返回中心(子项:文本(“${snapshot.error}”);
}否则{
返回中心(子项:CircularProgressIndicator());
}
},
);
}
Widget\u crearParticipante(构建上下文上下文、参与者、事件模型evento){
返回填充(
填充:所有边缘设置(12.0),
儿童:手势检测器(
孩子:RichText(
软包装:错误,
text:TextSpan(
样式:TextStyle(
颜色:颜色,黑色,
fontFamily:“Lato_LightItalic”,
fontStyle:fontStyle.italic,
字体大小:20.0,
fontWeight:fontWeight.w400
),
儿童:[
TextSpan(文本:'+'${participantes.numero}',
样式:TextStyle(
fontWeight:fontWeight.w600
)
),
TextSpan(文本:“”),
TextSpan(text:'${participantes.apellido}${participantes.nombre}',)
],
),
),
onTap:()=>Navigator.pushNamed(上下文'destalleParticipante',参数:evento),
),
);
}
这就是我应该接收我点击的参与者的论点的地方,但正如我所说,一个空值返回

    class DetalleParticipante extends StatefulWidget {

      @override
      _DetalleParticipanteState createState() => _DetalleParticipanteState();
    }

    class _DetalleParticipanteState extends State<DetalleParticipante> {

      final eventosProvider = new EventosProvider();

      EventoModel evento = new EventoModel();
      Participantes participantes = new Participantes();

      @override
      Widget build(BuildContext context) {

        final EventoModel eventoData = ModalRoute.of(context).settings.arguments;
        if ( eventoData != null ) {
          evento = eventoData;
        }
          print(participantes.nombre);
        return Scaffold(
          appBar: PreferredSize(
            preferredSize: Size.fromHeight(0),
            child: AppBar(
              backgroundColor: Color(0xFF249FE2),
            ),
          ),
          backgroundColor: Colors.white,
          body:  Container(
            color: Colors.white,
            child: Column(
              children: <Widget>[
                _encabezadoParticipante(context, AssetImage("assets/icon/info_corredor.png"), participantes, evento),
              ],
            ),
          ),
        );
      }

      Widget _backBottom() {
return FloatingActionButton(
  elevation: 0.0,
  backgroundColor: Colors.white,
  child: Icon(
    Icons.arrow_back,
    size: 45.0,
    color: Colors.black,
  ),
  onPressed: (){
    Navigator.pop(context);
  },
);
类DetalleParticipante扩展StatefulWidget{
@凌驾
_DetalleParticipanteState createState()=>\u DetalleParticipanteState();
}
类_DetalleParticipanteState扩展状态{
final eventosProvider=新eventosProvider();
EventoModel evento=新的EventoModel();
Participantes Participantes=新参与者();
@凌驾
小部件构建(构建上下文){
final EventoModel eventoData=ModalRoute.of(context.settings.arguments);
if(eventoData!=null){
evento=eventoData;
}
印刷品(参与者名称);
返回脚手架(
appBar:首选大小(
preferredSize:Size.fromHeight(0),
孩子:AppBar(
背景颜色:颜色(0xFF249FE2),
),
),
背景颜色:Colors.white,
主体:容器(
颜色:颜色,白色,
子:列(
儿童:[
_encabezadoParticipante(上下文、资产(“assets/icon/info_corredor.png”)、参与者、事件、,
],
),
),
);
}
小部件_backBottom(){
返回浮动操作按钮(
标高:0.0,
背景颜色:Colors.white,
子:图标(
Icons.arrow_back,
尺寸:45.0,
颜色:颜色,黑色,
),
已按下:(){
Navigator.pop(上下文);
},
);
}

Widget\u encabezadoParticipante(构建上下文上下文、资产映像、Participantes Participantes、EventModel evento){
返回容器(
颜色:颜色。灰色[600],
孩子:填充(
填充:常数边集全部(10.0),
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
_backBottom(),
灵活的(
孩子:填充(
填充:边缘设置。全部(8.0),
子项:文本(${participantes.apellido}),
textAlign:textAlign.center,
maxLines:3,
软包装:是的,
风格:文本风格(
颜色:颜色,白色,
丰特家族:“拉托”,
fontStyle:fontStyle.italic,
字体大小:30.0,
fontWeight:fontWeight.bold
),
),
),
),
图像(图像:图像,
适合:BoxFit.cover,
),
],
),
),
);
}
}

Hi Jorge,你看过文档中的食谱了吗?我的朋友,我做到了,它与项目的某个部分一起工作,但在这种情况下,它不能提供“destalleParticipante”类的所有内容?准备好了,我已经添加了它。你的意思是
eventoData
null
,即使你确信
参数:evento
不是
null
    class DetalleParticipante extends StatefulWidget {

      @override
      _DetalleParticipanteState createState() => _DetalleParticipanteState();
    }

    class _DetalleParticipanteState extends State<DetalleParticipante> {

      final eventosProvider = new EventosProvider();

      EventoModel evento = new EventoModel();
      Participantes participantes = new Participantes();

      @override
      Widget build(BuildContext context) {

        final EventoModel eventoData = ModalRoute.of(context).settings.arguments;
        if ( eventoData != null ) {
          evento = eventoData;
        }
          print(participantes.nombre);
        return Scaffold(
          appBar: PreferredSize(
            preferredSize: Size.fromHeight(0),
            child: AppBar(
              backgroundColor: Color(0xFF249FE2),
            ),
          ),
          backgroundColor: Colors.white,
          body:  Container(
            color: Colors.white,
            child: Column(
              children: <Widget>[
                _encabezadoParticipante(context, AssetImage("assets/icon/info_corredor.png"), participantes, evento),
              ],
            ),
          ),
        );
      }

      Widget _backBottom() {
return FloatingActionButton(
  elevation: 0.0,
  backgroundColor: Colors.white,
  child: Icon(
    Icons.arrow_back,
    size: 45.0,
    color: Colors.black,
  ),
  onPressed: (){
    Navigator.pop(context);
  },
);
      Widget _encabezadoParticipante(BuildContext context, AssetImage image, Participantes participantes, EventoModel evento) {
        return Container(
          color: Colors.grey[600],
          child: Padding(
            padding: const EdgeInsets.all(10.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: <Widget>[
                _backBottom(),
                Flexible(
                  child: Padding(
                    padding: EdgeInsets.all(8.0),
                    child: Text('${participantes.apellido}',
                    textAlign: TextAlign.center,
                      maxLines: 3,
                      softWrap: true,
                      style: TextStyle(                
                        color: Colors.white,
                        fontFamily: "Lato",
                        fontStyle: FontStyle.italic,
                        fontSize: 30.0,
                        fontWeight: FontWeight.bold
                      ),
                    ),
                  ),
                ),
                Image(image: image,
                fit: BoxFit.cover,
                ),
              ],
            ),
          ),
        );
      }

    }