2176b396ac
The selected tab's whole button (62 px Material, 60 px Cupertino, from 52/50) and its icon grow with the selection in the layout, so the other buttons move over and every gap stays the same; the previous selection shrinks back. The row is as tall as the selected button with the others centred on it.
28 lines
736 B
Dart
28 lines
736 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,
|
|
),
|
|
);
|
|
}
|