restructured the add to app samples (#698)
@ -0,0 +1,79 @@
|
||||
# books
|
||||
|
||||
Mimics a real world use-case of embedding Flutter into an existing Android app
|
||||
and demonstrates using [Pigeon](https://pub.dev/packages/pigeon) to communicate
|
||||
between Fluter and the host application.
|
||||
|
||||
## Description
|
||||
|
||||
These apps integrate the `flutter_books` module using the simpler build-together
|
||||
project setup. They simulate a mock scenario where an existing book catalog
|
||||
list app already exists. Flutter is used to implement an additional book details
|
||||
page.
|
||||
|
||||
* Similar to [`fullscreen`](../fullscreen).
|
||||
* An existing books catalog app is already implemented in Kotlin and Swift.
|
||||
* The platform-side app has existing middleware constraints that should also
|
||||
be the middleware foundation for the additional Flutter screen.
|
||||
* On Android, the Kotlin app already uses GSON and OkHttp for networking and
|
||||
references the Google Books API as a data source. These same libraries also
|
||||
underpin the data fetched and shown in the Flutter screen.
|
||||
* iOS TODO.
|
||||
* The platform application interfaces with the Flutter book details page using
|
||||
idiomatic platform API conventions rather than Flutter conventions.
|
||||
* On Android, the Flutter activity receives the book to show via activity
|
||||
intent and returns the edited book by setting the result intent on the
|
||||
activity. No Flutter concepts are leaked into the consumer activity.
|
||||
* iOS TODO.
|
||||
* The [pigeon](https://pub.dev/packages/pigeon) plugin is used to generate
|
||||
interop APIs and data classes. The same `Book` model class is used within the
|
||||
Kotlin/Swift program, the Dart program and in the interop between Kotlin/Swift
|
||||
and Dart. No manual platform channel plumbing needed for interop.
|
||||
* The `api.dart/java/mm` files generated from the
|
||||
`flutter_module_books/pigeon/schema.dart` file are checked into source
|
||||
control. Therefore `pigeon` is only a dev dependency with no runtime
|
||||
requirements.
|
||||
* If the `schema.dart` is modified, the generated classes can be updated with
|
||||
|
||||
```bash
|
||||
flutter pub run pigeon \
|
||||
--input pigeon/schema.dart \
|
||||
--java_out ../android_books/app/src/main/java/dev/flutter/example/books/Api.java \
|
||||
--java_package "dev.flutter.example.books"
|
||||
```
|
||||
|
||||
in the `flutter_module_books` directory.
|
||||
|
||||
Once you've understood the basics of add-to-app with `android_fullscreen` and
|
||||
`ios_fullscreen`, this is a good sample to demonstrate how to integrate Flutter
|
||||
in a slightly more realistic setting with existing business logic.
|
||||
|
||||
## tl;dr
|
||||
|
||||
If you're just looking to get up and running quickly, these bash commands will
|
||||
fetch packages and set up dependencies (note that the above commands assume
|
||||
you're building for both iOS and Android, with both toolchains installed):
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd flutter_module_books/
|
||||
flutter pub get
|
||||
|
||||
# For Android builds:
|
||||
open -a "Android Studio" ../android_books # macOS only
|
||||
# Or open the ../android_books folder in Android Studio for other platforms.
|
||||
|
||||
# For iOS builds:
|
||||
# TODO iOS sample
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
* Flutter
|
||||
* Android Studio
|
||||
|
||||
## Questions/issues
|
||||
|
||||
See [add_to_app/README.md](../README.md) for further help.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,54 @@
|
||||
# fullscreen
|
||||
|
||||
Embeds a full screen instance of Flutter into an existing iOS or Android app.
|
||||
|
||||
## Description
|
||||
|
||||
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.
|
||||
|
||||
## tl;dr
|
||||
|
||||
If you're just looking to get up and running quickly, these bash commands will
|
||||
fetch packages and set up dependencies (note that the above commands assume
|
||||
you're building for both iOS and Android, with both toolchains installed):
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd flutter_module/
|
||||
flutter pub get
|
||||
|
||||
# For Android builds:
|
||||
open -a "Android Studio" ../android_fullscreen # macOS only
|
||||
# Or open the ../android_fullscreen folder in Android Studio for other platforms.
|
||||
|
||||
# For iOS builds:
|
||||
cd ../ios_fullscreen
|
||||
pod install
|
||||
open IOSFullScreen.xcworkspace
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
* Flutter
|
||||
* Android
|
||||
* Android Studio
|
||||
* iOS
|
||||
* Xcode
|
||||
* Cocoapods
|
||||
|
||||
## Questions/issues
|
||||
|
||||
See [add_to_app/README.md](../README.md) for further help.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -1,8 +1,8 @@
|
||||
# flutter_module
|
||||
|
||||
An example Flutter module used in the Flutter add-to-app samples. For more
|
||||
information on how to use it, see the [README](../README.md) file located in the
|
||||
[/add_to_app](/add_to_app) directory of this repo.
|
||||
information on how to use it, see the [README.md](../README.md) parent
|
||||
directory.
|
||||
|
||||
## Getting Started
|
||||
|