embed_flutter 0.0.15
embed_flutter: ^0.0.15 copied to clipboard
A powerful Flutter SDK that provides a powerful voice-enabled AI-agent functionality with real-time widget tree monitoring for screen context fetching and realtime voice communication.
example/lib/main.dart
import 'package:embed_flutter_example/multi_screen_form/additional_info_screen.dart';
import 'package:embed_flutter_example/multi_screen_form/address_screen.dart';
import 'package:embed_flutter_example/multi_screen_form/contact_info_screen.dart';
import 'package:embed_flutter_example/multi_screen_form/personal_info_screen.dart';
import 'package:embed_flutter_example/multi_screen_form/review_screen.dart';
import 'package:flutter/material.dart';
import 'package:embed_flutter/embed_flutter.dart';
import 'multi_screen_form/home_screen.dart';
void main() {
// Initialize embed configuration for examples
embedInitialize(
'key_456',
flowName: 'onboarding_flow',
);
embedInitialize(
'key_123',
flowName: 'additional_info_flow',
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// Global key for ScaffoldMessenger to show SnackBars from callbacks
static final GlobalKey<ScaffoldMessengerState> scaffoldMessengerKey =
GlobalKey<ScaffoldMessengerState>();
@override
Widget build(BuildContext context) {
return EmbedWidget(
rightPadding: 20,
bottomPadding: 100,
showEmbedWidget: true,
// Configure flow-based activation
onPermissionStatusChanged: (status) {
print('Permission status changed: $status');
},
enabledRoutes: const {
'onboarding_flow': [
'personal_info_screen',
'contact_info_screen',
'address_screen',
],
'additional_info_flow': [
'additional_info_screen',
'review_screen',
],
},
child: MaterialApp(
scaffoldMessengerKey: scaffoldMessengerKey,
title: 'Embed Flutter SDK Examples',
theme: ThemeData(
primarySwatch: Colors.blue,
useMaterial3: true,
),
navigatorObservers: [EmbedNavigatorObserver()],
home: const HomeScreen(),
routes: {
'multi-screen': (context) => const MultiScreenHome(),
// Multi-screen implementation routes - names match enabledRoutes
'personal_info_screen': (context) => const PersonalInfoScreen(),
'contact_info_screen': (context) => const ContactInfoScreen(),
'address_screen': (context) => const AddressScreen(),
'additional_info_screen': (context) => const AdditionalInfoScreen(),
'review_screen': (context) => const ReviewScreen(),
},
),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Embed Flutter SDK Examples'),
backgroundColor: Colors.blue[600],
foregroundColor: Colors.white,
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Welcome to Embed Agent Flutter SDK Example',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
Card(
elevation: 4,
child: InkWell(
onTap: () {
Navigator.pushNamed(context, 'multi-screen');
},
child: const Padding(
padding: EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.apps, size: 48, color: Colors.green),
SizedBox(height: 16),
Text(
'Multi Screen Form',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8),
Text(
'Demonstrates EmbedWidget across multiple screens with flow-based activation. Two flows configured: onboarding and additional info.',
style: TextStyle(fontSize: 14, color: Colors.grey),
),
],
),
),
),
),
],
),
),
),
);
}
}