Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement