Commit c713aa00 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

BoxFit documentation (#10397)

parent 2ab60e93
...@@ -13,33 +13,68 @@ import 'basic_types.dart'; ...@@ -13,33 +13,68 @@ import 'basic_types.dart';
/// ///
/// See also [applyBoxFit], which applies the sizing semantics of these values /// See also [applyBoxFit], which applies the sizing semantics of these values
/// (though not the alignment semantics). /// (though not the alignment semantics).
///
/// The following diagrams show the effects of each value:
///
/// ![`fill`: Fill the target box by distorting the source's aspect ratio.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fill.png)
///
/// ![`contain`: As large as possible while still containing the source entirely within the target box.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_contain.png)
///
/// ![`cover`: As small as possible while still covering the entire target box.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_cover.png)
///
/// ![`fitWidth`: Make sure the full width of the source is shown.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fitWidth.png)
///
/// ![`fitHeight`: Make sure the full height of the source is shown.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fitHeight.png)
///
/// ![`none`: Do not resize the source.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_none.png)
///
/// ![`scaleDown`: Same as `contain` if that would shrink the image, otherwise same as `none`.](https://flutter.github.io/assets-for-api-docs/painting/box_fit_scaleDown.png)
enum BoxFit { enum BoxFit {
/// Fill the target box by distorting the source's aspect ratio. /// Fill the target box by distorting the source's aspect ratio.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fill.png)
fill, fill,
/// As large as possible while still containing the source entirely within the /// As large as possible while still containing the source entirely within the
/// target box. /// target box.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_contain.png)
contain, contain,
/// As small as possible while still covering the entire target box. /// As small as possible while still covering the entire target box.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_cover.png)
cover, cover,
/// Make sure the full width of the source is shown, regardless of /// Make sure the full width of the source is shown, regardless of
/// whether this means the source overflows the target box vertically. /// whether this means the source overflows the target box vertically.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fitWidth.png)
fitWidth, fitWidth,
/// Make sure the full height of the source is shown, regardless of /// Make sure the full height of the source is shown, regardless of
/// whether this means the source overflows the target box horizontally. /// whether this means the source overflows the target box horizontally.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_fitHeight.png)
fitHeight, fitHeight,
/// Align the source within the target box (by default, centering) and discard /// Align the source within the target box (by default, centering) and discard
/// any portions of the source that lie outside the box. /// any portions of the source that lie outside the box.
///
/// The source image is not resized.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_none.png)
none, none,
/// Align the source within the target box (by default, centering) and, if /// Align the source within the target box (by default, centering) and, if
/// necessary, scale the source down to ensure that the source fits within the /// necessary, scale the source down to ensure that the source fits within the
/// box. /// box.
scaleDown ///
/// This is the same as `contain` if that would shrink the image, otherwise it
/// is the same as `none`.
///
/// ![](https://flutter.github.io/assets-for-api-docs/painting/box_fit_scaleDown.png)
scaleDown,
} }
/// The pair of sizes returned by [applyBoxFit]. /// The pair of sizes returned by [applyBoxFit].
...@@ -56,7 +91,7 @@ class FittedSizes { ...@@ -56,7 +91,7 @@ class FittedSizes {
final Size destination; final Size destination;
} }
/// Apply an [BoxFit] value. /// Apply a [BoxFit] value.
/// ///
/// The arguments to this method, in addition to the [BoxFit] value to apply, /// The arguments to this method, in addition to the [BoxFit] value to apply,
/// are two sizes, ostensibly the sizes of an input box and an output box. /// are two sizes, ostensibly the sizes of an input box and an output box.
......
...@@ -330,7 +330,7 @@ class BorderSide { ...@@ -330,7 +330,7 @@ class BorderSide {
/// ///
/// ```dart /// ```dart
/// // All four borders the same, two-pixel wide solid white: /// // All four borders the same, two-pixel wide solid white:
/// const Border.all(width: 2.0, color: const Color(0xFFFFFFFF)) /// new Border.all(width: 2.0, color: const Color(0xFFFFFFFF))
/// ``` /// ```
/// ///
/// ```dart /// ```dart
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment