Last active
September 28, 2022 04:13
-
-
Save bwnyasse/b0e33896663804c826623c383adad39a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Dart & Flutter - Training | |
| * | |
| * Copyright (c) Boris-Wilfried Nyasse | |
| * All rights reserved | |
| */ | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Formation Dart & Flutter', | |
| theme: ThemeData( | |
| primarySwatch: Colors.blue, | |
| ), | |
| home: MyHomePage(), | |
| ); | |
| } | |
| } | |
| class MyHomePage extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar( | |
| title: const Text('Comprendre le LimitedBox'), | |
| ), | |
| body: Center( | |
| child: UnconstrainedBox( | |
| /*Here you won’t get an error anymore, | |
| * because when the LimitedBox is given | |
| * an infinite size by the | |
| * UnconstrainedBox; it passes a maximum | |
| * width of 100 down to its child. | |
| */ | |
| child: LimitedBox( | |
| maxWidth: 100, | |
| child: Container( | |
| color: Colors.red, | |
| width: double.infinity, | |
| height: 100, | |
| ), | |
| ), | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment