In my Flutter app (Android and iOS only), I want to add a widget that will overlay the entire app.
Here is what my main class looks like:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: "/someroute"
onGenerateRoute: MyRouteManager.generateRoute
);
}
I tried to follow that example , but my problem is that I use named routes in my app, and I don't know how to overlay a widget above my entire app in that case.
I also tried the overlay_screen plugin , but it has some bugs and does not allow the user to interact with the screen below the overlay screen.
How can I achieve that?
Thanks.
try this out:
Navigator.pushNamed(context, '/name_of_your_second_page');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.