jetchatbot 0.0.2 copy "jetchatbot: ^0.0.2" to clipboard
jetchatbot: ^0.0.2 copied to clipboard

JetChat is the ultimate AI-powered training buddy, built for Gen Z learners. With our Flutter-based chatbot SDK, ed-tech publishers can create fun, interactive, and personalized training modules. JetC [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:provider/provider.dart';
import 'package:jetchatbot/chatbot_flutter_plugin.dart';

void main() {
  runApp(MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (context) => MyAppState(),
      child: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Namer App',
        theme: ThemeData(
          useMaterial3: true,
          colorScheme: ColorScheme.fromSeed(
              seedColor: const Color.fromARGB(255, 3, 20, 72)),
        ),
        home: LearningCompanionScreen(),
      ),
    );
  }
}

class MyAppState extends ChangeNotifier {}

class LearningCompanionScreen extends StatefulWidget {
  @override
  _LearningCompanionScreenState createState() =>
      _LearningCompanionScreenState();
}

class _LearningCompanionScreenState extends State<LearningCompanionScreen>
    with SingleTickerProviderStateMixin {
  late AnimationController _controller;
  final TextEditingController _emailController = TextEditingController();
  final GlobalKey<FormState> _formKey = GlobalKey<FormState>();

  // Email validation function
  bool _isValidEmail(String email) {
    final RegExp emailRegex =
        RegExp(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$");
    return emailRegex.hasMatch(email);
  }

  Future<void> _validateAndProceed() async {
    if (_isValidEmail(_emailController.text)) {
      JetChatBotPlugin.instance
          .initWithKey(context, "YOUR_APP_KEY", "YOUR_USER_ID");
    }
  }

  @override
  void initState() {
    super.initState();

    // makePostRequest();
    _controller = AnimationController(
      duration: const Duration(seconds: 2),
      vsync: this,
    )..repeat(reverse: true);
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 16.0),
        child: Column(
          // mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            // Animated Image
            AnimatedBuilder(
              animation: _controller,
              builder: (context, child) {
                return Transform.translate(
                  offset: Offset(0, 20 * _controller.value),
                  child: child,
                );
              },
              child: Image.asset(
                'assets/robot.png', // Replace with your asset file
                height: 200,
              ),
            ),

            const SizedBox(height: 20),

            // Title
            const Text(
              'Your Learning Companion',
              style: TextStyle(
                fontSize: 24,
                fontWeight: FontWeight.bold,
                color: Colors.black87,
              ),
              textAlign: TextAlign.center,
            ),

            const SizedBox(height: 10),

            // Subtitle
            const Text(
              'No questions yet! Start a conversation with Inclusio to unlock your learning potential today.',
              style: TextStyle(
                fontSize: 16,
                color: Colors.grey,
              ),
              textAlign: TextAlign.center,
            ),

            const SizedBox(height: 30),
            TextFormField(
              controller: _emailController,
              keyboardType: TextInputType.emailAddress,
              decoration: const InputDecoration(
                labelText: 'Enter Email',
                border: OutlineInputBorder(),
                prefixIcon: Icon(Icons.email),
              ),
            ),
            const SizedBox(height: 30),

            // New Conversation Button
            SizedBox(
              width: 400,
              height: 58, // <-- Your height
              child: ElevatedButton(
                onPressed: () {
                  _validateAndProceed();
                },
                style: ElevatedButton.styleFrom(
                  padding:
                      const EdgeInsets.symmetric(vertical: 16, horizontal: 32),
                  backgroundColor: Color(0xFF176B90),
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(18),
                  ),
                ),
                child: const Text(
                  'New Conversation',
                  style: TextStyle(
                    fontSize: 16,
                    color: Colors.white,
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
0
likes
90
points
72
downloads

Publisher

unverified uploader

Weekly Downloads

JetChat is the ultimate AI-powered training buddy, built for Gen Z learners. With our Flutter-based chatbot SDK, ed-tech publishers can create fun, interactive, and personalized training modules. JetChat makes learning easy, fast, and engaging — giving you real-time answers and guidance like a pro. Get ready to level up your learning game!

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

audio_session, audioplayers, cupertino_icons, english_words, flutter, flutter_sound, http, image_picker, path_provider, permission_handler, plugin_platform_interface, provider, video_player

More

Packages that depend on jetchatbot

Packages that implement jetchatbot