Skip to content

Instantly share code, notes, and snippets.

@nilsreichardt
Created July 20, 2022 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilsreichardt/a5c3530710317e7d03412fef288c18f1 to your computer and use it in GitHub Desktop.
Save nilsreichardt/a5c3530710317e7d03412fef288c18f1 to your computer and use it in GitHub Desktop.
Display all primary Flutter colours. Run it with Zapp: https://zapp.run/edit/flutter-zu0066yu106
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(MaterialApp(
darkTheme: ThemeData.dark(),
theme: ThemeData.light(),
home: Scaffold(
appBar: AppBar(title: const Text('Colors')),
body: ListView.builder(
itemCount: Colors.primaries.length,
itemBuilder: (context, index) {
final color = Colors.primaries[index];
return ColoredBox(
color: Colors.primaries[index],
child: ListTile(
title: Text(
'${color}; ${color.value}',
),
onTap: () {
Clipboard.setData(ClipboardData(text: '${color.value}'));
print('Copied value "${color.value}" to clipboard');
},
),
);
},
),
),
debugShowCheckedModeBanner: false,
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment