filepicker_windows 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

filepicker_windows #

File picker for Windows, using the common item dialog.

You'll find a Flutter example in the example\ folder.

Built with the latest master channel of Flutter; will not work on more stable channels until Windows support reaches beta.

0.1.2 #

  • Update APIs

0.1.0 #

  • Basic implementation using win32.
  • Add example that shows using OpenFileDialog to select desktop wallpaper.

example/lib/main.dart

import 'dart:io';

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

import 'wallpaper.dart';

void main() => runApp(FilePickerExample());

class FilePickerExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  File path;

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(path != null ? path.toString() : 'Select a file'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            SizedBox(
              height: MediaQuery.of(context).size.height / 2,
              width: MediaQuery.of(context).size.width - 100,
              child: path == null ? Placeholder() : Image.file(path),
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceAround,
              children: [
                RaisedButton(
                  child: Text('Open file dialog'),
                  onPressed: () {
                    final file = FilePicker();
                    file.hidePinnedPlaces = true;
                    file.forcePreviewPaneOn = true;
                    file.filterSpecification = {
                      'JPEG Files': '*.jpg;*.jpeg',
                      'Bitmap Files': '*.bmp',
                      'All Files (*.*)': '*.*'
                    };
                    file.title = 'Select an image';
                    final result = file.getFile();
                    if (result != null) {
                      setState(() {
                        path = result;
                      });
                    }
                  },
                ),
                RaisedButton(
                  child: Text('Set Wallpaper'),
                  onPressed: () {
                    Wallpaper.set(path);
                  },
                )
              ],
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  filepicker_windows: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:filepicker_windows/filepicker_windows.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
29
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:filepicker_windows/filepicker_windows.dart that declares support for platforms: windows

Package does not support Flutter platform ios

Because:

  • package:filepicker_windows/filepicker_windows.dart that declares support for platforms: windows

Package does not support Flutter platform linux

Because:

  • package:filepicker_windows/filepicker_windows.dart that declares support for platforms: windows

Package does not support Flutter platform macos

Because:

  • package:filepicker_windows/filepicker_windows.dart that declares support for platforms: windows

Package does not support Flutter platform web

Because:

  • package:filepicker_windows/filepicker_windows.dart that declares support for platforms: windows

Package not compatible with SDK dart

Because:

  • filepicker_windows that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
ffi ^0.1.3 0.1.3
flutter 0.0.0
win32 ^1.6.2 1.6.8
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test
pedantic ^1.9.0