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

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
150
points
0
downloads

Publisher

verified publisherlecle.vn

Weekly Downloads

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

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on lecle_screen_manager