Last active
May 28, 2017 22:05
-
-
Save rxlabz/5bd7ea97dc86184f5f1266a3368b672c to your computer and use it in GitHub Desktop.
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
import 'package:flutter/material.dart'; | |
import 'package:flutter/widgets.dart'; | |
const kSwatchSize = 36.0; | |
void main() { | |
runApp(new MaterialApp( | |
home: new Scaffold( | |
body: new Stack(children: [ | |
new Positioned( | |
left: 200.0, | |
top: 200.0, | |
child: new SizedBox( | |
width: 600.0, | |
height: 300.0, | |
child: new GridView.count( | |
crossAxisCount: 6, | |
children: _getColorMenuTileItems(), | |
)), | |
), | |
]), | |
))); | |
} | |
List<PopupMenuItem<Color>> _getColorMenuTileItems() { | |
final colors = Colors.primaries.map((c) => c).toList(); | |
colors.addAll([Colors.black, Colors.grey, Colors.white]); | |
return colors.map((c) { | |
return new PopupMenuItem<Color>( | |
value: c, | |
child: new GridTile( | |
child: new Container( | |
width: kSwatchSize, | |
height: kSwatchSize, | |
color: c, | |
)), | |
); | |
}).toList(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment