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

ShareMe es un plugin para Flutter que permite compartir fácilmente en apps de iOS y Android. Utiliza menús nativos de compartir para compartir contenido como texto, imágenes y enlaces con otras apps i [...]

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({Key? key}) : super(key: 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;
    const mimeType = 'image/jpeg';
    XFile.fromData(imageData, name: name, mimeType: mimeType);

    ShareMe.file(
      name: name,
      mimeType: mimeType,
      imageData: 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
0
pub points
64%
popularity

Publisher

verified publisherthemonstersapp.com

ShareMe es un plugin para Flutter que permite compartir fácilmente en apps de iOS y Android. Utiliza menús nativos de compartir para compartir contenido como texto, imágenes y enlaces con otras apps instaladas. Interfaz simple con opciones de configuración flexibles. Ahorra tiempo al integrar rápidamente ShareMe en tu app Flutter, ¡y brinda a tus usuarios una forma rápida y conveniente de compartir contenido!

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on share_me