-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul example plugin, and rename it 'sample' (#654)
Renames the plugin from 'example_plugin' to 'sample' so that the naming is consistent with all the actual plugins (which have 'plugin' in the class name, but not the actual plugin name). Also makes various improvements to the sample code and documentation, as described in the associated bug. Fixes #648
- Loading branch information
1 parent
7a6897c
commit 1eac306
Showing
29 changed files
with
287 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.dart_tool | ||
.packages | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
pubspec.lock |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# sample_plugin | ||
|
||
This is intended to serve as a starting point for writing your own Windows | ||
and/or Linux plugin, since `flutter create` does not yet support Windows | ||
or Linux. | ||
|
||
Before continuing, read [the main plugins README](../README.md) if you haven't already. | ||
|
||
## Use | ||
|
||
- To create an entirely new plugin, or a federated Windows/Linux implementation | ||
of an existing plugin, copy the entire `sample` directory. | ||
- Update the `pubspec.yaml` as normal for a plugin. Look for comments | ||
containing `***` and update those entries as described in the comment. | ||
- Delete the directories for any platforms you aren't supporting. | ||
- To add desktop support directly to an existing plugin, copy the `windows` | ||
and/or `linux` directories into that plugin. | ||
- Update the plugin's `pubspec.yaml` to include the new platforms. | ||
If you haven't already, you'll need to switch to the new `plugins:` | ||
format, as the legacy declaration doesn't support desktop. | ||
|
||
**WARNING**: The plugin APIs, plugin tooling, and plugin structure for | ||
Windows and Linux **are not at all stable**. Plugins created using this | ||
sample are subject to breakage at any time, and will need to be updated | ||
any time any of those things change. This means you **should not publish | ||
Windows or Linux plugins to pub.dev** as anything published now will | ||
almost certainly not work with the final Flutter Windows and Linux support. | ||
|
||
### Windows | ||
|
||
- Change `sample` in all the filenames to your plugin's name. | ||
- Change the `FlutterPluginName` in `PluginInfo.props` to your plugin's name. | ||
- Look for comments containing `***` in the `.h` and `.cpp` file, and update | ||
the code as described in the comment. | ||
|
||
### Linux | ||
|
||
- Rename `sample` in all the file names with your plugin's name. | ||
- Change the `PLUGIN_NAME` in the `Makefile` to your plugin's name. | ||
- Look for comments containing `***` in the `.h` and `.cc` file, and update | ||
the code as described in the comment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.