簡體   English   中英

我一直在嘗試構建這個 flutter 項目,但每次都會出現此錯誤。 我的flutter版本是3.3.9

[英]i have been trying to build this flutter project but i get this error every time. My flutter version is 3.3.9

我一直在嘗試構建這個 flutter 項目,但每次都會出現此錯誤。 我的flutter版本是3.3.9的報錯圖片

                             ^^^^^^^^^^
lib/screens/product_details.dart:652:32: Error: The method 'FlatButton' isn't defined for the class '_ProductDetailsState'.
 - '_ProductDetailsState' is from 'package:active_ecommerce_flutter/screens/product_details.dart' ('lib/screens/product_details.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
                        child: FlatButton(
                               ^^^^^^^^^^
lib/screens/product_details.dart:677:32: Error: The method 'FlatButton' isn't defined for the class '_ProductDetailsState'.
 - '_ProductDetailsState' is from 'package:active_ecommerce_flutter/screens/product_details.dart' ('lib/screens/product_details.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
                        child: FlatButton(
                               ^^^^^^^^^^
lib/screens/product_details.dart:2137:26: Error: The method 'FlatButton' isn't defined for the class '_ProductDetailsState'.
 - '_ProductDetailsState' is from 'package:active_ecommerce_flutter/screens/product_details.dart' ('lib/screens/product_details.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
                  return FlatButton(
                         ^^^^^^^^^^
lib/screens/chat.dart:417:16: Error: The method 'FlatButton' isn't defined for the class '_ChatState'.
 - '_ChatState' is from 'package:active_ecommerce_flutter/screens/chat.dart' ('lib/screens/chat.dart').
Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
        child: FlatButton(
               ^^^^^^^^^^

請幫我解決這個問題,我還是 flutter 的新手

我試圖降級我的 flutter 版本,但仍然不可能

單擊異常中拋出的鏈接,它將導航到拋出錯誤的類搜索FlatButton並將其替換為ElevatedButton ,因為不推薦使用 flatButton

代碼示例:

ElevatedButton(
  style: ElevatedButton.styleFrom(
    primary: Colors.red,
    padding: EdgeInsets.all(10),
  ),
  child: Text("Saved"),
  onPressed: () {
    // write your code here
  },
)

嘗試使用其他按鈕,例如提升按鈕,因為平面按鈕已被棄用。

代碼的圖像flatbutton 在許多不同的地方使用,它在我的 flutter 項目從 3.0.9 升級到 3.3.9 后在代碼的所有地方引起了很多錯誤,我不能再降級我的 flutter 請給我建議解決方案

暫無
暫無

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

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