lecle_screen_manager 0.0.1+2 copy "lecle_screen_manager: ^0.0.1+2" to clipboard
lecle_screen_manager: ^0.0.1+2 copied to clipboard

outdated

A Flutter plugin to manage the device's screen on Android and iOS.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:lecle_screen_manager/lecle_screen_manager.dart';

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _isKeptOn = false;
  double _brightness = 1.0;

  @override
  initState() {
    super.initState();
    initPlatformState();
  }

  initPlatformState() async {
    bool keptOn = await LecleScreenManager.isKeptOn;
    double brightness = await LecleScreenManager.brightness;
    setState(() {
      _isKeptOn = keptOn;
      _brightness = brightness;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar:
            AppBar(title: const Text('Lecle Screen Manager plugin example')),
        body: Center(
          child: Column(
            children: <Widget>[
              Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  const Text("Screen is kept on?"),
                  Checkbox(
                      value: _isKeptOn,
                      onChanged: (b) async {
                        if (b != null) {
                          setState(() {
                            _isKeptOn = b;
                          });

                          await LecleScreenManager.keepOn(b);
                        }
                      })
                ],
              ),
              const Text("Brightness:"),
              Slider(
                value: _brightness,
                onChanged: (b) async {
                  setState(() {
                    _brightness = b;
                  });
                  await LecleScreenManager.setBrightness(b);
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}
4
likes
0
pub points
30%
popularity

Publisher

verified publisherlecle.vn

A Flutter plugin to manage the device's screen on Android and iOS.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on lecle_screen_manager