Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo_app/test/flex/column/center/gap-2/center.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo_app/test/flex/row/baseline/gap-2/center.png
Binary file added demo_app/test/flex/row/center/gap-2/center.png
Binary file added demo_app/test/flex/row/center/gap-2/flex-end.png
Binary file added demo_app/test/flex/row/flex-end/gap-2/center.png
Binary file added demo_app/test/flex/row/stretch/gap-2/center.png
Binary file added demo_app/test/flex/row/stretch/gap-2/flex-end.png
2 changes: 2 additions & 0 deletions packages/core/lib/src/core_widget_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class WidgetFactory extends WidgetFactoryResetter with AnchorWidgetFactory {
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center,
required Axis direction,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start,
double spacing = 0.0,
TextBaseline textBaseline = TextBaseline.alphabetic,
TextDirection textDirection = TextDirection.ltr,
}) {
Expand All @@ -238,6 +239,7 @@ class WidgetFactory extends WidgetFactoryResetter with AnchorWidgetFactory {
crossAxisAlignment: crossAxisAlignment,
direction: direction,
mainAxisAlignment: mainAxisAlignment,
spacing: spacing,
textBaseline: textBaseline,
textDirection: textDirection,
children: children,
Expand Down
26 changes: 17 additions & 9 deletions packages/core/lib/src/internal/ops/style_display_flex.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
part of '../core_ops.dart';

const kCssAlignItems = 'align-items';
const kCssAlignItemsFlexStart = 'flex-start';
const kCssAlignItemsFlexEnd = 'flex-end';
const kCssAlignItemsCenter = 'center';
const kCssAlignItemsBaseline = 'baseline';
const kCssAlignItemsStretch = 'stretch';

const kCssFlexDirection = 'flex-direction';
const kCssFlexDirectionColumn = 'column';
const kCssFlexDirectionRow = 'row';

const kCssGap = 'gap';

const kCssJustifyContent = 'justify-content';
const kCssJustifyContentFlexStart = 'flex-start';
const kCssJustifyContentFlexEnd = 'flex-end';
const kCssJustifyContentCenter = 'center';
const kCssJustifyContentSpaceBetween = 'space-between';
const kCssJustifyContentSpaceAround = 'space-around';
const kCssJustifyContentSpaceEvenly = 'space-evenly';
const kCssAlignItems = 'align-items';
const kCssAlignItemsFlexStart = 'flex-start';
const kCssAlignItemsFlexEnd = 'flex-end';
const kCssAlignItemsCenter = 'center';
const kCssAlignItemsBaseline = 'baseline';
const kCssAlignItemsStretch = 'stretch';

class StyleDisplayFlex {
final WidgetFactory wf;
Expand All @@ -30,21 +34,24 @@ class StyleDisplayFlex {
return null;
}

String alignItems = kCssAlignItemsFlexStart;
String flexDirection = kCssFlexDirectionRow;
CssLength? gap;
String justifyContent = kCssJustifyContentFlexStart;
String alignItems = kCssAlignItemsFlexStart;

for (final element in tree.element.styles) {
final String? value = element.term;

if (value != null) {
switch (element.property) {
case kCssAlignItems:
alignItems = value;
case kCssFlexDirection:
flexDirection = value;
case kCssGap:
gap = tryParseCssLength(element.value);
case kCssJustifyContent:
justifyContent = value;
case kCssAlignItems:
alignItems = value;
}
}
}
Expand All @@ -65,6 +72,7 @@ class StyleDisplayFlex {
? Axis.horizontal
: Axis.vertical,
mainAxisAlignment: _toMainAxisAlignment(justifyContent),
spacing: gap?.getValue(resolved) ?? 0.0,
textDirection: resolved.directionOrLtr,
);
},
Expand Down
Loading