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: DecoratedBox( // here is where I added my DecoratedBox decoration: BoxDecoration(color: Colors.lightBlueAccent), child: Text('Rocky'), ), ), ), ); } }
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: DecoratedBox( decoration: BoxDecoration(color: Colors.lightBlueAccent), child: Padding( padding: const EdgeInsets.all(8.0) child: Text('Rocky'), ), ), ), ), ); }
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: [ DecoratedBox( decoration: BoxDecoration(color: Colors.lightBlueAccent), child: Padding( padding: const EdgeInsets.all(8.0), child: Text('Rocky'), ), ), DecoratedBox( decoration: BoxDecoration(color: Colors.lightBlueAccent), child: Padding( padding: const EdgeInsets.all(8.0), child: Text('Spot'), ), ), DecoratedBox( decoration: BoxDecoration(color: Colors.lightBlueAccent), child: Padding( padding: const EdgeInsets.all(8.0), child: Text('Fido'), ), ), ], ), ), ), ); } }
class DogName extends StatelessWidget { @override Widget build(BuildContext context) { } }
class DogName extends StatelessWidget { final String name; @override Widget build(BuildContext context) { } }
class DogName extends StatelessWidget { final String name; const DogName(this.name); @override Widget build(BuildContext context) { } }
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), ), ); } }
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'), ], ), ), ), ); } }