Files
pipelines/app/lib/ui/layout/content_width.dart
T

24 lines
719 B
Dart

import 'package:flutter/widgets.dart';
/// The widest a list column grows on a large monitor.
///
/// Web pages keep their lists readable instead of stretching a row across the
/// whole display; the same cap applies to the native lists.
const double kContentMaxWidth = 1100;
/// Centres [child] and caps its width, keeping the incoming height constraints.
class ContentWidth extends StatelessWidget {
const ContentWidth({super.key, required this.child, this.maxWidth = kContentMaxWidth});
final Widget child;
final double maxWidth;
@override
Widget build(BuildContext context) => Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth),
child: child,
),
);
}