atomicbi_flutter_ai 0.9.3
atomicbi_flutter_ai: ^0.9.3 copied to clipboard
A set of AI chat-related widgets for Flutter apps targeting mobile, desktop, and web.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:atomicbi_flutter_ai/atomicbi_flutter_ai.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const App());
}
final theme = ThemeData(
brightness: Brightness.dark,
primaryColor: const Color(0xff54346b),
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xff54346b), brightness: Brightness.dark),
textTheme: const TextTheme(
bodyMedium: TextStyle(color: Color(0xffeeeeee), fontSize: 14)
),
tooltipTheme: TooltipThemeData(
textStyle: TextStyle(color: const Color(0xffe9eef8)),
decoration: BoxDecoration(
color: const Color(0xff121721),
border: Border.all(
color: const Color(0xff04070f),
style: BorderStyle.solid,
width: 1
),
borderRadius: BorderRadius.all(Radius.circular(4))
)
),
);
class App extends StatelessWidget {
const App({ super.key });
@override
Widget build(BuildContext context) => MaterialApp(
title: 'Atomic BI AI',
home: const ChatPage(),
theme: theme,
debugShowCheckedModeBanner: false
);
}
class ChatPage extends StatelessWidget {
const ChatPage({super.key});
@override
Widget build(BuildContext context) => Scaffold(
body: Container(
constraints: BoxConstraints(minHeight: double.infinity),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xff1F122F), Color(0xff121B21)]
)
),
child: LlmChatView(
style: getAtomicBITheme(theme),
onReportCallback: (context, message, text) {
print('report: $text');
},
provider: EchoProvider(
history: [
ChatMessage.llm()..text = 'Hi there',
ChatMessage.user('What is 2 + 2?', []),
ChatMessage.llm()..text = 'Offensive Content'
]
)
)
)
);
}