Skip to content

Instantly share code, notes, and snippets.

@bwnyasse
Last active September 28, 2022 04:14
Show Gist options
  • Save bwnyasse/8fc5ea7843f87cf8c022b05250a3106b to your computer and use it in GitHub Desktop.
Save bwnyasse/8fc5ea7843f87cf8c022b05250a3106b to your computer and use it in GitHub Desktop.
/*
* 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 FittedBox'),
),
body: Center(
child: Container(
color: Colors.black26,
width: 200.0,
height: 200.0,
child: FittedBox(
fit: BoxFit.none,
child: Container(
color: Colors.teal,
width: 100.0,
height: 50.0,
child: const Center(
child: Text(
'Formation Dart & Flutter',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
),
),
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment