Answers for "set orientation to landscape flutter"

3

flutter set orientation

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

void main() {
  // We need to call it manually,
  // because we going to call setPreferredOrientations()
  // before the runApp() call
  WidgetsFlutterBinding.ensureInitialized();
  
  // Than we setup preferred orientations,
  // and only after it finished we run our app
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
      .then((value) => runApp(MyApp()));
}
Posted by: Guest on March-25-2021
0

set orientation to landscape flutter

SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft,DeviceOrientation.landscapeRight])
Posted by: Guest on June-15-2021

Code answers related to "set orientation to landscape flutter"

Browse Popular Code Answers by Language