share_me 0.0.19 copy "share_me: ^0.0.19" to clipboard
share_me: ^0.0.19 copied to clipboard

ShareMe is a Flutter plugin that allows for easy sharing in iOS and Android apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:image_picker/image_picker.dart';
import 'package:share_me/share_me.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'ShareMe Example',
      themeMode: ThemeMode.system,
      theme: ThemeData(
        useMaterial3: true,
      ),
      onGenerateRoute: (RouteSettings settings) {
        switch (settings.name) {
          case '/':
            return MaterialPageRoute(
              maintainState: false,
              builder: (_) => const ShareMeApp(),
              settings: settings,
            );
        }
        return null;
      },
    );
  }
}

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

  @override
  State<ShareMeApp> createState() => _ShareMeAppState();
}

class _ShareMeAppState extends State<ShareMeApp> {
  void shareMe(String url) async {
    final byteData = await NetworkAssetBundle(Uri.parse(url)).load(url);
    final imageData = byteData.buffer.asUint8List();
    final name = url.split('/').last;
    final mimeType = 'image/${name.split('.').last}';
    XFile.fromData(imageData, name: name, mimeType: mimeType);

    ShareMe.file(
      name: name,
      mimeType: mimeType,
      file: imageData,
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Scaffold(
        appBar: AppBar(
          title: const Text('ShareMeApp Plugin example app'),
        ),
        body: Center(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () async {
                  ShareMe.system(
                    title: 'Title',
                    url: 'https://themonstersapp.com/',
                    description: 'Descripcion',
                    subject: 'Subjet',
                  );
                },
                child: const Text('Share'),
              ),
              ElevatedButton(
                onPressed: () {
                  shareMe('https://themonstersapp.com/images/bg-static.jpg');
                },
                child: const Text('Share File'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
6
likes
140
points
180
downloads

Publisher

verified publisherthemonstersapp.com

Weekly Downloads

ShareMe is a Flutter plugin that allows for easy sharing in iOS and Android apps.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on share_me