Skip to content

Commit

Permalink
Added code snippet for Expanded class. ref:flutter#21136
Browse files Browse the repository at this point in the history
  • Loading branch information
Piinks committed Feb 28, 2019
1 parent 5aedf97 commit c8093a6
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions packages/flutter/lib/src/widgets/basic.dart
Expand Up @@ -4263,6 +4263,59 @@ class Flexible extends ParentDataWidget<Flex> {
/// [Flex] must contain only [StatelessWidget]s or [StatefulWidget]s (not other
/// kinds of widgets, like [RenderObjectWidget]s).
///
/// {@tool sample}
/// This example shows how to use an [Expanded] widget in a [Column] so that
/// it's middle child, a [Container] here, expands to fill the space.
///
/// ```dart
/// Column(
/// children: <Widget>[
/// Container(
/// color: Colors.red,
/// height: 20,
/// ),
/// Expanded(
/// child: Container(
/// color: Colors.blue,
/// ),
/// ),
/// Container(
/// color: Colors.red,
/// height: 50,
/// ),
/// ],
/// )
/// ```
/// {@end-tool}
///
/// {@tool sample}
/// This example shows how to use an [Expanded] widget in a [Row] with multiple
/// children expanded, utilizing the [flex] factor to prioritize available space.
///
/// ```dart
/// Row(
/// children: <Widget>[
/// Expanded(
/// flex: 2,
/// child: Container(
/// color: Colors.red,
/// ),
/// ),
/// Container(
/// color: Colors.blue,
/// width: 50,
/// ),
/// Expanded(
/// flex: 1,
/// child: Container(
/// color: Colors.red,
/// ),
/// ),
/// ],
/// )
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [Flexible], which does not force the child to fill the available space.
Expand Down

0 comments on commit c8093a6

Please sign in to comment.