How To Disable Drawing On Roll20
This commodity shows you how to disable the mural mode in Flutter.
The Steps
1. Import the services library to your main.dart file: Advertisements
import 'packet:flutter/services.sprint'; Note that the services library comes along with Palpitate and you lot Exercise NOT demand to install any 3rd-political party plugin. Advertisements
2. Add the code snippet below to the main() function in your main.sprint file:
void main() { // add these lines WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); // run app runApp(MyApp()); } 3. Restart your app (not using hot reload) and check the results past rotating the Android and iOS simulators.
A Complete Instance
Preview:
The total lawmaking:
import 'package:flutter/textile.dart'; import 'package:flutter/services.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setPreferredOrientations( [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({Central? key}) : super(cardinal: primal); @override Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: faux, title: 'Kindacode.com', home: HomePage(), ); } } class HomePage extends StatelessWidget { const HomePage({Key? key}) : super(key: primal); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Kindacode.com'), ), body: const Center( child: Text( 'Hello', style: TextStyle(fontSize: 100), ), ), ); } } If you want to display different content based on device orientation instead of disabling the mural fashion, read also this article: Flutter – Evidence dissimilar content based on device orientation.
If you lot would like to learn more than about Flutter, take a wait at the following: Palpitate SliverList, Flutter Transform examples – Making fancy effects, Flutter: Scrolling to the desired item in a ListView, Flutter Cupertino Button – Tutorial and Examples or cheque out our Flutter category page and Sprint category page for the latest tutorials and examples.
Source: https://www.kindacode.com/article/how-to-disable-landscape-mode-in-flutter/
Posted by: cainwhiseve.blogspot.com

0 Response to "How To Disable Drawing On Roll20"
Post a Comment