본문 바로가기
mobile/flutter

[Flutter/iOS] No CupertionLocalizations found.

by moonsiri 2021. 11. 15.
728x90
반응형

안드로이드 기기에서는 문제가 없었는데, iOS기기에서 Text 필드 더블클릭시 오류가 발생했습니다.

════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building _CupertinoTextSelectionControlsToolbar(dirty, dependencies: [_LocalizationsScope-[GlobalKey#36cb4], MediaQuery], state: _CupertinoTextSelectionControlsToolbarState#d89a6):
No CupertinoLocalizations found.

_CupertinoTextSelectionControlsToolbar widgets require CupertinoLocalizations to be provided by a Localizations widget ancestor.
The cupertino library uses Localizations to generate messages, labels, and abbreviations.

To introduce a CupertinoLocalizations, either use a CupertinoApp at the root of your application to include them automatically, or add a Localization widget with a CupertinoLocalizations delegate.

The specific widget that could not find a CupertinoLocalizations ancestor was: _CupertinoTextSelectionControlsToolbar
  dirty
  dependencies: [_LocalizationsScope-[GlobalKey#36cb4], MediaQuery]
  state: _CupertinoTextSelectionControlsToolbarState#d89a6
The ancestors of this widget were: 
  : MaterialApp
    state: _MaterialAppState#942d4
    ...

 

 

Meterial App의 localizationDelegates에서 GlobalCupertinoLocalizations.delegate를 추가하여 해결하였습니다.

      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate, // 추가
        GlobalWidgetsLocalizations.delegate,
      ]

 

 

 

[Reference]

https://github.com/flutter/flutter/issues/13452

https://github.com/flutter/flutter/issues/23047

728x90
반응형

댓글