1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | import 'package:flutter/material.dart'; |
6 | |
7 | /// Flutter code sample for [Expanded]. |
8 | |
9 | void main() => runApp(const ExpandedApp()); |
10 | |
11 | class ExpandedApp extends StatelessWidget { |
12 | const ExpandedApp({super.key}); |
13 | |
14 | @override |
15 | Widget build(BuildContext context) { |
16 | return MaterialApp( |
17 | home: Scaffold( |
18 | appBar: AppBar( |
19 | title: const Text('Expanded Column Sample'), |
20 | ), |
21 | body: const ExpandedExample(), |
22 | ), |
23 | ); |
24 | } |
25 | } |
26 | |
27 | class ExpandedExample extends StatelessWidget { |
28 | const ExpandedExample({super.key}); |
29 | |
30 | @override |
31 | Widget build(BuildContext context) { |
32 | return Center( |
33 | child: Column( |
34 | children: <Widget>[ |
35 | Container( |
36 | color: Colors.blue, |
37 | height: 100, |
38 | width: 100, |
39 | ), |
40 | Expanded( |
41 | child: Container( |
42 | color: Colors.amber, |
43 | width: 100, |
44 | ), |
45 | ), |
46 | Container( |
47 | color: Colors.blue, |
48 | height: 100, |
49 | width: 100, |
50 | ), |
51 | ], |
52 | ), |
53 | ); |
54 | } |
55 | } |
56 |