Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
patch Fullscreen API
  • Loading branch information
navaronbracke committed Feb 21, 2024
commit 29e212a866fe9a951ee130b34fc853e32e9c7c6e
27 changes: 24 additions & 3 deletions example/03-controls/control-replacement/page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:js_interop';

import 'package:google_maps/google_maps.dart' hide Event;
import 'package:web/web.dart';

Expand Down Expand Up @@ -66,12 +68,31 @@ void initFullscreenControl(GMap map) {
});
}

bool isFullscreen(Element element) => document.fullscreenElement == element;
bool isFullscreen(Element element) =>
_FullscreenDocument(document).fullscreenElement == element;

void requestFullscreen(Element element) {
element.requestFullscreen();
_FullscreenElement(element).requestFullscreen.callAsFunction();
}

void exitFullscreen() {
document.exitFullscreen();
_FullscreenDocument(document).exitFullscreen.callAsFunction();
}

/// This extension type merely exists because `package:web` no longer provides the Fullscreen API,
/// as Safari only supports it under a prefix.
///
/// This extension type can be removed when that restriction is lifted.
extension type _FullscreenDocument(Document _) {
external JSFunction get exitFullscreen;

external Element? get fullscreenElement;
}

/// This extension type merely exists because `package:web` no longer provides the Fullscreen API,
/// as Safari only supports it under a prefix.
///
/// This extension type can be removed when that restriction is lifted.
extension type _FullscreenElement(Element _) {
external JSFunction get requestFullscreen;
}
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: google_maps
version: 7.0.0
version: 7.1.0
description: >
With that package you will be able to use Google Maps JavaScript API from Dart
scripts.
homepage: https://github.com/a14n/dart-google-maps
environment:
sdk: '>=2.12.0 <4.0.0'
sdk: '>=3.3.0 <4.0.0'
dependencies:
js: ^0.6.3
js_wrapping: ^0.7.4
Expand Down