未验证 提交 8e658651 编写于 作者: S stuartmorgan 提交者: GitHub

Remove 'example' and 'sample' (#701)

Now that flutter create has support for all three desktop platforms, neither example/ nor plugins/sample are necessary. This removes both, and all discussion of using them as the basis for creating new apps or plugins.
上级 975f733d
......@@ -9,14 +9,7 @@ assignees: ''
<!--
*** Important Note ***
Development of Flutter for Desktop is now primarily happening in the Flutter repository itself. If you have a bug or feature request related to desktop that's about the Flutter framework, the `flutter` command-line tool, or the desktop support in the Flutter engine, please file your issue in the Flutter issue tracker: https://github.com/flutter/flutter/issues
Please file bugs here only for things specific to this repository:
* Instructions in the READMEs here.
* Bugs specific to the example application here.
* Bugs specific to the plugins here.
If you're not sure whether the issue is in the code here or in Flutter itself, you can file your bug here, but we may close the issue and ask you to file it in Flutter if it turns out not to be related to this code that's part of this project.
Development of Flutter for Desktop is now happening almost entirely in the Flutter repository itself. Unless your issue is related to one of the plugins in this repository, please file your issue in the Flutter issue tracker: https://github.com/flutter/flutter/issues
-->
**Describe the bug**
......
......@@ -9,17 +9,7 @@ assignees: ''
<!--
*** Important Note ***
Development of Flutter for Desktop is now primarily happening in the Flutter repository itself. If you have a bug or feature request related to desktop that's about the Flutter framework, the `flutter` command-line tool, or the desktop support in the Flutter engine, please file your bug in the Flutter issue tracker: https://github.com/flutter/flutter/issues
Please file bugs here only for things specific to this repository, such as:
* Proposed changes to instructions in the READMEs here.
* Requests specific to the plugins here.
If you're not sure whether the report belongs here or in Flutter itself, you can file it here here, but we may close the issue and ask you to file it in Flutter if it turns out not to be specific to this project.
***Important Note #2***
For general discussion and questions, please use the project mailing list rather than filing an issue:
https://groups.google.com/forum/#!forum/flutter-desktop-embedding-dev
Development of Flutter for Desktop is now happening almost entirely in the Flutter repository itself. Unless your issue is related to one of the plugins in this repository, please file your issue in the Flutter issue tracker: https://github.com/flutter/flutter/issues
-->
**Describe Request**
......@@ -52,16 +52,6 @@ jobs:
- name: Doctor
# Run doctor, for ease of debugging any issues.
run: flutter doctor -v
- name: Build example debug
run: |
flutter packages get
flutter build -v ${{matrix.TARGET}} --debug
working-directory: ${{ github.workspace }}/fde/example
- name: Build example release
run: |
flutter packages get
flutter build -v ${{matrix.TARGET}} --release
working-directory: ${{ github.workspace }}/fde/example
- name: Build testbed debug
run: |
flutter packages get
......
......@@ -2,16 +2,14 @@
This project was originally created to develop Windows, macOS, and Linux
embeddings of [Flutter](https://github.com/flutter/flutter). That work has
since [become part of
Flutter](https://github.com/flutter/flutter/wiki/Desktop-shells); what
is left here are the parts that have not yet stabilized enough to merge
into the Flutter project, including:
- Preliminary runners for Windows and Linux (via the example).
- Experimental, early-stage desktop plugins.
- A starting point and preliminary instructions for
using and/or writing plugins on Windows and Linux.
since become part of Flutter, and all that remains here are experimental,
early-stage desktop
[plugins](https://flutter.dev/docs/development/packages-and-plugins/developing-packages).
**The code here is not stable, nor intended for production use.**
If you just want to start running Flutter on desktop, the place to start is now
[the Flutter wiki](https://github.com/flutter/flutter/wiki/Desktop-shells), rather than this project. You will already need to have followed the
instructions there to get an application running on desktop before using any
of the plugins here.
## Setting Up
......@@ -19,55 +17,26 @@ This project is closely tied to changes in the Flutter repository, so
you must be on the latest version of the [Flutter master
channel](https://github.com/flutter/flutter/wiki/Flutter-build-release-channels#how-to-change-channels).
You should always update this repository and Flutter at the same time,
as breaking changes for desktop happen frequently.
### Tools
First you will need to [enable Flutter desktop support for your
platform](https://github.com/flutter/flutter/wiki/Desktop-shells#tooling).
Then run `flutter doctor` and be sure that no issues are reported for the
sections relevant to your platform.
## Running a Project
### Example
Once you have everything set up, just `flutter run` in the `example` directory
to run your first desktop Flutter application!
Note: Only `debug` mode is currently available for Windows and Linux. Running with
`--release` or `--profile` will succeed, but the result will still be using a
`debug` Flutter configuration: asserts will fire, the observatory will be enabled,
etc.
### Running Other Flutter Projects
See [the example README](example/README.md) for information on using the
example as a starting point to run another project.
as breaking changes for desktop can happen at any time.
## Repository Structure
`testbed` is a more complex example that is primarily intended for people
actively working on Flutter for desktop. See [its README](testbed/README.md)
for details.
The `plugins` directory contains all the plugins. See
[its README](plugins/README.md) to get started.
The `plugins` directory has early-stage desktop
[plugins](https://flutter.dev/docs/development/packages-and-plugins/developing-packages).
See the [README](plugins/README.md) for details.
`testbed` is a a simple test application for the plugins above. (The typical
structure of having an example app in each plugin is not used here to avoid
the overhead of updating many applications each time there is a breaking change,
which is still common for desktop.)
## Feedback and Discussion
## Feedback
For bug reports and feature requests specific to the example or the plugins,
you can file GitHub issues. Bugs and feature requests related to desktop support
in general should be filed in the
For bug reports and feature requests related to the plugins, you can file GitHub
issues. Bugs and feature requests about Flutter on desktop in general should
be filed in the
[Flutter issue tracker](https://github.com/flutter/flutter/issues).
For general discussion and questions there's a [project mailing
list](https://groups.google.com/forum/#!forum/flutter-desktop-embedding-dev).
## Caveats
* This is not an officially supported Google product.
* The code and examples here, and the desktop Flutter libraries they use, are
in early stages, and not intended for production use.
* The code here is in early stages, and not intended for production use.
.atom/
.dart_tool/
.idea
.vscode/
.packages
.pub/
android/
build/
ios/
packages
.flutter-plugins
# Since the current expectation is that clients are using Flutter head,
# and Dart SDK changes unlock dependencies, pubspec.lock isn't useful.
# Ignore it since it just creates noise. When there's a system in place
# for versioning this project relative to Flutter, remove this.
pubspec.lock
# 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: eaa9b47a4ac278a9439468911d2c361a472b114b
channel: master
# Application Customization
Because `example` is still in the process of being converted to
`flutter create` templates, support for customizing the application
is a work in progres. This page describes the current process for
making common modification to the native application on each platform.
It will be updated as `example` evolves. Keep in mind that as with
everything in this repository, forward-compatibility is not guaranteed;
the process for any customization may change in the future without
warning.
Please file issues for any basic application-level customizations that you would
like to be able to make that aren't listed here.
## macOS
- **Application Name**: Change `PRODUCT_NAME` in
`macos/Runner/Configs/AppInfo.xcconfig`.
- **Bundle Identifier**: Change `PRODUCT_BUNDLE_IDENTIFIER` in
`macos/Runner/Configs/AppInfo.xcconfig`.
- **Application Icon**: Replace `macos/Assets.xcassets/app_icon_*` with your
icon in the appropriate sizes.
## Windows
**Remember that Windows builds are currently debug-only, and should not be
distributed. These instructions are intended for experimentation and feedback
only.**
- **Application Name**: Change `TargetName` in
`windows\AppConfiguration.props`.
- You will likely want to change `kFlutterWindowTitle` in
`windows\window_configuration.cpp` to match. In the future this
will use the application name automatically by default.
- **Application Icon**: Replace `windows\resources\app_icon.ico` with your
icon.
- This will also change the Window icon.
## Linux
**Remember that Linux builds are currently debug-only, and should not be
distributed. These instructions are intended for experimentation and feedback
only.**
- **Window Settings**: `linux/window_configuration.cc` allows changing the
window's initial title and size.
- **Application Icon**: Prepare image data using the method of your choice
(e.g., by loading from a file in a set location; this may require the use
of a third-party library depending on the image format) and call `SetIcon`
on `flutter_controller.window()`. See the `SetIcon` comment in
`flutter_window.h` for the required format. In the future, this will be
made easier to customize.
# Desktop Flutter Example
This is the standard Flutter template application, with desktop platform
directories added.
The `windows` directory is an early version of what will become the
`flutter create` template. The `macos` and `linux` directories already have
become templates, so are almost identical to what that command command creates.
## Building and Running
See [the main project README](../README.md).
To build without running, use `flutter build macos`/`windows`/`linux` rather than `flutter run`, as with
a standard Flutter project.
## Differences from Flutter Template
The `main.dart` and `pubspec.yaml` have been adjusted to explicitly
set the font to Roboto, and to bundle Roboto in the app, to ensure
that text displays on all platforms. Due to recent changes in Flutter,
this should no longer be necessary for most apps.
## Adapting for Another Project
Since `flutter create` is not yet supported for Windows, the easiest
way to run an existing Flutter application on Windows is to copy the `windows`
directory from this example; see below for details.
For macOS or Linux, just run `flutter create .` in your project to add
the platform directory.
### Copying the Desktop Runners
The `windows` directory is self-contained, and can be copied to
an existing Flutter project to enable `flutter run -d windows`.
**Be aware that breaking changes in the Flutter desktop libraries and tooling
are common, and no attempt will be made to provide supported migration paths
as things change.** You should expect that every time you update Flutter you may
have to delete your copy of the `windows` directories and re-copy it from an
updated version of this repository.
### Customizing the Runners
See [Application Customization](App-Customization.md) for premilinary
documenation on modifying basic application information like name and icon.
If you are building for macOS, you should also read about [managing macOS
security configurations](../macOS-Security.md).
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
// See https://github.com/flutter/flutter/wiki/Desktop-shells#fonts
fontFamily: 'Roboto',
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
include app_configuration.mk
# Default build type.
BUILD=debug
FLUTTER_MANAGED_DIR=flutter
FLUTTER_EPHEMERAL_DIR=$(FLUTTER_MANAGED_DIR)/ephemeral
# Configuration provided via flutter tool.
FLUTTER_CONFIG_FILE=$(FLUTTER_EPHEMERAL_DIR)/generated_config.mk
include $(FLUTTER_CONFIG_FILE)
# Dependency locations
FLUTTER_APP_DIR=$(CURDIR)/..
FLUTTER_APP_BUILD_DIR=$(FLUTTER_APP_DIR)/build
OUT_DIR=$(FLUTTER_APP_BUILD_DIR)/linux
OBJ_DIR=$(OUT_DIR)/obj/$(BUILD)
# Libraries
FLUTTER_LIB_NAME=flutter_linux_glfw
FLUTTER_LIB=$(FLUTTER_EPHEMERAL_DIR)/lib$(FLUTTER_LIB_NAME).so
# Tools
FLUTTER_BIN=$(FLUTTER_ROOT)/bin/flutter
LINUX_BUILD=$(FLUTTER_ROOT)/packages/flutter_tools/bin/tool_backend.sh
# Resources
ICU_DATA_NAME=icudtl.dat
ICU_DATA_SOURCE=$(FLUTTER_EPHEMERAL_DIR)/$(ICU_DATA_NAME)
FLUTTER_ASSETS_NAME=flutter_assets
FLUTTER_ASSETS_SOURCE=$(FLUTTER_APP_BUILD_DIR)/$(FLUTTER_ASSETS_NAME)
# Bundle structure
BUNDLE_OUT_DIR=$(OUT_DIR)/$(BUILD)
BUNDLE_DATA_DIR=$(BUNDLE_OUT_DIR)/data
BUNDLE_LIB_DIR=$(BUNDLE_OUT_DIR)/lib
BIN_OUT=$(BUNDLE_OUT_DIR)/$(BINARY_NAME)
ICU_DATA_OUT=$(BUNDLE_DATA_DIR)/$(ICU_DATA_NAME)