dual_screen 1.0.0+2 copy "dual_screen: ^1.0.0+2" to clipboard
dual_screen: ^1.0.0+2 copied to clipboard

outdated

Dual-screen and foldable support, like hinge angle sensor data.

example/lib/main.dart

/// Copyright (c) Microsoft Corporation.
/// Licensed under the MIT License.

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Hinge Angle Sensor'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              FutureBuilder<bool>(
                future: DualScreenInfo.hasHingeAngleSensor,
                builder: (context, hasHingeAngleSensor) {
                  return Text(
                      'Hinge angle sensor exists: ${hasHingeAngleSensor.data}');
                },
              ),
              StreamBuilder<double>(
                stream: DualScreenInfo.hingeAngleEvents,
                builder: (context, hingeAngle) {
                  return Text('Hinge angle is: ${hingeAngle.data?.toStringAsFixed(2)}');
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
141
likes
0
pub points
95%
popularity

Publisher

verified publishermicrosoft.com

Dual-screen and foldable support, like hinge angle sensor data.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on dual_screen