fix(app): cap the list width on very wide monitors
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user