Last active
February 28, 2018 04:15
-
-
Save anders-sandholm/b2153cdf4a541adc40c4dc50b5b6e227 to your computer and use it in GitHub Desktop.
Clean Dart 2 Widgets
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
// 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