如何在Flutter中删除第二个应用栏?

问题描述 投票:0回答:1

我开发了一个flutter软件包,它具有自己的本地化和主题,因此我在软件包中使用了MaterialApp小部件。

return MaterialApp(
  key: Key('key_root_widget'),
  debugShowCheckedModeBanner: false,
  theme: ChatController.chatConfig.themeData,
  locale: ChatController.chatConfig.locale,
  routes: Routes.routes,
  supportedLocales: [
    Locale('en', 'US'),
    Locale('es', 'ES'),
    Locale('da', 'DK'),
  ],
  localizationsDelegates: [
    // A class which loads the translations from JSON files
    AppLocalizations.delegate,
    // Built-in localization of basic text for Material widgets
    GlobalMaterialLocalizations.delegate,
    // Built-in localization for text direction LTR/RTL
    GlobalWidgetsLocalizations.delegate,
    // Built-in localization of basic text for Cupertino widgets
    GlobalCupertinoLocalizations.delegate,
  ],
  // Returns a locale which will be used by the app
  localeResolutionCallback: (locale, supportedLocales) {
    // Check if the current device locale is supported
    for (var supportedLocale in supportedLocales) {
      if (supportedLocale.languageCode == locale.languageCode) {
        return supportedLocale;
      }
    }
    // If the locale of the device is not supported, use the first one
    // from the list (English, in this case).
    return supportedLocales.first;
  },
  home: Scaffold(
    appBar: AppBar(title: Text('Flutter Package'),),
    body: Material(
      child: FutureBuilder(
        future: widget.controller.init(),
        builder: (BuildContext context, AsyncSnapshot snapshot) {
          if (snapshot.connectionState == ConnectionState.done) {
            if (_chatStore.navigateToChatRoom) _navigateToChatRoom();
            return _buildBody();
          } else {
            return CustomProgressIndicatorWidget();
          }
        },
      ),
    ),
  ),
);

我想删除项目的应用程序栏,而只想使用包应用程序栏,但是很遗憾,我无法做到这一点。需要帮助:)

Screenshot

flutter appbar flutter-packages
1个回答
0
投票

只需从代码中删除行,

appBar: AppBar(title: Text('Flutter Package'),),
© www.soinside.com 2019 - 2024. All rights reserved.