eureel_flutter 0.4.0
eureel_flutter: ^0.4.0 copied to clipboard
Per-screen tutorial videos for Flutter apps — the Eureel SDK. Upload and map videos in the Eureel dashboard; this package shows them as a corner bubble with a full player.
example/lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:eureel_flutter/eureel_flutter.dart';
/// Run with your public key:
/// flutter run --dart-define=EUREEL_KEY=pk_live_xxx --dart-define=EUREEL_API=http://localhost:8000
/// On the Android emulator the default API URL points at your computer (10.0.2.2).
const _key = String.fromEnvironment('EUREEL_KEY');
const _api = String.fromEnvironment('EUREEL_API');
String get _defaultApi =>
defaultTargetPlatform == TargetPlatform.android ? 'http://10.0.2.2:8000' : 'http://localhost:8000';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Eureel.init(
apiKey: _key,
apiUrl: _api.isEmpty ? _defaultApi : _api,
appId: 'com.example.eureel_example',
);
runApp(const DemoApp());
}
class DemoApp extends StatelessWidget {
const DemoApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Eureel demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(colorSchemeSeed: const Color(0xFF1828DC), useMaterial3: true),
initialRoute: '/products',
routes: {
'/home': (_) => const DemoScreen(title: 'Home'),
'/products': (_) => const DemoScreen(title: 'Products'),
'/sales': (_) => const DemoScreen(title: 'Sales'),
'/settings': (_) => const DemoScreen(title: 'Settings (no video)'),
},
);
}
}
class DemoScreen extends StatelessWidget {
final String title;
const DemoScreen({super.key, required this.title});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
// "How to use" button — put it anywhere; here in the AppBar, icon only.
actions: const [Padding(padding: EdgeInsets.only(right: 8), child: EureelHelpButton(style: EureelHelpStyle.icon))],
),
drawer: Drawer(
child: ListView(
children: [
const DrawerHeader(child: Text('Demo Shop')),
for (final r in const ['/home', '/products', '/sales', '/settings'])
ListTile(title: Text(r), onTap: () => Navigator.pushReplacementNamed(context, r)),
],
),
),
body: Stack(
children: [
GridView.count(
padding: const EdgeInsets.all(16),
crossAxisCount: 2,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
children: List.generate(
8,
(i) => Container(decoration: BoxDecoration(color: Colors.grey.shade100, borderRadius: BorderRadius.circular(12))),
),
),
// Matches this route against each screen's "Flutter route" in the dashboard.
const EureelOverlay(),
],
),
);
}
}