Rollback properties to stable version

Added comments with note of API change coming on 3.26+
jwill_m3_demo
James Williams 2 months ago
parent 49f2e3f3e3
commit 2332cd1d9d

@ -68,9 +68,12 @@ class _ColorBoxState extends State<ColorBox> {
// Copy color as hex to clipboard // Copy color as hex to clipboard
var hex = '#'; var hex = '#';
final c = widget.color; final c = widget.color;
hex += (c.r * 255.0).round().toRadixString(16).padLeft(2, '0'); // Will change from int 0-255 to double 0.0-1.0 in 3.26+
hex += (c.g * 255.0).round().toRadixString(16).padLeft(2, '0'); // The properties also change from red/green/blue to r/g/b
hex += (c.b * 255.0).round().toRadixString(16).padLeft(2, '0'); // hex += (c.[r g b] * 255.0).round().toRadixString(16).padLeft(2, '0');
hex += c.red.toRadixString(16).padLeft(2, '0');
hex += c.green.toRadixString(16).padLeft(2, '0');
hex += c.blue.toRadixString(16).padLeft(2, '0');
final data = ClipboardData(text: hex); final data = ClipboardData(text: hex);
await Clipboard.setData(data); await Clipboard.setData(data);
messenger.hideCurrentSnackBar(); messenger.hideCurrentSnackBar();

Loading…
Cancel
Save