tuul_ai 0.0.2
tuul_ai: ^0.0.2 copied to clipboard
A Flutter plugin for integrating applications with the Tuul AI platform, providing access to Gen, LiteGen, and History services through a unified SDK.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'examples/history_example.dart';
import 'examples/tuul_gen_example.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final List<Map<String, Widget>> buttonPages = [
{"Gen": TuulGenExample()},
{"History": HistoryExamplePage()},
{"LiteGen": const SimplePage(title: "LiteGen")},
{"LiveFunctions": const SimplePage(title: "LiveFunctions")},
{"Persistence": const SimplePage(title: "Persistence")},
{"Gen UI": const SimplePage(title: "Gen UI")},
{"Agent UI": const SimplePage(title: "Agent UI")},
];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Tuul AI Grid UI')),
body: Padding(
padding: const EdgeInsets.all(12.0),
child: GridView.builder(
itemCount: buttonPages.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 12,
mainAxisSpacing: 12,
childAspectRatio: 2.5,
),
itemBuilder: (context, index) {
final entry = buttonPages[index].entries.first;
final name = entry.key;
final page = entry.value;
return ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => page),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.black,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text(
name,
style: const TextStyle(fontSize: 16, color: Colors.white),
),
);
},
),
),
),
);
}
}
/// Generic page for buttons
class SimplePage extends StatefulWidget {
final String title;
const SimplePage({super.key, required this.title});
@override
State<SimplePage> createState() => _SimplePageState();
}
class _SimplePageState extends State<SimplePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Center(
child: Text(
widget.title,
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
),
);
}
}