auto_translate_plugin 1.0.2 copy "auto_translate_plugin: ^1.0.2" to clipboard
auto_translate_plugin: ^1.0.2 copied to clipboard

A premium Flutter plugin for seamless on-device text translation using Google ML Kit. Offline, privacy-first, and easy to integrate.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:auto_translate_plugin/auto_translate_plugin.dart';

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (_) => TranslatorProvider(),
      child: const MyApp(),
    ),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: const HomeScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final translator = context.read<TranslatorProvider>();

    return Scaffold(
      appBar: AppBar(
        title: const AutoTranslateText(
          "Auto Translate Demo",
          style: TextStyle(color: Colors.white),
        ),
        backgroundColor: Colors.blue,
      ),
      body: Padding(
        padding: const EdgeInsets.all(20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const AutoTranslateText(
              "Welcome to my application",
              style: TextStyle(fontSize: 22),
            ),
            const SizedBox(height: 10),
            const AutoTranslateText(
              "This app translates text automatically",
            ),
            const SizedBox(height: 30),

            const AutoTranslateText(
              "Select Language",
              style: TextStyle(fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 10),

            Row(
              children: [
                ElevatedButton(
                  onPressed: () => translator.changeLanguage('en'),
                  child: const Text("English"),
                ),
                const SizedBox(width: 10),
                ElevatedButton(
                  onPressed: () => translator.changeLanguage('ta'),
                  child: const Text("Tamil"),
                ),
                const SizedBox(width: 10),
                ElevatedButton(
                  onPressed: () => translator.changeLanguage('hi'),
                  child: const Text("Hindi"),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
5
likes
70
points
301
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A premium Flutter plugin for seamless on-device text translation using Google ML Kit. Offline, privacy-first, and easy to integrate.

Repository (GitHub)
View/report issues

Topics

#translation #mlkit #localization #on-device-ml #offline-translation

License

MIT (license)

Dependencies

flutter, google_mlkit_translation, provider

More

Packages that depend on auto_translate_plugin