flutter-layout

Add border to a Container with borderRadius in Flutter

戏子无情 提交于 2020-11-30 19:40:25
问题 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

How to add red asterisk in label of TextFormField In Flutter

对着背影说爱祢 提交于 2020-11-29 09:09:54
问题 As we are not able to make widget like RichText/Text Span For styling TextFormField, How we can achieve a result like this? Can anyone help me out regarding this... thanks in advance. Now Getting:- Expected Result:- 回答1: Simplest way, but not exactly equals: TextField( decoration: InputDecoration( hintText: 'Ciao', suffixText: '*', suffixStyle: TextStyle( color: Colors.red, ), ), ), Or create a custom TextField to use hint as Widget instead of String You can use my two customized files: input