fl_drag_picture 0.0.4 copy "fl_drag_picture: ^0.0.4" to clipboard
fl_drag_picture: ^0.0.4 copied to clipboard

用Flutter实现的多图片拖动,上传至网络, 开箱即用.

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:fl_drag_picture/fl_drag_picture.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _flDragPicturePlugin = FlDragPicture();

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

  // // Platform messages are asynchronous, so we initialize in an async method.
  // Future<void> initPlatformState() async {
  //   String platformVersion;
  //   // Platform messages may fail, so we use a try/catch PlatformException.
  //   // We also handle the message potentially returning null.
  //   try {
  //     platformVersion =
  //         await _flDragPicturePlugin.getPlatformVersion() ?? 'Unknown platform version';
  //   } on PlatformException {
  //     platformVersion = 'Failed to get platform version.';
  //   }
  //
  //   // If the widget was removed from the tree while the asynchronous platform
  //   // message was in flight, we want to discard the reply rather than calling
  //   // setState to update our non-existent appearance.
  //   if (!mounted) return;
  //
  //   setState(() {
  //     _platformVersion = platformVersion;
  //   });
  // }

  List<String> x = [
    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS2zFG-Cy6Jg2GBcZrK-se70-cUMGL2lkqNqYCWhrCW&s",
    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRD7uzo6K_z3e5vsNk-J7W-OoSSfNCVCMCN5yH4c1KA&s",
    "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTDLG1rePq00VAg7LohNQTGpl3cQkZLUz6NWyHwUJ12&s",
    "https://static.wikia.nocookie.net/starwars/images/1/1c/CT5385Tup-TCWCEJtB.png/revision/latest?cb=20221005011539",
    "https://5.imimg.com/data5/ANDROID/Default/2020/8/RU/EX/EI/112326264/product-jpeg-500x500.jpg",
    "https://www.tupcavite.edu.ph/images/TUPSeal2.png"
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: FlDragPicture(maxSelect: 5, picList: x, isShowBigPic: true),
        ),
      ),
    );
  }
}