53 lines
1.4 KiB
Dart
53 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
|
import 'package:manager_app/Components/rounded_button.dart';
|
|
|
|
showColorPicker (Color currentColor, Function onSelect, BuildContext context) {
|
|
|
|
Color pickerColor = currentColor;
|
|
|
|
void changeColor(Color color) {
|
|
pickerColor = color;
|
|
}
|
|
|
|
showDialog(
|
|
builder: (BuildContext context) => AlertDialog(
|
|
content: SingleChildScrollView(
|
|
child: ColorPicker(
|
|
pickerColor: currentColor,
|
|
onColorChanged: changeColor,
|
|
colorPickerWidth: 300.0,
|
|
pickerAreaHeightPercent: 0.7,
|
|
enableAlpha: true,
|
|
displayThumbColor: true,
|
|
showLabel: true,
|
|
paletteType: PaletteType.hsv,
|
|
pickerAreaBorderRadius: const BorderRadius
|
|
.only(
|
|
topLeft: const Radius.circular(2.0),
|
|
topRight: const Radius.circular(2.0),
|
|
),
|
|
),
|
|
),
|
|
actions: <Widget>[
|
|
Container(
|
|
width: 180,
|
|
height: 70,
|
|
child: RoundedButton(
|
|
text: "Valider",
|
|
icon: Icons.check,
|
|
color: Colors.lightGreen,
|
|
press: () {
|
|
onSelect(pickerColor);
|
|
Navigator.of(context).pop();
|
|
},
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
],
|
|
), context: context
|
|
);
|
|
}
|
|
|
|
|