jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.35k stars 1.63k forks source link

Can't use Get.bottomSheet inside GetCupertinoApp #2337

Open pzehle opened 2 years ago

pzehle commented 2 years ago

Describe the bug When using GetCupertinoApp as the main design for the app, almost every functionality from GetX works. When trying to use Get.bottomSheet, it shows the below pasted error.

Reproduction code

example:

void main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // Return app
    return GetCupertinoApp(
      title: 'App',
      debugShowCheckedModeBanner: false,
      initialRoute: '/',
      getPages: <GetPage>[
        GetPage(
          name: '/home',
          page: () => CupertinoPageScaffold(
            child: Center(
              child: GestureDetector(
                onTap: () {
                  Get.bottomSheet(Center(child: Text('Hello!')));
                },
                child: Text('Click me!'),
              ),
            ),
          ),
        ),
      ],
    );
  }
}

Error

FlutterError (No MaterialLocalizations found.
Navigator widgets require MaterialLocalizations to be provided by a Localizations widget ancestor.
The material library uses Localizations to generate messages, labels, and abbreviations.
To introduce a MaterialLocalizations, either use a MaterialApp at the root of your application to include them automatically, or add a Localization widget with a MaterialLocalizations delegate.
The specific widget that could not find a MaterialLocalizations ancestor was:
  Navigator-[LabeledGlobalKey<NavigatorState>#55a27 Key Created by default]
The ancestors of this widget were:
  Directionality
  Builder
  DefaultTextStyle
  Title
  Directionality
  _LocalizationsScope-[GlobalKey#c6131]
  Semantics
  Localizations
  MediaQuery
  _MediaQueryFromWindow
  _FocusMarker
  Focus
  _FocusTraversalGroupMarker
  FocusTraversalGroup
  _ActionsMarker
  Actions
  _ShortcutsMarker
  Semantics
  _FocusMarker
  Focus
  DefaultTextEditingShortcuts
  _ShortcutsMarker
  Semantics
  _FocusMarker
  Focus
  Shortcuts
  _SharedAppModel
  SharedAppData
  UnmanagedRestorationScope
  RestorationScope
  UnmanagedRestorationScope
  RootRestorationScope
  WidgetsApp-[GlobalObjectKey _CupertinoAppState#069c4]
  Builder
  HeroControllerScope
  IconTheme
  _InheritedCupertinoTheme
  CupertinoTheme
  CupertinoUserInterfaceLevel
  ScrollConfiguration
  CupertinoApp
  GetBuilder<GetMaterialController>
  GetCupertinoApp
  MyApp
  [root])

To Reproduce Steps to reproduce the behavior:

  1. Create an empty app.
  2. Use GetCupertinoApp.
  3. Try to open a bottom sheet anywhere in the app.

Expected behavior To show a bottom sheet. If I change to GetMaterialApp, Get.bottomSheet works as expected.

Flutter Version: 4.10.3

Getx Version: Latest (4.6.1)

Describe on which device you found the bug: iPhone 13 - iOS 15 (simulator)

Minimal reproduce code Pasted above.

GordonHuangYong commented 1 year ago

solved?

pzehle commented 1 year ago

solved?

No :( - Completely ignored I guess...

Almagestum469 commented 4 months ago

this issue still exists