llm_emotions 0.1.0
llm_emotions: ^0.1.0 copied to clipboard
A Flutter package for displaying animated emotional states for LLM interactions.
LLM Emotions #
A Flutter package for displaying animated emotional states for LLM interactions.
This package provides a configurable widget, FluxAnimation, that can display a wide range of emotional states through two different animation styles: a sleek, icon-based animation and a more expressive robot-face animation.
Features #
- Multiple Animation Styles: Choose between
AnimationType.iconandAnimationType.robotFace. - Rich Emotional States: A comprehensive set of
CoreStateenums to represent various emotions and actions, such ashappy,angry,sad,thinking,listening, etc. - Easy to Use: Simply drop the
FluxAnimationwidget into your app and control its state with theFluxController. - Configurable: Easily switch between animation types and states.
Getting Started #
To use this package, add llm_emotions as a dependency in your pubspec.yaml file.
dependencies:
llm_emotions: ^0.1.0
Then, import the package in your Dart code:
import 'package:llm_emotions/flux_animation.dart';
Usage #
Here's a quick example of how to use the FluxAnimation widget:
import 'package:flutter/material.dart';
import 'package:llm_emotions/flux_animation.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: Colors.black),
home: const ExampleScreen(),
);
}
}
class ExampleScreen extends StatefulWidget {
const ExampleScreen({super.key});
@override
State<ExampleScreen> createState() => _ExampleScreenState();
}
class _ExampleScreenState extends State<ExampleScreen> {
final FluxController _controller = FluxController();
AnimationType _animationType = AnimationType.icon;
@override
void dispose() {
_controller.dispose();
super.dispose();
}
void _toggleAnimationType() {
setState(() {
_animationType = _animationType == AnimationType.icon
? AnimationType.robotFace
: AnimationType.icon;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('LLM Emotions Example'),
backgroundColor: Colors.transparent,
elevation: 0,
actions: [
const Text('Icon'),
Switch(
value: _animationType == AnimationType.robotFace,
onChanged: (value) => _toggleAnimationType(),
activeTrackColor: Colors.purpleAccent,
inactiveThumbColor: Colors.cyanAccent,
),
const Text('Robot'),
const SizedBox(width: 20),
],
),
body: Stack(
children: [
Center(
child: FluxAnimation(
controller: _controller,
type: _animationType,
key: ValueKey(_animationType),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
height: 140,
padding: const EdgeInsets.symmetric(vertical: 10),
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [Colors.black, Colors.transparent],
),
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: CoreState.values
.map(
(state) => Padding(
padding: const EdgeInsets.only(right: 8),
child: ActionChip(
label: Text(
state.name.toUpperCase(),
style: const TextStyle(fontSize: 10),
),
backgroundColor: _controller.current == state
? Colors.cyanAccent
: Colors.grey[900],
labelStyle: TextStyle(
color: _controller.current == state
? Colors.black
: Colors.white,
),
onPressed: () =>
setState(() => _controller.setState(state)),
),
),
)
.toList(),
),
),
),
),
],
),
);
}
}
Additional Information #
This package is a starting point for creating more expressive and engaging user interfaces for LLM-powered applications. Feel free to contribute to the project and add more animation types and emotional states!