草庐IT

零部件

全部标签

flutter - 为 Circle Avatar 小部件 overflow hidden (Flutter)

我需要将图标放入CircleAvatarWidget以允许用户上传他的图像​​。像这样:这是我的代码:child:CircleAvatar(child:Stack(children:[Positioned(bottom:0,right:0,left:0,height:33,child:Container(height:20,width:30,color:Color.fromRGBO(0,0,0,.74),child:Center(child:Icon(Icons.photo_camera,color:Colors.grey),),),)],),radius:68.0,backgroun

flutter - 英雄小部件多次初始化子小部件

无论何时,我都有一个关于StatefulWidget的Hero小部件,State.initState方法在导航到该页面时被调用三次次而不是一次。这显然只有在另一个页面也有一个带有相同标签的Hero时才会发生。classPageextendsStatelessWidget{constPage({Keykey}):super(key:key);@overrideWidgetbuild(BuildContextcontext)=>Scaffold(body:Hero(tag:'tag',child:HeroContent()));}classHeroContentextendsStatefu

flutter - 英雄小部件多次初始化子小部件

无论何时,我都有一个关于StatefulWidget的Hero小部件,State.initState方法在导航到该页面时被调用三次次而不是一次。这显然只有在另一个页面也有一个带有相同标签的Hero时才会发生。classPageextendsStatelessWidget{constPage({Keykey}):super(key:key);@overrideWidgetbuild(BuildContextcontext)=>Scaffold(body:Hero(tag:'tag',child:HeroContent()));}classHeroContentextendsStatefu

flutter - 如何修复隐藏其子项的 Aspectratio 小部件?

我正在尝试将一个materialbutton小部件制作成一个正方形。我想要其中的4个按钮形成它们自己的正方形。像这样:所以我尝试了这个:@overrideWidgetbuild(BuildContextcontext){returnContainer(color:Colors.green,child:Column(mainAxisSize:MainAxisSize.max,children:[Row(mainAxisSize:MainAxisSize.max,children:[AspectRatio(aspectRatio:1,child:MaterialButton(child:I

flutter - 如何修复隐藏其子项的 Aspectratio 小部件?

我正在尝试将一个materialbutton小部件制作成一个正方形。我想要其中的4个按钮形成它们自己的正方形。像这样:所以我尝试了这个:@overrideWidgetbuild(BuildContextcontext){returnContainer(color:Colors.green,child:Column(mainAxisSize:MainAxisSize.max,children:[Row(mainAxisSize:MainAxisSize.max,children:[AspectRatio(aspectRatio:1,child:MaterialButton(child:I

flutter - BottomNavigatonBar 的 onTap(index) 方法上的 SetState() 不会重建小部件树

我正在尝试将webview_flutterWebView连接到BottomNavigationBar。我希望在点击选项卡时使用新URL重新加载View。在onTap回调我将_currentUrl更新为新的url并使用新的选项卡索引调用设置状态。为什么标签栏正在更新但网页View没有重建?我错过了什么?classWebViewAppextendsStatefulWidget{@overrideStatecreateState(){returnWebViewState();}}classWebViewStateextendsState{int_currentTabIndex=0;Strin

flutter - BottomNavigatonBar 的 onTap(index) 方法上的 SetState() 不会重建小部件树

我正在尝试将webview_flutterWebView连接到BottomNavigationBar。我希望在点击选项卡时使用新URL重新加载View。在onTap回调我将_currentUrl更新为新的url并使用新的选项卡索引调用设置状态。为什么标签栏正在更新但网页View没有重建?我错过了什么?classWebViewAppextendsStatefulWidget{@overrideStatecreateState(){returnWebViewState();}}classWebViewStateextendsState{int_currentTabIndex=0;Strin

flutter - 如何将小部件作为参数传递给函数

我想将一些小部件作为参数传递给函数,flutter支持吗?下面是我的代码。我应该将小部件作为参数传递给函数吗?这是我想作为参数传递的小部件:classFirstWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnContainer(child:Text('iamthefirst'),);}}classSecondWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnContainer(c

flutter - 如何将小部件作为参数传递给函数

我想将一些小部件作为参数传递给函数,flutter支持吗?下面是我的代码。我应该将小部件作为参数传递给函数吗?这是我想作为参数传递的小部件:classFirstWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnContainer(child:Text('iamthefirst'),);}}classSecondWidgetextendsStatelessWidget{@overrideWidgetbuild(BuildContextcontext){returnContainer(c

flutter - 如何使用 flutter 小部件实现虚线文本字段

我对如何实现虚线文本字段感到困惑,例如使用flutter小部件附加的图像。我已经搜索了文本字段类,但无法提出解决方案。任何帮助将不胜感激 最佳答案 好吧,我有相同的布局要求。所以我用了这个它的位长,我猜是乱七八糟的(因为你需要用填充来播放)但确实有用。输出代码Container(padding:EdgeInsets.only(left:25.0,right:25.0),width:MediaQuery.of(context).size.width,height:45.0,child:newRow(mainAxisAlignment: