chooseColor function

void chooseColor({
  1. required BuildContext context,
  2. required Size size,
  3. required dynamic selectedColor(
    1. Color
    ),
})

Implementation

void chooseColor({
  required BuildContext context,
  required Size size,
  required Function(Color) selectedColor,
}) {
  showDialog(
    context: context,
    builder: (ctx) {
      return AlertDialog(
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
        title: const Text("Choose Color"),
        content: SizedBox(
          height: size.height * 0.3,
          width: size.width * 0.2,
          child: ColorPickerPalette(
            onSelectColor: (Color value) {
              selectedColor(value);
              Navigator.pop(context);
            },
          ),
        ),
      );
    },
  );
}