Solian/lib/widgets/sized_container.dart

47 lines
946 B
Dart
Raw Normal View History

2024-07-06 13:14:19 +00:00
import 'package:flutter/material.dart';
2024-07-12 08:19:54 +00:00
class SizedContainer extends StatelessWidget {
final Widget child;
final double maxWidth;
final double maxHeight;
2024-07-12 08:19:54 +00:00
const SizedContainer({
super.key,
required this.child,
this.maxWidth = 720,
this.maxHeight = double.infinity,
2024-07-12 08:19:54 +00:00
});
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
2024-08-06 16:12:44 +00:00
child: Container(
constraints: BoxConstraints(maxWidth: maxWidth, maxHeight: maxHeight),
2024-07-12 08:19:54 +00:00
child: child,
),
);
}
}
2024-07-06 13:14:19 +00:00
class CenteredContainer extends StatelessWidget {
final Widget child;
final double maxWidth;
const CenteredContainer({
super.key,
required this.child,
this.maxWidth = 720,
});
@override
Widget build(BuildContext context) {
return Center(
2024-08-06 16:12:44 +00:00
child: Container(
constraints: BoxConstraints(maxWidth: maxWidth),
2024-07-06 13:14:19 +00:00
child: child,
),
);
}
}