草庐IT

layout_align_parent_right

全部标签

dart - Flutter - 如何将 focusNode 从 Parent 设置为 Child 小部件?

我在父小部件中有一个底部导航,在子小部件中有一些文本字段。当用户单击导航选项卡并且其中一个文本字段为空时,它将把焦点设置在特定的文本字段上。我正在使用从一位开发人员那里学到的构造函数方法,但是我无法让它工作。好像我没有正确传递上下文。我不确定。谁能发现我的错误或建议可以达到相同结果的其他方法?登录.dartclassLoginextendsStatefulWidget{@overrideStatecreateState(){return_LoginState();}}class_LoginStateextendsState{FocusNodefocusNode;Page1focus;@

Git 错误,命令 git fetch Fatal : not a git repository (or any of the parent directories): . git in visual studio code

我必须从Flutterforweb开始,下载DARTsdk以及Visualstudio代码,我已经安装了Flutter插件是VS代码,但它显示错误Git错误,命令gitfetch致命:不是git存储库(或任何父目录):.git进程结束,退出代码为69我已经在Intellij中设置了git路径并在Windows中设置了桌面环境但是也有(Intellij),同样的错误即将到来Ps:我是新手,请详细建议我解决方案 最佳答案 您的工作副本似乎不是克隆的。通过以下命令克隆SDK:gitclonehttps://github.com/dart-

flutter : how to left aligned a checkbox

我正在为我的应用程序添加一个复选框和列表标题。但是,这些项目不会与其他小部件对齐。我怎样才能将它与其他小部件对齐这是一张图片 最佳答案 您可以使用CheckboxListTile小部件,它具有名为controlAffinity的属性。将其设置为leading将使复选框左对齐。以下是示例工作代码:CheckboxListTile(controlAffinity:ListTileControlAffinity.leading,title:Text('IagreetotheTermsandConditions'),value:monVal

Flutter - 从 parent 那里调用一些 child 的方法

我正在探索Flutter,我真的很喜欢它。我正在构建一个简单的应用程序,其中我在Scafold的主体上有几个Statefull自定义小部件“计数器”的实例,并且我在抽屉上有一个“重置”按钮。当点击“重置”按钮时,在所有“计数器”实例上调用“重置计数器”方法的最佳方式是什么?我已经找到了另一种方法(从child调用parent的回调方法),但我找不到其他方法。我找到的唯一解决方案是使用GlobalKeys,但它似乎不合适。谢谢 最佳答案 确实对于您的案例回调函数可能是正确的。但是当您的应用程序增长时,小部件层次结构将变得越来越复杂。现

android - flutter/Dart ,开关 : Another exception was thrown: A RenderFlex overflowed by 99640 pixels on the right

我目前正在尝试向我的android应用程序的设置页面添加一个开关。但是,当我添加代码并尝试在模拟器上查看它时,它会抛出以下错误:Anotherexceptionwasthrown:ARenderFlexoverflowedby99640pixelsontheright.代码:Container(decoration:BoxDecoration(color:Colors.white,border:Border(bottom:BorderSide(width:1.0,color:Colors.grey)),),constraints:BoxConstraints(maxHeight:((w

android - 我/flutter (17109) : Another exception was thrown: A RenderFlex overflowed by 80 pixels on the right

我正在使用带有卡片的ListView,但我需要在左侧放置一条丝带错误:I/flutter(17109):Anotherexceptionwasthrown:ARenderFlexoverflowedby80pixelsontheright.I/flutter(17109):Anotherexceptionwasthrown:ARenderFlexoverflowedby2.0pixelsontheright.I/flutter(17109):Anotherexceptionwasthrown:ARenderFlexoverflowedby63pixelsontheright.I/flu

dart - Flutter 又抛出一个异常 : RenderBox was not laid out: RenderRepaintBoundary#eaea6 NEEDS-LAYOUT NEEDS-PAINT

我正在使用SingleChildScrollView和Column来显示滑动条和gridview。如果我在我的专栏中使用一些其他小部件,如文本、图像,应用程序显示正常。但是我的swiper和gridview无法显示,报错:I/flutter(4687):══╡EXCEPTIONCAUGHTBYRENDERINGLIBRARY╞═════════════════════════════════════════════════════════I/flutter(4687):ThefollowingassertionwasthrownduringperformLayout():I/flutt

layout - 基于同级最大宽度显示小部件

我有一个列,它包含许多不同大小的文本条目,我想让它们扩展到与最大文本相同的宽度。我的文本条目被包裹在一个带有颜色的容器中,我想将它们全部与容器对齐,以便它可以用直线边框呈现。我如何在Flutter中指示它? 最佳答案 这是IntrinsicWidth的一个很好的用例.您可以将它与CrossAxisAlignment.stretch一起使用确定child的内在宽度并用它来设置你的宽度Column:这是生成上述图像的示例代码。import'package:flutter/material.dart';voidmain(){runApp(

flutter - 如何在没有错误的情况下缩小 parent 忽略 child 的大小

我想将容器设置为高度0的动画。我希望child缩小到它,但显然它会抛出溢出像素错误。而且我不知道如何让children无误地缩小。我尝试搜索一些像BoxContraints这样的小部件以使其忽略溢出或类似的东西,但我什至不确定该怎么做_topContainerHeight=_queryFieldHasFocus?0:MediaQuery.of(context).size.height/1.75;returnStreamBuilder(stream:_authService.userStream,builder:(context,snapshot){ConnectionStatestat

layout - Flutter Align widget rect 不检测 onTap 手势

我有几个图像按钮布局如下:布局代码为:newContainer(height:48.0,child:newRow(children:[newGestureDetector(onTap:cancelTurn,child:newAlign(child:newImage.asset("assets/cancel_button.png"),widthFactor:1.5),),newExpanded(child:newContainer()),newGestureDetector(onTap:confirmTurn,child:newAlign(child:newImage.asset("as