簡體   English   中英

預期 2 個位置參數,但找到 0 個。 Flutter

[英]2 positional argument(s) expected, but 0 found. Flutter

我是 Flutter 的新手,我曾經用 Flutter 和 Firebase 做一個筆記應用程序。 但我有這個問題,將 SpeedDial 按鈕重定向到其他頁面。 有人知道是什么問題嗎? 我試圖將數據和引用作為 arguments 但我也有問題。

這是菜單代碼,在這里我想用這個 SpeedDial 將用戶重定向到筆記頁面

SpeedDialChild(
            child: const Icon(
              Icons.text_fields_rounded,
              color: violeta,
            ),
            label: 'notes',
            labelStyle: TextStyle(color: violeta),
            backgroundColor: amarillo,
            onTap: (() {
              Navigator.of(context).push(MaterialPageRoute(
                builder: ((context) => notas()),
              ));
            })),

這是注釋頁面的一部分,我在其中聲明了 arguments 以將新注釋與 flutter 連接

class notes extends StatefulWidget {
  late String tituloTexto;
  late String notaTexto;
  late String nomCuaderno;
  late final Map data;
  late final DocumentReference ref;

  notas(this.data, this.ref);

  @override
  State<notas> createState() => _notasState();
}

如果有人可以幫助我,我真的很感激。

謝謝! <3

您需要將notas()放入Navigator.of(context).push(MaterialPageRoute(builder: ((context) => notas())中的 notas() 中。

因為notas構造函數需要 2 個 arguments notas notas(this.data, this.ref);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM