awareframework_screen 0.1.0 copy "awareframework_screen: ^0.1.0" to clipboard
awareframework_screen: ^0.1.0 copied to clipboard

PlatformAndroidiOS
outdated

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:awareframework_screen/awareframework_screen.dart';

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

class MyApp extends StatefulWidget {
  late ScreenSensor sensor;
  late ScreenSensorConfig config;

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();

    widget.config = ScreenSensorConfig();
    widget.config.debug = true;
    widget.sensor = new ScreenSensor.init(widget.config);
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin Example App'),
        ),
        body: Column(
          children: [
            TextButton(
                onPressed: () {
                  print("start");
                  widget.sensor.stop();
                  widget.sensor.start();
                  widget.sensor.onScreenLocked.listen((event) {
                    print("lock");
                  });
                },
                child: Text("Start")),
            TextButton(
                onPressed: () {
                  print("stop");
                  widget.sensor.stop();
                },
                child: Text("Stop")),
            TextButton(
                onPressed: () {
                  print("sync");
                  widget.sensor.sync();
                },
                child: Text("Sync")),
          ],
        ),
      ),
    );
  }
}
0
likes
110
points
49
downloads

Publisher

unverified uploader

Weekly Downloads

A new flutter plugin project.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

awareframework_core, flutter

More

Packages that depend on awareframework_screen