adcio_agent 1.0.0 copy "adcio_agent: ^1.0.0" to clipboard
adcio_agent: ^1.0.0 copied to clipboard

This is a Flutter agent for the ADCIO project, a chatbot based on LLM(GPT) that suggests personalized products through conversations

example/lib/main.dart

// ignore_for_file: use_build_context_synchronously

import 'dart:developer';

import 'package:adcio_agent/adcio_agent.dart';
import 'package:flutter/material.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  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 const MaterialApp(
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({
    super.key,
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        leading: BackButton(
          onPressed: () async {
            final isStartPage = await isAgentStartPage;

            isStartPage ? Navigator.of(context).canPop() : agentGoback();
          },
        ),
        title: const Text('adcio_agent example app'),
      ),
      body: AdcioAgent(
        showAppbar: true,
        onClickProduct: (String productId) {
          log('productId = $productId');

          // Navigation and routing
          final route = MaterialPageRoute(
            builder: (context) => DemoProductPage(
              productId: productId,
            ),
          );
          Navigator.of(context).push(route);
        },
        clientId: "f8f2e298-c168-4412-b82d-98fc5b4a114a",
      ),
    );
  }
}

class DemoProductPage extends StatelessWidget {
  const DemoProductPage({
    super.key,
    required this.productId,
  });

  final String productId;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Product $productId'),
      ),
      body: Center(
        child: Text('Product $productId'),
      ),
    );
  }
}
1
likes
130
pub points
0%
popularity

Publisher

verified publishercorca.ai

This is a Flutter agent for the ADCIO project, a chatbot based on LLM(GPT) that suggests personalized products through conversations

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

adcio_core, flutter, webview_flutter

More

Packages that depend on adcio_agent