foldable_device 0.1.1
foldable_device: ^0.1.1 copied to clipboard
Foldable posture, hinge angle, fold direction and reserved regions (fold, camera) for Android foldables and the iPhone Duo (iOS 27.1+).
import 'package:flutter/material.dart';
import 'package:foldable_device/foldable_device.dart';
import 'home_screen.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
// 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(),
),
);
}
}