tone_detector 0.0.1 copy "tone_detector: ^0.0.1" to clipboard
tone_detector: ^0.0.1 copied to clipboard

Tone Detector is a flutter package that detects the tone of a given text.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:tone_detector/domain/config/config.dart';
import 'package:tone_detector/domain/controller/tone_detector_controller.dart';
import 'package:tone_detector/tone_detector.dart';

import '.env.dart';

void main() {
  TD.configure(apiKey: toneDetectorServiceKey ?? '');
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Tone Detector Example',
      theme: ThemeData(
        scaffoldBackgroundColor: Colors.grey.shade200,
        primarySwatch: Colors.yellow,
        textTheme: const TextTheme(
          bodyLarge: TextStyle(color: Colors.white),
          bodyMedium: TextStyle(color: Colors.white),
          bodySmall: TextStyle(color: Colors.white),
        ),
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key? key}) : super(key: key);
  final ToneDetectorController controller = ToneDetectorController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Chat :: Tone Detector'),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            ElevatedButton(
              onPressed: () => controller.analyze('I am angry', aggressiveness: 0.4),
              child: const Text('Analyze'),
            ),
            ToneDetectorWidget(
              controller: controller,
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Tone Detector is a flutter package that detects the tone of a given text.

Homepage

Funding

Consider supporting this project:

www.buymeacoffee.com

License

unknown (LICENSE)

Dependencies

flutter, http

More

Packages that depend on tone_detector