Last active
January 23, 2021 16:54
-
-
Save felipecastrosales/6bdbe66fbd351ea05c804fb3c5945be4 to your computer and use it in GitHub Desktop.
flexible_loose_tight.dart
This file contains 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
import 'package:flutter/material.dart'; | |
void main() => runApp(FlexibleExample03()); | |
class FlexibleExample03 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Flexible - Tight & Loose'), | |
centerTitle: true, | |
), | |
body: Column( | |
children: [ | |
Flexible( | |
flex: 3, | |
fit: FlexFit.tight, // loose | |
child: Container( | |
height: 250, | |
color: Colors.orange, | |
), | |
), | |
Flexible( | |
flex: 1, | |
child: WidgetPurple(), | |
), | |
Flexible( | |
flex: 1, | |
child: WidgetBlue(), | |
), | |
], | |
), | |
), | |
); | |
} | |
} | |
class WidgetPurple extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
color: Colors.purple, | |
); | |
} | |
} | |
class WidgetBlue extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
color: Colors.teal, | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment