desktop_screenstate 0.0.1
desktop_screenstate: ^0.0.1 copied to clipboard
Flutter package to detect desktop screen is on or off.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:screenstate/screenstate.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final String _platformVersion = 'Unknown';
final _screenstatePlugin = ScreenState.instance;
@override
void initState() {
super.initState();
}
// Platform messages are asynchronous, so we initialize in an async method.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: ValueListenableBuilder<bool>(
valueListenable: _screenstatePlugin.isActive,
builder: (context, value, child) => Center(
child: Text('Screen state on: $value'),
),
),
),
);
}
}