A Flutter web application designed to test and demonstrate the Fullscreen API behavior in both browser and PWA (Progressive Web App) modes. This is a developer tool for testing fullscreen functionality in Flutter web applications.
- ✅ Fullscreen API Integration: Enter and exit fullscreen mode using the browser's Fullscreen API
- ✅ Real-time Status Display: Monitor fullscreen state, display mode, viewport size, and API support
- ✅ Display Mode Detection: Automatically detect whether running in browser, standalone PWA, or fullscreen PWA mode
- ✅ PWA Support: Installable as a Progressive Web App with fullscreen manifest configuration
- ✅ Color Cycling: Test fullscreen with 5 different background colors
- ✅ Automatic Text Contrast: Text color adjusts automatically for optimal readability
- ✅ Event-Driven Updates: Listens to fullscreen change events for real-time UI updates
- ✅ Viewport Tracking: Real-time display of viewport dimensions with resize detection
- ✅ Comprehensive Logging: Detailed console logs for debugging and testing
- ✅ Responsive Design: Works on desktop, tablet, and mobile browsers
The app running in a regular browser tab with fullscreen controls.
The app installed as a Progressive Web App with standalone window chrome.
The app in fullscreen mode with edge-to-edge content display.
lib/
├── constants/
│ ├── app_colors.dart # Color presets and contrast utilities
│ └── app_strings.dart # Centralized UI strings
├── screens/
│ └── fullscreen_tester_screen.dart # Main screen UI
├── utils/
│ └── fullscreen_api.dart # Fullscreen API wrapper
└── main.dart # App entry point
web/
├── index.html # HTML with PWA meta tags
├── manifest.json # PWA manifest with fullscreen config
└── icons/ # App icons
test/
└── widget_test.dart # Basic widget tests
The app uses package:web and dart:js_interop to access the browser's Fullscreen API:
enterFullscreen(): Requests fullscreen mode viadocument.documentElement.requestFullscreen()exitFullscreen(): Exits fullscreen viadocument.exitFullscreen()isFullscreen(): Checks if currently in fullscreen modeonFullscreenChange: Stream that emits fullscreen state changes
Detects the current display mode using media queries and browser APIs:
- Browser: Regular browser tab
- Standalone: PWA running in its own window
- Fullscreen: PWA running in fullscreen mode
- Minimal UI: PWA with minimal browser UI (rare)
The manifest.json is configured with:
{
"display": "fullscreen",
"start_url": "/",
"orientation": "any"
}This ensures the PWA opens in fullscreen mode when installed.
- Flutter SDK (3.9.2 or higher)
- A modern web browser (Chrome, Edge, Firefox, or Safari)
-
Clone the repository:
git clone <repository-url> cd fwftest
-
Install dependencies:
flutter pub get
Run the app in Chrome:
flutter run -d chromeOr run on a local web server:
flutter run -d web-serverThen open http://localhost:<port> in your browser.
Build the web app:
flutter build web --releaseThe built app will be in build/web/.
-
Serve the built app:
cd build/web python3 -m http.server 8000 -
Open in browser: Navigate to
http://localhost:8000 -
Install the PWA:
- Look for the install icon in the address bar
- Or go to browser menu → "Install Fwftest..."
-
Launch the installed app: The PWA should open in fullscreen mode automatically.
- Enter Fullscreen: Request fullscreen mode (requires Fullscreen API support)
- Exit Fullscreen: Exit fullscreen mode
- Previous Color: Cycle to the previous background color
- Next Color: Cycle to the next background color
- F11: Toggle fullscreen (browser native)
- Esc: Exit fullscreen
The app displays real-time information:
- Fullscreen: Whether currently in fullscreen mode (Yes/No)
- Display Mode: Current display mode (Browser/Standalone/Fullscreen/Minimal UI)
- Viewport: Current viewport dimensions (width × height)
- Fullscreen API: Whether the Fullscreen API is supported (Supported/Not Supported)
Cycle through 5 preset colors:
- Deep Blue (#2196F3)
- Vibrant Red (#F44336)
- Emerald Green (#4CAF50)
- Deep Purple (#9C27B0)
- Dark Gray (#424242)
See TESTING.md for comprehensive testing instructions covering:
- Browser mode testing
- PWA mode testing
- Display mode detection
- Fullscreen API behavior
- Cross-browser compatibility
- Console log verification
Run the widget tests:
flutter test| Browser | Fullscreen API | PWA Support | Display Mode Detection |
|---|---|---|---|
| Chrome | ✅ Full | ✅ Full | ✅ Full |
| Edge | ✅ Full | ✅ Full | ✅ Full |
| Firefox | ✅ Full | ✅ Full | |
| Safari (macOS) | ✅ Full | ✅ Full | |
| Safari (iOS) | ✅ Full | ✅ Full |
The project follows Flutter and Dart best practices:
- ✅ Clean separation of concerns (UI, business logic, utilities)
- ✅ Type-safe throughout with null safety
- ✅ Immutable data structures where appropriate
- ✅ Comprehensive documentation and comments
- ✅ Organized directory structure
- ✅ Centralized constants and strings
- ✅ Performance-conscious implementation
- ✅ Proper error handling and user feedback
- flutter: Flutter SDK
- web: ^1.1.0 - Lightweight browser API bindings for zero-overhead JS interop
- cupertino_icons: ^1.0.8 - iOS-style icons
- Pure Dart utilities: No Flutter dependencies in utility classes
- Stateful widgets: Proper lifecycle management with cleanup
- Event-driven: Uses streams for fullscreen change events
- Responsive: Adapts to different screen sizes
The app logs comprehensive diagnostic information to the console:
- Fullscreen API support detection
- Fullscreen state changes
- Display mode detection
- Viewport size changes
- Color changes
- User interactions
All logs are prefixed with [FullscreenAPI] or [FullscreenTester] for easy filtering.
If the Fullscreen API is not supported:
- The fullscreen buttons will be disabled
- An orange warning message will be displayed
- Try using a modern browser like Chrome or Edge
If the PWA installation doesn't work:
- Use Chrome or Edge for best PWA support
- Ensure you're serving over HTTPS (or localhost for testing)
- Check that manifest.json is properly configured
Some browsers have limited support for display mode detection. Check if the window has browser chrome (address bar, etc.) to determine if it's truly in standalone mode.
This is a developer tool/reference implementation. Feel free to:
- Report issues
- Suggest improvements
- Use as reference for your own projects
- Fork and modify for your needs
This project is provided as-is for educational and testing purposes.
- Flutter Web Documentation
- Fullscreen API MDN
- PWA Documentation
- package:web Documentation
- dart:js_interop Documentation
Created as a testing tool for Flutter web fullscreen functionality.
Note: This is a developer tool intended for testing and demonstration purposes. The comprehensive console logging is intentional and useful for debugging fullscreen behavior in Flutter web applications.