我的档案如下:
homepage.dart
return Scaffold{
appBar: CustomAppBar(),
drawer: CustomDrawer(),
}
CustomAppBar.dart
class HomePageAppBar extends StatelessWidget with PreferredSizeWidget {
return AppBar{
leading: InkWell(
onTap: () {
// Need to open drawer when
我在一个管理页面上工作,我在一个特定的页面上有三个字段,在此之前,我在文本字段中显示错误消息时遇到了问题,但当我修复了这个错误并开始运行我的应用程序时,我遇到了一个新的error.can,有人请帮帮我吧。
下面是我的代码:
class _AddPromoState extends State<AddPromo> {
final databaseReference = Firestore.instance;
var priceReductionController = TextEditingController();
var perReductionController
我想在单击底部选项卡时显示一个SnackBar小部件。我尝试将其显示为:
Scaffold.of(context).showSnackBar(new SnackBar(
content: new Text("Live Clicked"),
));
然而,应用程序抛出了以下异常:
I/flutter ( 4965): The following assertion was thrown while handling a gesture:
I/flutter ( 4965): Scaffold.of() called wi
在遇到可怕的问题后,我把我的项目传给了另一个项目。但现在它给了我这个错误后,试图运行我的程序。我以前从没见过。而且,我没有编辑这些代码,因为它们是库。
../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_neumorphic-3.0.3/lib/src/widget/app_bar.dart:147:57: Error: No named parameter with the name 'nullOk'.
final ScaffoldState scaffold = Scaffold.of
我在使用提供程序包通过SnackBar显示消息时遇到了问题。我得到的错误消息是:
VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, s
有没有一种方法可以通过CupertinoPageScaffold使用SnackBar 我收到以下错误: Scaffold.of() called with a context that does not contain a Scaffold.
No Scaffold ancestor could be found starting from the context that was passed to Scaffold.of(). 在子小部件中调用SnackBar时使用: final snackBar = SnackBar(
content: Text('Yay! A S
我想打电话给你
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("Snack text"),
));
脚手架onPressed of floatingActionButton。
我知道这个错误
I/flutter (18613): Scaffold.of() called with a context that does not contain a Scaffold.
I/flutter (18613): No Scaffold ancestor could be found starting from t
目前,我正在处理一个问题,需要API中的一些数据将其显示到我的小部件中。我遵循了一些提供程序体系结构模式,其中您已经使用了两次setState:
1-当数据被获取时
2-当数据已经被获取时
因此,我目前处理的问题是,我的小部件抛出以下错误:
setState() or markNeedsBuild() called during build.
我知道这个错误是因为在构建过程中调用了setState,但是..。如何在构建过程中获取api,然后将其显示给我的小部件?这是我的代码:
NewsPage.dart
class HomePage extends StatefulWidget {