watermark_image 0.0.3 copy "watermark_image: ^0.0.3" to clipboard
watermark_image: ^0.0.3 copied to clipboard

Watermark image package is used to achieve watermark on an image.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:watermark_image/watermark_image.dart';
import 'package:image_picker/image_picker.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Watermark Image'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  File? waterMarkedImg;
  XFile? img;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: SizedBox(
        width: MediaQuery.of(context).size.width,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            MaterialButton(
              onPressed: () async {
                ImagePicker picker = ImagePicker();
                img = await picker.pickImage(
                    source: ImageSource.camera, imageQuality: 10);

                waterMarkedImg = await WatermarkImage.addWaterMarkToPhoto(
                    image: File(img!.path), waterMarkText: "new waterMarkText");
                setState(() {});
              },
              child: const Text("Click image"),
            ),
            waterMarkedImg != null
                ? Image.file(waterMarkedImg!)
                : const SizedBox.shrink()
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
73
downloads

Publisher

unverified uploader

Weekly Downloads

Watermark image package is used to achieve watermark on an image.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, image, path_provider

More

Packages that depend on watermark_image