Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lbarqueira/067d209181142b86f2f0b835b9cba3de to your computer and use it in GitHub Desktop.
Save lbarqueira/067d209181142b86f2f0b835b9cba3de to your computer and use it in GitHub Desktop.
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