filepicker_windows 0.0.2 filepicker_windows: ^0.0.2 copied to clipboard
A plugin for selecting files in Windows
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:filepicker_windows/filepicker_windows.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
File path;
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text(path != null ? path.toString() : 'Select a file'),
),
body: RaisedButton(
child: Text('filepicker'),
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';
setState(
() {
path = file.getFile();
},
);
},
),
),
);
}
}