-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.dart
51 lines (47 loc) · 1.36 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import 'package:circle_color_picker_view/circle_color_picker_view.dart';
import 'package:flutter/material.dart';
void main() => runApp(ColorPickerApp());
class ColorPickerApp extends StatefulWidget {
@override
_ColorPickerAppState createState() => _ColorPickerAppState();
}
class _ColorPickerAppState extends State<ColorPickerApp> {
Color currentColor = Color(0xffffd600);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "ColorPicker",
home: Scaffold(
appBar: AppBar(
title: Text("ColorPicker"),
),
body: Align(
alignment: Alignment.topCenter,
child: Column(
children: [
ColorPickerView(
initialColor: currentColor,
colorListener: (color) {
setState(() {
currentColor = color;
});
}),
const Padding(
padding: EdgeInsets.only(top: 20),
),
Container(
width: 150,
height: 50,
color: currentColor,
alignment: Alignment.center,
child: Text(
currentColor.value.toRadixString(16).toUpperCase(),
),
),
],
),
),
),
);
}
}