flutter-widget

flutter validate radio buttons

[亡魂溺海] 提交于 2021-01-01 07:08:05
问题 How can I add a validator function to a list of RadioButtons in order to have them validated (like TextFormFields with _formKey.currentState.validate() ) after the User submits the Form ? 回答1: You can copy paste run full code below You can use package https://pub.dev/packages/flutter_form_builder It support bulid-in validators such as FormBuilderValidators.required() you can directly use you can also use custom validator function https://pub.dev/packages/flutter_form_builder#custom-validator

Flutter: Object was given an infinite size during layout

我的梦境 提交于 2020-12-08 07:08:58
问题 I'm battling an issue where I'm given the error " Object was given an infinite size during layout " and "This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.". I understand what it means, but not how I can still keep my current widget tree responsive (it renders when running, so for a front-end user there seems to be no problem) while still fixing this issue. Currently I

Flutter: Object was given an infinite size during layout

冷暖自知 提交于 2020-12-08 07:05:02
问题 I'm battling an issue where I'm given the error " Object was given an infinite size during layout " and "This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.". I understand what it means, but not how I can still keep my current widget tree responsive (it renders when running, so for a front-end user there seems to be no problem) while still fixing this issue. Currently I

Flutter: Object was given an infinite size during layout

别等时光非礼了梦想. 提交于 2020-12-08 07:04:50
问题 I'm battling an issue where I'm given the error " Object was given an infinite size during layout " and "This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size.". I understand what it means, but not how I can still keep my current widget tree responsive (it renders when running, so for a front-end user there seems to be no problem) while still fixing this issue. Currently I

A non-null String must be provided to a Text widget

谁都会走 提交于 2020-12-01 09:44:12
问题 I'm trying to add the option for the quantity to be adjusted but I get an error saying "A non-null String must be provided to a Text widget" How do I provide this, to this code? trailing: Container( height: 60, width: 60, padding: EdgeInsets.only(left: 10), child: Column( children: <Widget>[ new GestureDetector(child: Icon(Icons.arrow_drop_up), onTap: () {}), new Text(cart_prod_qty), new GestureDetector(child: Icon(Icons.arrow_drop_down), onTap: () {}) ], ), 回答1: You should check null safe

Keep widget from filling ancestor Expanded in Flutter

*爱你&永不变心* 提交于 2020-07-21 02:36:28
问题 How do I keep a RaisedButton from expanding to fill an Expanded that contains it? I want to create three columns of widths proportional to the space available, but I want the child in each column to be its natural size, without consuming the entire width of its parent Expanded . Widget _controls(BuildContext cx) { return Row( children: [ Expanded( flex: 1, child: player.isOnFirstItem ? Container() : IconButton( icon: Icon(Icons.arrow_back), onPressed: () => control.gotoPreviousItem(), ), ),

Create widget with transparent hole inside

荒凉一梦 提交于 2020-06-24 10:31:29
问题 How can I create a semi-transparent background with the transparent hole inside? I tried to use decoration and foreground decorations with different blend modes, stack, ClipRect, colorfilters, but nothing works. I will appreciate any ideas. Thanks! 回答1: The "easiest" way I've found to do it is using a ColorFiltered Widget with a Stack . The following code will create exactly what you need: @override Widget build(BuildContext context) { return Material( child: Stack( fit: StackFit.expand,

Create widget with transparent hole inside

久未见 提交于 2020-06-24 10:29:29
问题 How can I create a semi-transparent background with the transparent hole inside? I tried to use decoration and foreground decorations with different blend modes, stack, ClipRect, colorfilters, but nothing works. I will appreciate any ideas. Thanks! 回答1: The "easiest" way I've found to do it is using a ColorFiltered Widget with a Stack . The following code will create exactly what you need: @override Widget build(BuildContext context) { return Material( child: Stack( fit: StackFit.expand,

Why only the content in ListView.builder() is not scrolling?

吃可爱长大的小学妹 提交于 2020-06-01 06:47:29
问题 I have a screen with Text widgets and ListView, and when I try to scroll inside the ListView, it doesn't allow me to scroll. My body is SingleChildScrollView but that doesn't provide scrollView for the ListView.builder. I tried to wrap the ListView.build inside Expanded, but didn't work out. class HomePageState extends State<HomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: new AppBar( title: Text("MyBar"), centerTitle: true, ), body: SingleChildScrollView

How to implement Scroll Controller in Flutter (Scroll Widget)?

柔情痞子 提交于 2020-03-28 06:58:56
问题 I am trying to implement a Scroll Widget in Flutter but not able to implement it. I saw many tutorials but they have implemented scroll widget with ListView or Grid View. In my case, I have Register page with multiple Text Inputs and Buttons. In this case, my page is not scrolling down please help someone. div{ Scroll Widget on the Register page. } 回答1: like this class ExampleScroll extends StatefulWidget { @override _ExampleScrollState createState() => _ExampleScrollState(); } class