简体   繁体   English

小部件在 android 工作室上有一条线,带有 flutter

[英]Widget has a line through it on android studio with flutter

I'm learning how to make apps with flutter and I'm using android studio with a real phone plugged into my PC to test the app on.我正在学习如何使用 flutter 制作应用程序,并且我正在使用 android 工作室并将真手机插入我的 PC 以测试应用程序。 However, when I add some widgets like RaisedButton, they have a strikethrough in the code editor.但是,当我添加一些像 RaisedButton 这样的小部件时,它们在代码编辑器中有一个删除线。 The code still works perfectly fine however.但是,该代码仍然可以正常工作。 Why is this happening:为什么会这样:

Here is an example of this happening to me.这是发生在我身上的一个例子。

This is the first time this has happened to me.这是我第一次遇到这种情况。 What does it mean?这是什么意思?

That means that the Widget is deprecated and it will be removed in future versions.这意味着 Widget 已被弃用,它将在未来的版本中被删除。 You should replace those Widgets with others that aren't deprecated.您应该用其他未弃用的小部件替换这些小部件。

Deprecation is an early warning that the deprecated feature is scheduled to be removed at a later time, a time possibly specified in message.弃用是一个早期警告,即计划在稍后时间删除弃用的功能,该时间可能在消息中指定。 A deprecated feature should no longer be used, code using it will break at some point in the future.不应再使用已弃用的功能,使用它的代码将在将来的某个时候中断。 If existing code is using the feature, that code should be rewritten to no longer use the deprecated feature.如果现有代码正在使用该功能,则应重写该代码以不再使用已弃用的功能。

For more information visit Flutter Depricated class欲了解更多信息,请访问Flutter 已弃用 class

By the way, Your solution is to avoid Deprication warning Use ElevatedButton() instead of RaisedButton() because RaisedButton() is depricated and should not be used anymore.顺便说一句,您的解决方案是避免贬值警告使用ElevatedButton()而不是RaisedButton()因为RaisedButton()depricated ,不应再使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM