receipt_reader 0.0.7 copy "receipt_reader: ^0.0.7" to clipboard
receipt_reader: ^0.0.7 copied to clipboard

A Flutter package for reading and processing receipts using Google ML Kit.

example/main.dart

import 'package:flutter/material.dart';
import 'package:receipt_reader/models/order.dart';
import 'package:receipt_reader/receipt_reader.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Receipt Uploader',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const ReceiptUploaderScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Upload Receipt'),
      ),
      body: ReceiptUploader(
        onAdd: (Order order) {
          // Handle the added order
          ScaffoldMessenger.of(context).showSnackBar(
            SnackBar(
              content: Text('Order added: ${order.items.length} items'),
            ),
          );
        },
        geminiApi:
            '************************************************', // Replace with your API URL
        listOfCategories: <String>["food", "clothes"],
        actionButtonStyle: ElevatedButton.styleFrom(
          backgroundColor: Colors.blue, // Button color
          textStyle: const TextStyle(fontSize: 16),
        ),
        orderSummaryTextStyle: const TextStyle(
          fontSize: 18,
          fontWeight: FontWeight.bold,
          color: Colors.black,
        ),
        extractedDataTextStyle:
            const TextStyle(fontSize: 14, color: Colors.grey),
        imagePreviewHeight: 250.0,
        padding: const EdgeInsets.all(20.0),
      ),
    );
  }
}
3
likes
140
points
202
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for reading and processing receipts using Google ML Kit.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, google_generative_ai, google_mlkit_text_recognition, image_picker, path_provider

More

Packages that depend on receipt_reader