orientation_screen 0.0.3+1 copy "orientation_screen: ^0.0.3+1" to clipboard
orientation_screen: ^0.0.3+1 copied to clipboard

discontinued

A new Flutter package.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Orientation Screen Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OrientationScreen(
      orientationMode: ScreenOrientationMode.portraitOnly,
      child: Scaffold(
        appBar: AppBar(
          title: Text(' Orientation Screen Demo Home Page'),
        ),
        body: Container(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text('This screen is only portrait mode'),
                RaisedButton(
                  child: Text('Next Screen'),
                  onPressed: () {
                    Navigator.of(context).push(MaterialPageRoute(
                        builder: (context) => MySecondPage()));
                  },
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

//secondPage
class MySecondPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OrientationScreen(
      child: Scaffold(
        appBar: AppBar(
          title: Text('Orientation Screen Demo Home Page'),
        ),
        body: Container(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Text('This screen is auto rotation mode'),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
0
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter package.

Homepage

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on orientation_screen