Last active
December 30, 2019 02:09
-
-
Save fonkamloic/89f76611acdea87c4f54448944216634 to your computer and use it in GitHub Desktop.
How to make Wrap to not minimise height (reduce number of rows) as much as possible
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
double kHeight = 100; | |
double kWidth = 100; | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: SafeArea( | |
child: Card( | |
child: Wrap( | |
alignment: WrapAlignment.end, | |
children: [ | |
Row(mainAxisSize: MainAxisSize.min, children: [ | |
Container(child: Text("A"), height: kHeight, width: kWidth), | |
Container(child: Text("B"), height: kHeight, width: kWidth), | |
Container(child: Text("C"), height: kHeight, width: kWidth), | |
]), | |
Container( | |
child: Text("1"), height: kHeight / 2, width: kWidth / 2), | |
Container( | |
child: Text("2"), height: kHeight / 2, width: kWidth / 2), | |
Container( | |
child: Text("3"), height: kHeight / 2, width: kWidth / 2), | |
Container( | |
child: Text("4"), height: kHeight / 2, width: kWidth / 2), | |
Container( | |
child: Text("5"), height: kHeight / 2, width: kWidth / 2), | |
Container( | |
child: Text("7"), height: kHeight / 2, width: kWidth / 2), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment