ios_orientation 0.0.7 copy "ios_orientation: ^0.0.7" to clipboard
ios_orientation: ^0.0.7 copied to clipboard

PlatformiOS

Support iOS16 screen rotation.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:ios_orientation/ios_orientation.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 _iosOrientationPlugin = IosOrientation();

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: TextButton(
            onPressed: () {
              _iosOrientationPlugin.setOrientation(OrientationIOS.landscapeLeft);
            },
            child: const Text('切换到横屏'),
          ),
        ),
      ),
    );
  }
}