Pick colors from your application anywhere easily and
- Pick color from your application screen
Add the dependency:
$ flutter pub add eye_dropper
Import the package:
import 'package:eye_dropper/eye_dropper.dart';
Wrap MaterialApp.builder
or WidgetsApp.builder
with EyeDropper
:
MaterialApp(
home: const MyHomePage(title: 'Flutter Color Picker Demo'),
builder: (context, child) => EyeDropper(child: child!),
),
Anywhere you want to use, call EyeDropper.enableEyeDropper()
method:
EyeDropper.enableEyeDropper(context, (color) {
// handle the action you want after getting the color
});
- Android and Ios
For testing in web, click here