flutter_system_events 0.5.0 copy "flutter_system_events: ^0.5.0" to clipboard
flutter_system_events: ^0.5.0 copied to clipboard

A Flutter plugin for listening to keyboard, lifecycle, network, memory, battery, and orientation events on Android and iOS.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'pages/battery_event_page.dart';
import 'pages/keyboard_event_page.dart';
import 'pages/lifecycle_event_page.dart';
import 'pages/memory_event_page.dart';
import 'pages/network_event_page.dart';
import 'pages/orientation_event_page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: EventListPage());
  }
}

class EventListPage extends StatelessWidget {
  const EventListPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('System Events')),
      body: ListView(
        children: [
          ListTile(
            title: const Text('Keyboard'),
            subtitle: const Text('Show, hide, height'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const KeyboardEventPage(),
                ),
              );
            },
          ),
          ListTile(
            title: const Text('Lifecycle'),
            subtitle: const Text('Resume, inactive, pause, detach'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const LifecycleEventPage(),
                ),
              );
            },
          ),
          ListTile(
            title: const Text('Network'),
            subtitle: const Text('Online, offline, type'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const NetworkEventPage(),
                ),
              );
            },
          ),
          ListTile(
            title: const Text('Memory'),
            subtitle: const Text('Warning, low memory, trim'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const MemoryEventPage(),
                ),
              );
            },
          ),
          ListTile(
            title: const Text('Battery'),
            subtitle: const Text('Level, charging, state'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const BatteryEventPage(),
                ),
              );
            },
          ),
          ListTile(
            title: const Text('Orientation'),
            subtitle: const Text('Portrait, landscape, direction'),
            trailing: const Icon(Icons.chevron_right),
            onTap: () {
              Navigator.of(context).push(
                MaterialPageRoute<void>(
                  builder: (_) => const OrientationEventPage(),
                ),
              );
            },
          ),
        ],
      ),
    );
  }
}
1
likes
0
points
630
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for listening to keyboard, lifecycle, network, memory, battery, and orientation events on Android and iOS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on flutter_system_events

Packages that implement flutter_system_events