Qries

Subscribe Us

Advertisement

Image Share

 Image Share:


Video:


Code:

import 'package:flutter/material.dart';
import 'package:image_share/image_share.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initstate() {
    super.initState();
  }

  Future<void> share_button() async {
    await ImageShare.shareImage(filePath: "images/logo.jpg");
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: Text("Share Image"),
          backgroundColor: Colors.deepPurple,
        ),
        body: Center(
          child: Image.asset("images/logo.jpg"),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () => share_button(),
          child: Icon(Icons.share),
        ),
      ),
    );
  }
}

Post a Comment

0 Comments