how to make this selector in the image with flutter

130 Views Asked by At

selector image

this selector should change the brightness, so what widget in Flutter should I use and how to change the brightness??

2

There are 2 best solutions below

0
Priyansu Choudhury On

Make sure you add the following permissions to your Android Manifest

<uses-permission android:name="android.permission.WAKE_LOCK" />

Use this plugin, add screen as a dependency in your pubspec.yaml file.

// Import package
import 'package:screen/screen.dart';

// Get the current brightness:
double brightness = await Screen.brightness;

// Set the brightness:
Screen.setBrightness(0.5);

// Check if the screen is kept on:
bool isKeptOn = await Screen.isKeptOn;

// Prevent screen from going into sleep mode:
Screen.keepOn(true);

Find an example here on how to implement this plugin.

0
Jim On

this package, sleek_circular_slider is similar to your need:

final slider = SleekCircularSlider(
                      appearance: CircularSliderAppearance(),
                      onChange: (double value) {
                        //Change your brightness value
                      });