Adaptive Screen Orientation
Flutter package to simplify Adaptive Screen Management for mobile, tablet, and desktop with screen breakpoints and orientation.
Run this command:
With Flutter:
$ flutter pub add adaptive_screen_orientation
This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get
):
dependencies:
adaptive_screen_orientation: ^1.0.2
Alternatively, your editor might support flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:adaptive_screen_orientation/adaptive_screen_orientation.dart';
import 'package:adaptive_screen_orientation/adaptive_screen_orientation.dart';
import 'package:example/src/screens/desktop.dart';
import 'package:example/src/screens/mobile_landscape.dart';
import 'package:example/src/screens/mobile_portrait.dart';
import 'package:example/src/screens/tablet_landscape.dart';
import 'package:example/src/screens/tablet_portrait.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
body: Column(
children: [
AdaptiveScreenOrientation(
useAvailableLayout: false,
mobilePortrait: MobilePortrait(),
mobileLandscape: MobileLandscape(),
tabletPortrait: TabletPortrait(),
tabletLandscape: TabletLandscape(),
desktop: Desktop(),
),
],
),
),
);
}
}
Download details:
Author: effmuhammad
Source: https://github.com/effmuhammad/adaptive_screen_orientation