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 your info.plist

Android

  • None

3. Initialize the SDK

Initialize the SDK with your avaId:

FwAvaFlutterSdkInitializer.init(avaId: "yourAvaID");

Note: Initialize the SDK before using AvaCard or AvaFloatingButton. An invalid avaId will throw an IllegalArgumentAvaException, and attempting to use these components without initializing the SDK will result in a NotInitializedAvaException.

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
      ),
    );
  }
}

Demo Screenshots

AVA Page