Flutter Layout Row / Column – share width, expand height

Have a look at IntrinsicHeight; wrapping the root Row should provide the effect you’re looking for: import ‘package:flutter/material.dart’; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: ‘Flutter Demo’, theme: ThemeData( primarySwatch: Colors.blue, ), home: Scaffold( appBar: AppBar(title: Text(‘Rows & Columns’)), body: RowsAndColumns(), ), ); } } … Read more

How to create a modal bottomsheet with circular corners in Flutter?

UPDATED ON 2019-08-05 You can now do it using the default showModalBottomSheet method that now supports adding a ShapeBorder and also backgroundColor! showModalBottomSheet( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10.0), ), backgroundColor: Colors.white, … ); — Instead of overriding the entire theme of the app (which caused problems in various parts of my app) as suggested by other … Read more

Flutter – Container onPressed?

I guess you can use GestureDetector widget like this: new GestureDetector( onTap: (){ print(“Container clicked”); }, child: new Container( width: 500.0, padding: new EdgeInsets.fromLTRB(20.0, 40.0, 20.0, 40.0), color: Colors.green, child: new Column( children: [ new Text(“Ableitungen”), ] ), ) );

How can I layout widgets based on the size of the parent?

You will want to use the LayoutBuilder widget which will build at layout time and provides the parent widget’s constraints. The LayoutBuilder takes in a build() function which has the the standard BuildContext along with the BoxConstraints as parameters that can be used to help dynamically render widgets based on size. Let’s build a simple … Read more

Add border to a Container with borderRadius in Flutter

It’s not possible to add border: and borderRadius: at the same time, you’ll get this error: A borderRadius can only be given for uniform borders. You can achieve what you want using the borderRadius: and a boxShadow: instead of border: like this: boxShadow: [ BoxShadow(color: Colors.green, spreadRadius: 3) ] Your sample code would be like … Read more

Flutter Network Image does not fit in Circular Avatar

This Will Work : You need to use backgroundImage:property in order to fit it in Circle. CircleAvatar( radius: 30.0, backgroundImage: NetworkImage(“${snapshot.data.hitsList[index].previewUrl}”), backgroundColor: Colors.transparent, ) To Check with Dummy Placeholder: CircleAvatar( radius: 30.0, backgroundImage: NetworkImage(‘https://via.placeholder.com/150’), backgroundColor: Colors.transparent, )

How to shift focus to the next TextField in Flutter?

Screenshot: Just use: textInputAction: TextInputAction.next: To move the cursor to the next field. textInputAction: TextInputAction.done: To close the keyboard. @override Widget build(BuildContext context) { return Scaffold( body: Column( children: <Widget>[ TextField( decoration: InputDecoration(hintText: ‘TextField A’), textInputAction: TextInputAction.next, // Moves focus to next. ), TextField( decoration: InputDecoration(hintText: ‘TextField B’), textInputAction: TextInputAction.next, // Moves focus to next. … Read more