The Finished Layout

If you have done everything correctly, you probably have ended up with the following code in main.dart:

 import​ ​"package:flutter/material.dart"​;
 
 
 class​ ExpandedButton ​extends​ StatelessWidget {
 
  ExpandedButton({​this​.onPressed, ​this​.child, ​this​.color});
 
 final​ Widget child;
 final​ VoidCallback onPressed;
 final​ Color color;
 
  @override
  Widget build(BuildContext context) =>
  Expanded(
  flex:1,
  child: FlatButton(
  onPressed: onPressed,
  child: child,
  color: color,
  ),
  );
 }
 
 class​ ExpandedRow ​extends​ StatelessWidget {
 
  ExpandedRow({​this​.children, ​this​.crossAxisAlignment});
 
 final​ List<Widget> children;
 final​ CrossAxisAlignment ...

Get Programming Flutter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.