fw_ava_flutter_sdk 0.0.1 fw_ava_flutter_sdk: ^0.0.1 copied to clipboard
Flutter plugin for Firework Ava SDK, which supports integrating AI Digital Humans into Flutter Apps
fw_ava_flutter_sdk #
Example #
void main() {
FwAvaFlutterSdkInitializer.init(avaId: "xxxx"); // initialize
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate, // Add Material localizations delegate
AvaLocalizations.delegate, // Add ava localizations delegate
],
supportedLocales: [
...AvaLocalizations.supportedLocales, // Add ava supported locales
],
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: const Center(
child: Padding(
padding: EdgeInsets.all(20),
child: AvaCard(), // Add AvaCard
),
),
floatingActionButton: const AvaFloatingButton(), // Add AvaFloatingButton
),
);
}
}
Get Started #
1. Prerequisites #
// flutter
Flutter SDK ">=3.0.0"
Dart SDK ">=2.17.0 <4.0.0"
// Localization support
flutter_localizations
intl: ^0.19.0
// iOS
iOS 14 or greater.
// Android
minSdkVersion 23 or greater
2. Microphone Permission Configuration #
To enable audio interaction with Ava, configure microphone permissions:
iOS
- Add
NSMicrophoneUsageDescription
in yourinfo.plist
Android
- None
3. Initialize the SDK #
Initialize the SDK with your avaId:
FwAvaFlutterSdkInitializer.init(avaId: "yourAvaID");
Note: Initialize the SDK before using
AvaCard
orAvaFloatingButton
. An invalidavaId
will throw anIllegalArgumentAvaException
, and attempting to use these components without initializing the SDK will result in aNotInitializedAvaException
.
4. Configure Localization #
Add localization support to your App:
MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate, // Add Material localizations delegate
AvaLocalizations.delegate, // Add ava localizations delegate
],
supportedLocales: [
...AvaLocalizations.supportedLocales, // Add ava supported locales
],
……
);
5. Add AvaCard and AvaFloatingButton #
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
……
home: Scaffold(
……
body: const Center(
child: Padding(
child: AvaCard(), // Add AvaCard
),
),
floatingActionButton: const AvaFloatingButton(), // Add AvaFloatingButton
),
);
}
}