Created
July 20, 2022 12:38
-
-
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
This file contains hidden or 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/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