Progressive Enhancement theme for Magento 2 that combines Flutter Web for modern browsers with SEO-friendly HTML fallback for search engines and browsers without JavaScript support.
β¨ Now includes 3 Vishakha Devi design styles!
- Flutter Web for JavaScript-enabled browsers
- HTML Fallback for search engines and no-JS browsers
- Automatic detection and serving of appropriate version
- Search engine crawler detection (Google, Bing, Yandex, etc.)
- JavaScript support detection via cookies
- Configurable fallback modes
- Structured data (JSON-LD) for search engines
- Semantic HTML markup
- Fast server-side rendering for crawlers
- Complete product and category information
- Full integration with flutter_magento plugin
- CanvasKit or HTML renderer options
- Service Worker support for offline mode
- PWA capabilities
- Admin panel configuration
- Per-store settings
- Flexible detection rules
- Debug and testing modes
Three unique CSS variants for different aesthetics:
- Style A - Elegant & Feminine: Dusty rose, romantic, premium feel
- Style B - Modern Minimal: Monochrome, clean, professional
- Style C - Bold & Vibrant: Colorful, energetic, youth-oriented
See VISHAKHA_DEVI_STYLES.md for details.
composer require nativemind/module-flutter-theme
php bin/magento module:enable NativeMind_FlutterTheme
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush- Create directory
app/code/NativeMind/FlutterTheme - Copy all files to this directory
- Run installation commands:
php bin/magento module:enable NativeMind_FlutterTheme
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flushNavigate to: Stores β Configuration β NativeMind β Flutter Theme
- Enable Flutter Theme - Enable/disable the module
- Force Fallback Mode - Force HTML fallback for testing
- Detect Search Crawlers - Auto-detect and serve fallback to bots
- Detect JavaScript Support - Check browser JS support
- JS Cookie Name - Cookie name for JS detection (default:
js_enabled) - JS Cookie Lifetime - How long to remember JS support (default: 1 year)
- Use CanvasKit Renderer - Better performance, larger bundle size
- Enable Service Worker - Offline support and caching
- Preload Flutter Assets - Faster initialization
- Include Structured Data - Add JSON-LD for search engines
- Load Fallback CSS - Include CSS for fallback version
- Minimal HTML Mode - Lighter HTML for faster crawling
In your Flutter project (using flutter_magento):
cd your_flutter_project
flutter build web --web-renderer canvaskit --releaseCopy the contents of build/web/ to:
module-FlutterTheme/view/frontend/web/flutter/
Your structure should look like:
view/frontend/web/flutter/
βββ flutter.js
βββ main.dart.js
βββ flutter_service_worker.js
βββ canvaskit/
β βββ canvaskit.wasm
β βββ canvaskit.js
βββ assets/
βββ ...
In your Flutter app's main.dart:
import 'package:flutter/material.dart';
import 'package:flutter_magento/flutter_magento.dart';
import 'dart:js' as js;
void main() {
// Get Magento configuration from JavaScript
final config = _getMagentoConfig();
runApp(MagentoApp(config: config));
}
Map<String, dynamic> _getMagentoConfig() {
if (js.context.hasProperty('flutterConfiguration')) {
final jsConfig = js.context['flutterConfiguration'];
return {
'baseUrl': jsConfig['magento']['baseUrl'],
'storeCode': jsConfig['magento']['storeCode'],
'currency': jsConfig['magento']['currency'],
'locale': jsConfig['magento']['locale'],
};
}
// Fallback configuration
return {
'baseUrl': 'https://your-store.com',
'storeCode': 'default',
'currency': 'USD',
'locale': 'en_US',
};
}Force fallback mode in admin panel or add cookie:
document.cookie = "js_enabled=0; path=/";
location.reload();Use User-Agent switcher browser extension or curl:
curl -A "Googlebot" https://your-store.com/product-pageClear fallback cookie:
document.cookie = "js_enabled=1; path=/";
location.reload();βββββββββββββββ
β Request β
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββββββ
β User Agent & β
β Cookie Check β
ββββββββ¬βββββββββββ
β
ββββ Is Crawler? βββΊ Fallback HTML + SEO
β
ββββ No JS? βββΊ Fallback HTML + Message
β
ββββ Has JS βββΊ Flutter Web App
module-FlutterTheme/
βββ Block/
β βββ Root.php # Main block
β βββ Fallback/
β βββ Product.php # Product fallback
β βββ Category.php # Category fallback
βββ Helper/
β βββ DataInterface.php
β βββ Data.php # Detection logic
βββ etc/
β βββ module.xml
β βββ config.xml
β βββ di.xml
β βββ adminhtml/
β βββ system.xml # Admin config
βββ view/frontend/
β βββ layout/
β β βββ default.xml
β β βββ catalog_product_view.xml
β β βββ catalog_category_view.xml
β β βββ cms_index_index.xml
β βββ templates/
β β βββ root.phtml # Main template
β β βββ fallback/
β β βββ product.phtml
β β βββ category.phtml
β β βββ page.phtml
β βββ web/
β βββ css/
β β βββ fallback.css # Fallback styles
β βββ js/
β β βββ flutter-loader.js
β βββ flutter/ # Flutter Web build
β βββ (Place your build here)
βββ composer.json
βββ registration.php
βββ README.md
When a user visits the site:
-
Helper/Data.php checks:
- Is force fallback enabled?
- Is user agent a known crawler?
- Does browser have JS cookie set?
-
Based on detection, serves either:
- Flutter Web (full experience)
- HTML Fallback (SEO-friendly)
If JavaScript is detected:
<div id="flutter-app">
<div id="flutter-loading">Loading...</div>
</div>
<script src="flutter/flutter.js"></script>
<script src="js/flutter-loader.js"></script>flutter-loader.js initializes Flutter with Magento configuration.
For crawlers or no-JS browsers:
<div id="fallback-content">
<!-- Server-rendered HTML with structured data -->
<article itemscope itemtype="https://schema.org/Product">
...
</article>
</div>If JS is detected on a fallback page:
// Set cookie
document.cookie = "js_enabled=1; path=/; max-age=31536000";
// Reload to get Flutter version
window.location.reload();Override templates in your theme:
app/design/frontend/YourVendor/YourTheme/
βββ NativeMind_FlutterTheme/
βββ templates/
βββ fallback/
βββ product.phtml
Override or extend fallback.css in your theme.
Create a plugin for NativeMind\FlutterTheme\Helper\Data:
<?php
namespace YourVendor\YourModule\Plugin;
class CustomDetection
{
public function afterIsCrawler(
\NativeMind\FlutterTheme\Helper\Data $subject,
$result
) {
// Custom logic
return $result;
}
}- β Full HTML content for search engines
- β Structured data (JSON-LD) for rich snippets
- β Fast server-side rendering
- β No JavaScript execution required for indexing
- β All product/category data accessible
- β Clean URLs and proper meta tags
- Fast initialization with preloading
- Smooth 60fps animations
- Efficient caching with Service Worker
- Progressive Web App capabilities
- Minimal CSS (~20KB)
- No JavaScript overhead
- Fast server rendering
- Optimized for crawlers
- Check browser console for errors
- Verify
flutter/directory contains build files - Check file permissions
- Clear Magento cache
- Check "Force Fallback Mode" is disabled
- Clear cookies and reload
- Verify JS cookie is being set
- Check browser JS is enabled
- Verify "Detect Search Crawlers" is enabled
- Check crawler user agent in detection list
- Add custom crawler patterns in Helper
- Clear static content:
php bin/magento setup:static-content:deploy - Check CSS file exists:
pub/static/.../css/fallback.css - Verify CSS is loading (network tab)
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This module is licensed under the MIT License.
- Email: contact@nativemind.net
- Website: https://nativemind.net
- Issues: GitHub Issues
- flutter_magento - Flutter plugin for Magento
- module-marketplace - Marketplace module
- Initial release
- Flutter Web integration
- Progressive Enhancement
- SEO fallback
- Admin configuration
- Crawler detection
- Service Worker support
Made with β€οΈ by NativeMind