Skip to content

Instantly share code, notes, and snippets.

@sethladd sethladd/original.dart
Last active Jul 12, 2017

Embed
What would you like to do?
return new SingleChildScrollView(
child: new Container(
margin: const EdgeInsets.all(16.0),
child: new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Expanded(child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
return new Container(
constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: const EdgeInsets.all(2.0),
child: new FoodTile(name:"hallo",onPressed: (bool state){}),
);
})),
new Expanded(child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
return new Container(
constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: const EdgeInsets.all(2.0),
child: new FoodTile(name:"hallo 2",onPressed: (bool state){}),
);
})),
new Expanded(child: new LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
return new Container(
constraints: new BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: const EdgeInsets.all(2.0),
child: new FoodTile(name:"hallo 3",onPressed: (bool state){}),
);
})),
],
),
return SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: [
Expanded(child: LayoutBuilder(builder: (_, constraints) =>
Container(
constraints: BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: EdgeInsets.all(2.0),
child: FoodTile(name:"hallo", onPressed: (_){}),
);
)),
Expanded(child: LayoutBuilder(builder: (_, constraints) =>
Container(
constraints: BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: EdgeInsets.all(2.0),
child: FoodTile(name:"hallo 2", onPressed: (_){}),
);
)),
Expanded(child: LayoutBuilder(builder: (_, constraints) =>
Container(
constraints: BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: EdgeInsets.all(2.0),
child: FoodTile(name:"hallo 3", onPressed: (_){}),
);
)),
],
),
Widget expandedContainer(Widget child) {
return Expanded(
child: LayoutBuilder(
builder: (_, constraints) {
return Container(
constraints: BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
padding: EdgeInsets.all(2.0),
child: child),
);
},
),
);
}
return SingleChildScrollView(
child: Container(
margin: EdgeInsets.all(16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: [
expandedContainer(FoodTile(name:"hallo", onPressed: (_){})),
expandedContainer(FoodTile(name:"hallo 2", onPressed: (_){})),
expandedContainer(FoodTile(name:"hallo 3", onPressed: (_){})),
],
),
@yjbanov

This comment has been minimized.

Copy link

yjbanov commented Jul 12, 2017

return SingleChildScrollView(
    child: Container(
      margin: EdgeInsets.all(16.0),

      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        mainAxisSize: MainAxisSize.min,
        children: [
          FoodTile(name:"hallo", onPressed: (_){}),
          FoodTile(name:"hallo 2", onPressed: (_){}),
          FoodTile(name:"hallo 3", onPressed: (_){}),
        ].map((child) => Expanded(
            child: LayoutBuilder(builder: (_, constraints) => Container(
              constraints: BoxConstraints.tightFor(width: constraints.maxWidth, height: constraints.maxWidth),
              padding: EdgeInsets.all(2.0),
              child: child),
            );
          ))).toList(),
      ),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.