Skip to main content

foldable_device 1.0.0 copy "foldable_device: ^1.0.0" to clipboard
foldable_device: ^1.0.0 copied to clipboard

Foldable posture, hinge angle, fold direction and reserved regions (fold, camera) for Android foldables and the iPhone Duo (iOS 27.1+).

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:foldable_device/foldable_device.dart';

import 'home_screen.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Hide the status bar, so only the camera is reported as an occlusion.
  await SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
  // Start listening to the native hinge events (Android foldables, iPhone Duo).
  FoldableHelper.initialize();
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    // FoldableScope above the whole app: any widget that calls
    // FoldableScope.watch(context) rebuilds on every fold/hinge change.
    return FoldableScope(
      child: const MaterialApp(
        home: HomeScreen(),
      ),
    );
  }
}
17
likes
0
points
1.22k
downloads

Publisher

unverified uploader

Weekly Downloads

Foldable posture, hinge angle, fold direction and reserved regions (fold, camera) for Android foldables and the iPhone Duo (iOS 27.1+).

Repository (GitHub)
View/report issues

Topics

#foldable #hinge #dual-screen #iphone #layout

License

unknown (license)

Dependencies

flutter

More

Packages that depend on foldable_device

Packages that implement foldable_device