background_remover_ft 0.0.5 copy "background_remover_ft: ^0.0.5" to clipboard
background_remover_ft: ^0.0.5 copied to clipboard

PlatformAndroid

remove image Background change plugin.

example/lib/main.dart

import 'dart:io';
import 'package:background_remover_ft/backraund.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final backraundPlugin = Backraund();

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

  // Platform messages are asynchronous, so we initialize in an async method.
  File? file;
  var result;

  callPlugin() async {
    result = await backraundPlugin.remomeBackrond(path: file!.path);
    setState(() {});
  }

  imagePiker() async {
    var selected = await ImagePicker().pickImage(source: ImageSource.gallery);
    if (selected == null) {
      return;
    }
    file = File(selected.path);
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Background Remover'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            // Display your image here

            result != null
                ? Image.memory(
              result!,
              fit: BoxFit.fill,
              height: 350,
            )
                : file != null
                ? Image.file(
              file!,
              fit: BoxFit.fill,
              height: 350,
            )
                : const SizedBox(),

            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () async {
                imagePiker();
                // await bg.getPlatformVersion();
                // print("===============>${await bg.getPlatformVersion()}");
              },
              child: const Text('image pick'),
            ),
            ElevatedButton(
              onPressed: () async {
                callPlugin();
              },
              child: const Text('Remove Background'),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
17
downloads

Publisher

unverified uploader

Weekly Downloads

remove image Background change plugin.

Homepage

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on background_remover_ft

Packages that implement background_remover_ft