File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+
3+ class MaxWidthBox extends StatelessWidget {
4+ final double ? maxWidth;
5+
6+ /// Control the internal Stack alignment. This widget
7+ /// uses a Stack to set the widget to max width on top of
8+ /// a background.
9+ /// Defaults to [Alignment.topCenter] because app
10+ /// content is usually top aligned.
11+ final AlignmentGeometry alignment;
12+ final Widget child;
13+ final Widget ? background;
14+
15+ const MaxWidthBox (
16+ {Key ? key,
17+ required this .maxWidth,
18+ required this .child,
19+ this .background,
20+ this .alignment = Alignment .topCenter})
21+ : super (key: key);
22+
23+ @override
24+ Widget build (BuildContext context) {
25+ return Stack (
26+ alignment: alignment,
27+ children: [
28+ background ?? const SizedBox .shrink (),
29+ SizedBox (width: maxWidth, child: child),
30+ ],
31+ );
32+ }
33+ }
Original file line number Diff line number Diff line change 11library responsive_framework;
22
33export 'breakpoint.dart' ;
4+ export 'max_width_box.dart' ;
45export 'responsive_breakpoints.dart' ;
56export 'responsive_grid.dart' ;
67export 'responsive_row_column.dart' ;
You can’t perform that action at this time.
0 commit comments