Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
31ffa90
Initial copy directly from FDE
stuartmorgan-g Sep 24, 2021
c0fbde3
Duplicate macOS example, and replace the macos/ boilerplate with wind…
stuartmorgan-g Sep 24, 2021
e2dcf5f
Extract the plugin class into its own files
stuartmorgan-g Sep 24, 2021
b0c1f49
Placeholder tests
stuartmorgan-g Sep 24, 2021
e760f00
Refactor for testability
stuartmorgan-g Oct 5, 2021
d81ac0c
Real tests
stuartmorgan-g Oct 6, 2021
1c2beff
CHANGELOG
stuartmorgan-g Oct 11, 2021
031aa60
Exclude integration test
stuartmorgan-g Oct 11, 2021
44d35cf
Remove template-generated analysis options
stuartmorgan-g Oct 11, 2021
698936c
Add AUTHORS
stuartmorgan-g Oct 11, 2021
e49ba48
Missing licenses in template code
stuartmorgan-g Oct 11, 2021
27a9425
More formatting
stuartmorgan-g Oct 11, 2021
a36d5d5
Fix directory test
stuartmorgan-g Oct 11, 2021
1685aa5
pubspec fixes
stuartmorgan-g Oct 12, 2021
a52837a
Merge branch 'master' into file-selector-windows
stuartmorgan-g Nov 16, 2021
5c715a4
Merge branch 'main' into file-selector-windows
stuartmorgan-g Jan 11, 2022
55f8826
Minor fixes
stuartmorgan-g Jan 11, 2022
2219023
Fix publish warning
stuartmorgan-g Jan 11, 2022
d67e159
Update build for repo changes
stuartmorgan-g Jan 11, 2022
401af26
Merge branch 'main' into file-selector-windows
stuartmorgan-g Jan 25, 2022
53348b8
Review comments
stuartmorgan-g Jan 25, 2022
6de2ea5
Fix pointer aligments
stuartmorgan-g Jan 25, 2022
24ba33e
Fix bug in single-file example
stuartmorgan-g Jan 25, 2022
2e9d23b
Switch to internal method channel
stuartmorgan-g Jan 25, 2022
8f17b22
Add cross_file to deps
stuartmorgan-g Jan 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/scripts/drive_examples_win32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# found in the LICENSE file.

dart ./script/tool/bin/flutter_plugin_tools.dart drive-examples --windows \
--packages-for-branch --log-timing
--exclude=script/configs/exclude_integration_win32.yaml --packages-for-branch --log-timing
5 changes: 5 additions & 0 deletions packages/file_selector/file_selector_windows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dart_tool
.packages
.flutter-plugins
.flutter-plugins-dependencies
pubspec.lock
10 changes: 10 additions & 0 deletions packages/file_selector/file_selector_windows/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 6d1c244b79f3a2747281f718297ce248bd5ad099
channel: master

project_type: plugin
6 changes: 6 additions & 0 deletions packages/file_selector/file_selector_windows/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Below is a list of people and organizations that have contributed
# to the Flutter project. Names should be added to the list like so:
#
# Name/Organization <email address>

Google Inc.
16 changes: 16 additions & 0 deletions packages/file_selector/file_selector_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## 0.8.2

* Moves source to flutter/plugins, and restructures to allow for unit testing.
* Switches to an internal method channel implementation.

## 0.0.2+1

* Update README

## 0.0.2

* Update SDK constraint to signal compatibility with null safety.

## 0.0.1

* Initial Windows implementation of `file_selector`.
25 changes: 25 additions & 0 deletions packages/file_selector/file_selector_windows/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright 2013 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
19 changes: 19 additions & 0 deletions packages/file_selector/file_selector_windows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# file\_selector\_windows

The Windows implementation of [`file_selector`][1].

## Usage

### Importing the package

This implementation has not yet been endorsed, meaning that you need to
[depend on `file_selector_windows`][2] in addition to
[depending on `file_selector`][3].

