Advertisement
Guest User

Untitled

a guest
May 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/widgets.dart';
  3.  
  4. const kSwatchSize = 36.0;
  5.  
  6. void main() {
  7. runApp(new MaterialApp(
  8. home: new Scaffold(
  9. body: new Stack(children: [new Positioned(left:200.0,top:200.0,
  10. child: new SizedBox(width: 600.0,height: 300.0,
  11. child: new GridView.count(
  12. crossAxisCount: 6,
  13. children: _getColorMenuTileItems(),
  14. )),
  15. ), ]),
  16. )));
  17. }
  18.  
  19. List<PopupMenuItem<Color>> _getColorMenuTileItems() {
  20. final colors = Colors.primaries.map((c) => c).toList();
  21. colors.addAll([Colors.black, Colors.grey, Colors.white]);
  22. return colors.map((c) {
  23. return new PopupMenuItem<Color>(
  24. value: c,
  25. child: new GridTile(
  26. child: new Container(
  27. width: kSwatchSize,
  28. height: kSwatchSize,
  29. color: c,
  30. ) ),
  31. );
  32. }).toList();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement