Unverified Commit 9b01d8a5 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Expanded Snippet for API Docs (#28681)

* Added code snippet for Expanded class. ref:#21136

* Changed the code samples into snippet application samples.
parent 83614757
...@@ -4263,6 +4263,83 @@ class Flexible extends ParentDataWidget<Flex> { ...@@ -4263,6 +4263,83 @@ class Flexible extends ParentDataWidget<Flex> {
/// [Flex] must contain only [StatelessWidget]s or [StatefulWidget]s (not other /// [Flex] must contain only [StatelessWidget]s or [StatefulWidget]s (not other
/// kinds of widgets, like [RenderObjectWidget]s). /// 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: /// See also:
/// ///
/// * [Flexible], which does not force the child to fill the available space. /// * [Flexible], which does not force the child to fill the available space.
......
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