Created
February 16, 2021 19:43
-
-
Save lbarqueira/067d209181142b86f2f0b835b9cba3de to your computer and use it in GitHub Desktop.
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(new DogApp()); | |
} | |
class DogApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'My Dog App', | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Yellow Lab'), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
DogName('Rocky'), | |
SizedBox(height: 8.0), | |
DogName('Spot'), | |
SizedBox(height: 8.0), | |
DogName('Fido'), | |
], | |
), | |
), | |
), | |
); | |
} | |
} | |
class DogName extends StatelessWidget { | |
final String name; | |
const DogName(this.name); | |
@override | |
Widget build(BuildContext context) { | |
return DecoratedBox( | |
decoration: BoxDecoration(color: Colors.lightBlueAccent), | |
child: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Text(name), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment