What is Constraint layout's equivalent in Flutter?

What is Constraint layout's equivalent in Flutter?



Can I position a widget based on another widget?
like this:



Tiled Layout
Without



flutter_staggered_grid_view Library





Flutter is a constraint layout at its core.
– Rémi Rousselet
Aug 20 at 7:36




1 Answer
1



There is no Widget similar to ConstraintLayout but you can achieve what you want using different widgets, like this example:


Widget


ConstraintLayout


class Testing2 extends StatelessWidget {
@override
Widget build(BuildContext context)
return Container(
color: Colors.red,
child: Row(
children: <Widget>[
Flexible(
child: Column(
children: <Widget>[
Flexible(
flex: 1,
child: Container(
color: Colors.deepOrange,
),
),
Flexible(
flex: 2,
child: Container(
color: Colors.lightBlue,
),
),
],
),
),
Flexible(
child: Column(
children: <Widget>[
Flexible(
flex: 3,
child: Container(
color: Colors.orange,
)),
Flexible(
flex: 1,
child: Row(
children: <Widget>[
Flexible(
flex: 2,
child: Container(
color: Colors.blue,
)),
Flexible(child: Container(color: Colors.green))
],
),
)
],
),
)
],
),
);



Result



Also you can take a look this link to know about Layout Widgets: https://flutter.io/widgets/layout/






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Help:Category

How can temperature be calculated given relative humidity and dew point?

I have a recursive function to validate tree graph and need a return condition