Once your pubspec includes the Windows implementation, you can use the
`file_selector` APIs normally. You should not use the `file_selector_windows`
APIs directly.

[1]: https://pub.dev/packages/file_selector
[2]: https://pub.dev/packages/file_selector_windows/install
[3]: https://pub.dev/packages/file_selector/install
48 changes: 48 additions & 0 deletions packages/file_selector/file_selector_windows/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Currently only web supported
android/
ios/

# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
10 changes: 10 additions & 0 deletions packages/file_selector/file_selector_windows/example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: 7736f3bc90270dcb0480db2ccffbf1d13c28db85
channel: dev

project_type: app
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# `file_selector_windows` Example

Demonstrates Windows implementation of the
[`file_selector` plugin](https://pub.dev/packages/file_selector).
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

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

/// Screen that allows the user to select a directory using `getDirectoryPath`,
/// then displays the selected directory in a dialog.
class GetDirectoryPage extends StatelessWidget {
Future<void> _getDirectoryPath(BuildContext context) async {
const String confirmButtonText = 'Choose';
final String? directoryPath =
await FileSelectorPlatform.instance.getDirectoryPath(
confirmButtonText: confirmButtonText,
);
if (directoryPath == null) {
// Operation was canceled by the user.
return;
}
await showDialog<void>(
context: context,
builder: (BuildContext context) => TextDisplay(directoryPath),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Open a text file'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.blue,
onPrimary: Colors.white,
),
child: const Text('Press to ask user to choose a directory'),
onPressed: () => _getDirectoryPath(context),
),
],
),
),
);
}
}

/// Widget that displays a text file in a dialog.
class TextDisplay extends StatelessWidget {
/// Creates a `TextDisplay`.
const TextDisplay(this.directoryPath);

/// The path selected in the dialog.
final String directoryPath;

@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Selected Directory'),
content: Scrollbar(
child: SingleChildScrollView(
child: Text(directoryPath),
),
),
actions: <Widget>[
TextButton(
child: const Text('Close'),
onPressed: () => Navigator.pop(context),
),
],
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

/// Home Page of the application.
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final ButtonStyle style = ElevatedButton.styleFrom(
primary: Colors.blue,
onPrimary: Colors.white,
);
return Scaffold(
appBar: AppBar(
title: const Text('File Selector Demo Home Page'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ElevatedButton(
style: style,
child: const Text('Open a text file'),
onPressed: () => Navigator.pushNamed(context, '/open/text'),
),
const SizedBox(height: 10),
ElevatedButton(
style: style,
child: const Text('Open an image'),
onPressed: () => Navigator.pushNamed(context, '/open/image'),
),
const SizedBox(height: 10),
ElevatedButton(
style: style,
child: const Text('Open multiple images'),
onPressed: () => Navigator.pushNamed(context, '/open/images'),
),
const SizedBox(height: 10),
ElevatedButton(
style: style,
child: const Text('Save a file'),
onPressed: () => Navigator.pushNamed(context, '/save/text'),
),
const SizedBox(height: 10),
ElevatedButton(
style: style,
child: const Text('Open a get directory dialog'),
onPressed: () => Navigator.pushNamed(context, '/directory'),
),
],
),
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:example/get_directory_page.dart';
import 'package:example/home_page.dart';
import 'package:example/open_image_page.dart';
import 'package:example/open_multiple_images_page.dart';
import 'package:example/open_text_page.dart';
import 'package:example/save_text_page.dart';
import 'package:flutter/material.dart';

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

/// MyApp is the Main Application.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'File Selector Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: HomePage(),
routes: <String, WidgetBuilder>{
'/open/image': (BuildContext context) => OpenImagePage(),
'/open/images': (BuildContext context) => OpenMultipleImagesPage(),
'/open/text': (BuildContext context) => OpenTextPage(),
'/save/text': (BuildContext context) => SaveTextPage(),
'/directory': (BuildContext context) => GetDirectoryPage(),
},
);
}
}
Loading