wantsMobileToolbarToBeVisible static method
Returns true
if SuperEditor's policy believes that a mobile toolbar should
be visible right now, or false
otherwise.
This inspection is different from isMobileToolbarVisible in a couple ways:
- On mobile web, SuperEditor defers to the browser's built-in overlay
controls. Therefore, wantsMobileToolbarToBeVisible is
true
but isMobileToolbarVisible isfalse
. - When an app customizes the toolbar, SuperEditor might want to build
and display a toolbar, but the app overrode the toolbar widget and chose
to build empty space instead of a toolbar. In this case
wantsMobileToolbarToBeVisible is
true
, but isMobileToolbarVisible isfalse
.
Implementation
static bool wantsMobileToolbarToBeVisible([Finder? superEditorFinder]) {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
final toolbarManager = find.state<SuperEditorAndroidControlsOverlayManagerState>(superEditorFinder);
if (toolbarManager == null) {
throw Exception(
"Tried to verify that SuperEditor wants mobile toolbar to be visible on Android, but couldn't find the toolbar manager widget.");
}
return toolbarManager.wantsToDisplayToolbar;
case TargetPlatform.iOS:
final toolbarManager = find.state<SuperEditorIosToolbarOverlayManagerState>(superEditorFinder);
if (toolbarManager == null) {
throw Exception(
"Tried to verify that SuperEditor wants mobile toolbar to be visible on iOS, but couldn't find the toolbar manager widget.");
}
return toolbarManager.wantsToDisplayToolbar;
case TargetPlatform.macOS:
case TargetPlatform.windows:
case TargetPlatform.linux:
case TargetPlatform.fuchsia:
return false;
}
}