Skip to content

Commit

Permalink
Make merged PR with mainAxisSize.min a property and use old value mai…
Browse files Browse the repository at this point in the history
…nAxisSize.max as default to not change past config.
  • Loading branch information
rydmike committed May 14, 2024
1 parent e180269 commit cf81218
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/src/color_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class ColorPicker extends StatefulWidget {
this.includeIndex850 = false,
this.enableTonalPalette = false,
// Layout
this.mainAxisSize = MainAxisSize.max,
this.crossAxisAlignment = CrossAxisAlignment.center,
this.padding = const EdgeInsets.all(16),
this.columnSpacing = 8,
Expand Down Expand Up @@ -287,6 +288,21 @@ class ColorPicker extends StatefulWidget {
/// Defaults to CrossAxisAlignment.center.
final CrossAxisAlignment crossAxisAlignment;

/// How much space should be occupied in the color picker's vertical axis.
///
/// After allocating space to children, in the ColorPicker column there
/// might be some remaining free space. This value controls whether to
/// maximize or minimize the amount of
/// free space, subject to the incoming layout constraints.
///
/// If some children have a non-zero flex factors (and none have a fit of
/// [FlexFit.loose]), they will expand to consume all the available space and
/// there will be no remaining free space to maximize or minimize, making this
/// value irrelevant to the final layout.
///
/// Defaults to [MainAxisSize.max] like [Column] does as well.
final MainAxisSize mainAxisSize;

/// Padding around the entire color picker content.
///
/// Defaults to const EdgeInsets.all(16).
Expand Down Expand Up @@ -1781,7 +1797,7 @@ class _ColorPickerState extends State<ColorPicker> {
child: Padding(
padding: widget.padding,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisSize: widget.mainAxisSize,
crossAxisAlignment: widget.crossAxisAlignment,
children: <Widget>[
// Show title bar widget if we have one.
Expand Down
16 changes: 16 additions & 0 deletions lib/src/show_color_picker_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ Future<Color> showColorPickerDialog(
/// Defaults to false.
final bool enableTonalPalette = false,

/// How much space should be occupied in the color picker's vertical axis.
///
/// After allocating space to children, in the ColorPicker column there
/// might be some remaining free space. This value controls whether to
/// maximize or minimize the amount of
/// free space, subject to the incoming layout constraints.
///
/// If some children have a non-zero flex factors (and none have a fit of
/// [FlexFit.loose]), they will expand to consume all the available space and
/// there will be no remaining free space to maximize or minimize, making this
/// value irrelevant to the final layout.
///
/// Defaults to `MainAxisSize.max` like Column does as well.
final MainAxisSize mainAxisSize = MainAxisSize.max,

/// Cross axis alignment used to layout the main content of the
/// color picker in its column layout.
///
Expand Down Expand Up @@ -689,6 +704,7 @@ Future<Color> showColorPickerDialog(
includeIndex850: includeIndex850,
enableTonalPalette: enableTonalPalette,
crossAxisAlignment: crossAxisAlignment,
mainAxisSize: mainAxisSize,
padding: padding,
columnSpacing: columnSpacing,
toolbarSpacing: toolbarSpacing,
Expand Down

0 comments on commit cf81218

Please sign in to comment.