Improve container widget (#98389)
This commit is contained in:
parent
513df67edb
commit
d61caaad26
@ -389,10 +389,9 @@ class Container extends StatelessWidget {
|
|||||||
maxHeight: 0.0,
|
maxHeight: 0.0,
|
||||||
child: ConstrainedBox(constraints: const BoxConstraints.expand()),
|
child: ConstrainedBox(constraints: const BoxConstraints.expand()),
|
||||||
);
|
);
|
||||||
}
|
} else if (alignment != null) {
|
||||||
|
|
||||||
if (alignment != null)
|
|
||||||
current = Align(alignment: alignment!, child: current);
|
current = Align(alignment: alignment!, child: current);
|
||||||
|
}
|
||||||
|
|
||||||
final EdgeInsetsGeometry? effectivePadding = _paddingIncludingDecoration;
|
final EdgeInsetsGeometry? effectivePadding = _paddingIncludingDecoration;
|
||||||
if (effectivePadding != null)
|
if (effectivePadding != null)
|
||||||
|
@ -633,6 +633,21 @@ void main() {
|
|||||||
expect(tapped, false);
|
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 {
|
testWidgets('using clipBehaviour and shadow, should not clip the shadow', (WidgetTester tester) async {
|
||||||
final Container container = Container(
|
final Container container = Container(
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user