1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-11 15:28:44 +00:00

Adds new flutter module, reconfigures Android/iOS sample (#144)

This commit is contained in:
Andrew Brogdon
2019-09-19 11:12:58 -07:00
committed by GitHub
parent 0f3721f696
commit 22ca7f462b
77 changed files with 1674 additions and 1076 deletions

View File

@@ -5,7 +5,7 @@ and the latest version of CocoaPods. See the [README](../README.md) in the
`experimental` directory for details.***
This directory contains a bunch of Android and iOS projects that each import
a standalone Flutter module called `example_module`.
a standalone Flutter module called `flutter_module`.
## Goals for this sample
@@ -13,42 +13,63 @@ a standalone Flutter module called `example_module`.
## The important bits
### `example_module`
### Flutter modules
This is the Flutter module that'll be added to all the individual projects
in the `add_to_app` folder.
There are two Flutter modules included in the codebase:
The first time you download this repo, you need to first resolve this
module's dependencies by running:
* `flutter_module` displays the dimensions of the screen, a button that
increments a simple counter, and an optional exit button.
* `flutter_module_using_plugin` does everything `flutter_module` does, and adds
another button that will save the counter's value to a file using the
[`path_provider`](https://pub.dev/packages/path_povider) Flutter plugin.
Before running any of the Android or iOS apps included in this sample project,
you first need to resolve the Flutter modules' depencies. Do so by running this
command from within the `flutter_module` and `flutter_module_using_plugin`
directories:
```bash
cd example_module
flutter packages get
```
### `SimpleAndroidApp`
### Android and iOS applications
An Android application that imports `example_module` and uses it to display
a `FlutterActivity` containing widgets from the module. This project brings
in the Flutter module's Android host wrapper as a gradle sub-module.
In addition to the Flutter modules, this repo also includes a number of
Android and iOS applications that demonstrate different ways of importing
them.
To run, open the SimpleAndroidApp folder in Android Studio and press the run
button.
The Android apps are ready to run once you've completed the
`flutter packages get` commands listed above. The iOS apps use CocoaPods,
so you need to run this command to install the dependencies listed in their
Podfiles prior to running them the first time.
### `SimpleIOSExample`
An iOS application that imports `example_module` and uses it to display
a `FlutterViewController` containing widgets from the module. This project
uses CocoaPods, so prior to running it for the first time, use this command
to set up the workspace file:
This should be done in the individual project directories themselves. For
example, prior to running `ios_fullscreen` for the first time, you need to run
these commands:
```bash
cd ../SimpleIOSExample
cd ios_fullscreen
pod install
```
Then open SimpleIOSExample/SimpleIOSExample.xcworkspace with Xcode. This
workspace will have the Flutter module linked in as a dependent CocoaPod.
Once that command is complete, you'll find an `xcworkspace` file in the project
directories with the correct Flutter module (and any other dependencies)
included. Open that workspace file, and the app is ready to build and run.
### `android_fullscreen` and `ios_fullscreen`
These apps showcase a relatively straightforward integration of
`flutter_module`:
* The Flutter module is built along with the app when the app is built.
* The Flutter engine is warmed up at app launch.
* The Flutter view is presented with a full-screen Activity or
UIViewController.
* The Flutter view is a navigational leaf node; it does not launch any new,
native Activities or UIViewControllers in response to user actions.
If you are new to Flutter's add-to-app APIs, these projects are a great place
to begin learning how to use them.
## Questions/issues