Skip to content

Commit eaef614

Browse files
committed
Responsive Row Column Creation #3 Part 5
*Use single rowColumn value that is required. *When rowColumn = true, show row. If false, show column.
1 parent 0ca2e84 commit eaef614

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

lib/responsive_row_column.dart

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import 'package:flutter/widgets.dart';
33

44
class ResponsiveRowColumn extends StatelessWidget {
55
final List<ResponsiveRowColumnItem> children;
6-
final bool isRow;
7-
final bool isColumn;
6+
final bool rowColumn;
87
final MainAxisAlignment rowMainAxisAlignment;
98
final MainAxisSize rowMainAxisSize;
109
final CrossAxisAlignment rowCrossAxisAlignment;
@@ -22,12 +21,13 @@ class ResponsiveRowColumn extends StatelessWidget {
2221
final EdgeInsets rowPadding;
2322
final EdgeInsets columnPadding;
2423
final bool fillRow;
24+
get isRow => rowColumn;
25+
get isColumn => !rowColumn;
2526

2627
const ResponsiveRowColumn(
2728
{Key key,
2829
this.children = const [],
29-
this.isRow,
30-
this.isColumn,
30+
@required this.rowColumn,
3131
this.rowMainAxisAlignment = MainAxisAlignment.start,
3232
this.rowMainAxisSize = MainAxisSize.max,
3333
this.rowCrossAxisAlignment = CrossAxisAlignment.center,
@@ -49,17 +49,6 @@ class ResponsiveRowColumn extends StatelessWidget {
4949

5050
@override
5151
Widget build(BuildContext context) {
52-
assert(isRow != null || isColumn != null,
53-
"Missing default isRow or isColumn value.");
54-
assert(!(isRow != null && isColumn != null),
55-
"isRow and isColumn are mutually exclusive and cannot be used simultaneously.");
56-
bool rowColumn;
57-
if (isRow != null) {
58-
rowColumn = isRow;
59-
}
60-
if (isColumn != null) {
61-
rowColumn = !isColumn;
62-
}
6352
return rowColumn
6453
? Padding(
6554
padding: rowPadding,

0 commit comments

Comments
 (0)