Skip to content

Instantly share code, notes, and snippets.

@anders-sandholm
Last active February 28, 2018 04:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anders-sandholm/b2153cdf4a541adc40c4dc50b5b6e227 to your computer and use it in GitHub Desktop.
Save anders-sandholm/b2153cdf4a541adc40c4dc50b5b6e227 to your computer and use it in GitHub Desktop.
Clean Dart 2 Widgets
// Before Dart 2
Widget build(BuildContext context) {
return new Container(
height: 56.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(color: Colors.blue[500]),
child: new Row(
...
),
);
}
// After Dart 2
Widget build(BuildContext context) =>
Container(
height: 56.0,
padding: EdgeInsets.symmetric(horizontal: 8.0),
decoration: BoxDecoration(color: Colors.blue[500]),
child: Row(
...
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment