How can I hide the topbar of an app in flutter? I want to restrict users from closing the app.
Asked
Active
Viewed 319 times
1
-
So, you don't want users to give the option to close the app? or is there any specific use-case you have in mind? – Rishabh Deep Singh Dec 17 '22 at 19:19
-
i do not want users to have the option to close the app – Orl13 Dec 17 '22 at 19:24
-
Does this answer your question? [How to Remove Title Bar from Flutter app built for windows?](https://stackoverflow.com/questions/68852107/how-to-remove-title-bar-from-flutter-app-built-for-windows) – mmcdon20 Dec 17 '22 at 19:24
-
I got inspired by that post, but the right answer is a bit different now. I will post my solution here – Orl13 Dec 17 '22 at 20:07
1 Answers
0
Solution:
Add to dependencies
window_manager: ^0.2.8
Import in main.dart
import 'package:window_manager/window_manager.dart';
Place the following code
runApp(App());
windowManager.waitUntilReadyToShow().then((_) async{
await windowManager.setTitleBarStyle(TitleBarStyle.hidden);
});

Orl13
- 339
- 4
- 15