Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expanded Snippet for API Docs #28681

Merged
merged 2 commits into from Mar 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
77 changes: 77 additions & 0 deletions packages/flutter/lib/src/widgets/basic.dart
Expand Up @@ -4263,6 +4263,83 @@ class Flexible extends ParentDataWidget<Flex> {
/// [Flex] must contain only [StatelessWidget]s or [StatefulWidget]s (not other
/// kinds of widgets, like [RenderObjectWidget]s).
///
/// {@tool snippet --template=stateless_widget_material}
/// 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
/// Widget build(BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// title: Text('Expanded Column Sample'),
/// ),
/// body: Center(
/// child: Column(
/// children: <Widget>[
/// Container(
/// color: Colors.red,
/// height: 100,
/// width: 100,
/// ),
/// Expanded(
/// child: Container(
/// color: Colors.blue,
/// width: 100,
/// ),
/// ),
/// Container(
/// color: Colors.red,
/// height: 100,
/// width: 100,
/// ),
/// ],
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// {@tool snippet --template=stateless_widget_material}
/// 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
/// Widget build(BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// title: Text('Expanded Row Sample'),
/// ),
/// body: Center(
/// child: Row(
/// children: <Widget>[
/// Expanded(
/// flex: 2,
/// child: Container(
/// color: Colors.red,
/// height: 100,
/// ),
/// ),
/// Container(
/// color: Colors.blue,
/// height: 100,
/// width: 50,
/// ),
/// Expanded(
/// flex: 1,
/// child: Container(
/// color: Colors.red,
/// height: 100,
/// ),
/// ),
/// ],
/// ),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [Flexible], which does not force the child to fill the available space.
Expand Down