【问题标题】:How to implement FakeLauncher for Setting Launcher Programatically on Flutter?如何在 Flutter 中实现 Fake Launcher 以编程方式设置 Launcher?
【发布时间】:2020-11-29 20:10:29
【问题描述】:

我正在 Flutter 中创建一个 Android 启动器。每当用户打开应用程序时,我都需要显示启动器选择屏幕。我在这里找到了答案,但它适用于原生 Android 开发。如何将其与 Flutter 集成?

How to set default app launcher programmatically?

我已尝试创建新活动,但不确定在哪里调用该函数。

【问题讨论】:

    标签: android flutter launcher


    【解决方案1】:

    flutter的初始路由处设置一个页面。您可以在 MaterialAppmain.dart 文件中使用 initialRoute。然后在您的routes 中指定您的页面。阅读Defining the routes

    MaterialApp(
      // Start the app with the "/" named route. In this case, the app starts
      // on the FirstScreen widget.
      initialRoute: '/',
      routes: {
        // When navigating to the "/" route, build the FirstScreen widget.
        '/': (context) => FakeLauncher()
      },
    );
    

    【讨论】:

      猜你喜欢
      • 2015-06-13
      • 2016-09-06
      • 2014-11-16
      • 2018-12-24
      • 2021-07-20
      • 1970-01-01
      • 2022-11-30
      • 2019-05-26
      • 2021-03-06
      相关资源
      最近更新 更多