Unverified Commit d61caaad authored by Reza Mirzaee's avatar Reza Mirzaee Committed by GitHub

Improve container widget (#98389)

parent 513df67e
......@@ -389,10 +389,9 @@ class Container extends StatelessWidget {
maxHeight: 0.0,
child: ConstrainedBox(constraints: const BoxConstraints.expand()),
);
}
if (alignment != null)
} else if (alignment != null) {
current = Align(alignment: alignment!, child: current);
}
final EdgeInsetsGeometry? effectivePadding = _paddingIncludingDecoration;
if (effectivePadding != null)
......
......@@ -633,6 +633,21 @@ void main() {
expect(tapped, false);
});
testWidgets('Container discards alignment when the child parameter is null and constraints is not Tight', (WidgetTester tester) async {
await tester.pumpWidget(
Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(1)),
),
alignment: Alignment.centerLeft
));
expect(
find.byType(Align),
findsNothing,
);
});
testWidgets('using clipBehaviour and shadow, should not clip the shadow', (WidgetTester tester) async {
final Container container = Container(
clipBehavior: Clip.hardEdge,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment