From e9b183d47dd62c6812f6969de6c5e987ea751032 Mon Sep 17 00:00:00 2001 From: Suryanshu Singh Date: Sun, 1 Nov 2020 20:18:04 +0530 Subject: [PATCH] AdoptAWidget: FittedBox (#69503) --- packages/flutter/lib/src/widgets/basic.dart | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index ddbe279438..092fabb010 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -1474,6 +1474,27 @@ class CompositedTransformFollower extends SingleChildRenderObjectWidget { /// /// {@youtube 560 315 https://www.youtube.com/watch?v=T4Uehk3_wlY} /// +/// {@tool sample --template=stateless_widget_scaffold_center} +/// +/// In this example, the image is stretched to fill the entire [Container], which would +/// not happen normally without using FittedBox. +/// +/// ```dart +/// Widget build(BuildContext) { +/// return Container( +/// height: 400, +/// width: 300, +/// color: Colors.red, +/// child: FittedBox( +/// child: Image.network('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'), +/// fit: BoxFit.fill, +/// ), +/// ); +/// } +/// ``` +/// +/// {@end-tool} +/// /// See also: /// /// * [Transform], which applies an arbitrary transform to its child widget at