flutter-layout

Flutter Enable/Disable Button based on TextFormField content

一个人想着一个人 提交于 2020-12-03 11:26:51
问题 How can I activate/deactivate a button based on the content of a TextFormField? I want to make sure a user can only press Button X if the TextFormField has 10 entered numbers (if it's a mobile number). Thanks! 回答1: A simple way would be to set the autovalidate property of our TextFormField to true . This will automatically detect for changes on our TextFormField widget. We can then try to check if our TextFormField's value has a String length of 10 characters on the validator property . After

Flutter Enable/Disable Button based on TextFormField content

这一生的挚爱 提交于 2020-12-03 11:24:09
问题 How can I activate/deactivate a button based on the content of a TextFormField? I want to make sure a user can only press Button X if the TextFormField has 10 entered numbers (if it's a mobile number). Thanks! 回答1: A simple way would be to set the autovalidate property of our TextFormField to true . This will automatically detect for changes on our TextFormField widget. We can then try to check if our TextFormField's value has a String length of 10 characters on the validator property . After

How to make flutter card auto adjust its height depend on content

感情迁移 提交于 2020-12-01 10:20:24
问题 In the project im using image and text inside the flutter card, but the card return a fixed height. and then i also tried just using a card with an empty value, but it still return a fixed height. what should i do to make the height of card auto adjust with content. @override Widget build(BuildContext context) { final title = 'Food Recipes'; return MaterialApp( title: title, home: Scaffold( appBar: AppBar( title: Text(title), ), body: GridView.builder( itemCount: _listViewData.length,

How to make flutter card auto adjust its height depend on content

不羁岁月 提交于 2020-12-01 10:20:07
问题 In the project im using image and text inside the flutter card, but the card return a fixed height. and then i also tried just using a card with an empty value, but it still return a fixed height. what should i do to make the height of card auto adjust with content. @override Widget build(BuildContext context) { final title = 'Food Recipes'; return MaterialApp( title: title, home: Scaffold( appBar: AppBar( title: Text(title), ), body: GridView.builder( itemCount: _listViewData.length,

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

Add border to a Container with borderRadius in Flutter

被刻印的时光 ゝ 提交于 2020-11-30 20:00:10
问题 Container( child: Text( 'This is a Container', textScaleFactor: 2, style: TextStyle(color: Colors.black), ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, border: Border( left: BorderSide( color: Colors.green, width: 3, ), ), ), height: 50, ), This is supposed to show a rounded-edged container with a green left border 3px wide, and the child Text "This is a Container". However, it just shows a rounded-edged container with an invisible child and an

Add border to a Container with borderRadius in Flutter

独自空忆成欢 提交于 2020-11-30 19:45:33
问题 Container( child: Text( 'This is a Container', textScaleFactor: 2, style: TextStyle(color: Colors.black), ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, border: Border( left: BorderSide( color: Colors.green, width: 3, ), ), ), height: 50, ), This is supposed to show a rounded-edged container with a green left border 3px wide, and the child Text "This is a Container". However, it just shows a rounded-edged container with an invisible child and an

Add border to a Container with borderRadius in Flutter

倾然丶 夕夏残阳落幕 提交于 2020-11-30 19:44:56
问题 Container( child: Text( 'This is a Container', textScaleFactor: 2, style: TextStyle(color: Colors.black), ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, border: Border( left: BorderSide( color: Colors.green, width: 3, ), ), ), height: 50, ), This is supposed to show a rounded-edged container with a green left border 3px wide, and the child Text "This is a Container". However, it just shows a rounded-edged container with an invisible child and an

Add border to a Container with borderRadius in Flutter

◇◆丶佛笑我妖孽 提交于 2020-11-30 19:42:51
问题 Container( child: Text( 'This is a Container', textScaleFactor: 2, style: TextStyle(color: Colors.black), ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, border: Border( left: BorderSide( color: Colors.green, width: 3, ), ), ), height: 50, ), This is supposed to show a rounded-edged container with a green left border 3px wide, and the child Text "This is a Container". However, it just shows a rounded-edged container with an invisible child and an

Add border to a Container with borderRadius in Flutter

北慕城南 提交于 2020-11-30 19:41:29
问题 Container( child: Text( 'This is a Container', textScaleFactor: 2, style: TextStyle(color: Colors.black), ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.white, border: Border( left: BorderSide( color: Colors.green, width: 3, ), ), ), height: 50, ), This is supposed to show a rounded-edged container with a green left border 3px wide, and the child Text "This is a Container". However, it just shows a rounded-edged container with an invisible child and an