diff --git a/add_to_app/README.md b/add_to_app/README.md index 39a640d97..f0f601cf9 100644 --- a/add_to_app/README.md +++ b/add_to_app/README.md @@ -1,9 +1,11 @@ -# Add-to-App Sample +# Add-to-App Samples -This directory contains a bunch of Android and iOS projects that each import a -standalone Flutter module. +This directory contains a bunch of Android and iOS projects (beginning +`android_` and `ios_`, respectively) that import and use one of several Flutter +modules (which have names beginning with `flutter_`). They're designed to show +recommended approaches for adding Flutter to existing Android and iOS apps. -## Goals for this sample +## Goals for these samples * Show developers how to add Flutter to their existing applications. * Show the following options: @@ -13,10 +15,41 @@ standalone Flutter module. * Show Flutter being integrated ergonomically with applications with existing middleware and business logic data classes. +## 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_using_plugin + flutter pub get + cd ../flutter_module_books + flutter pub get + cd ../flutter_module + flutter pub get + + # For Android builds: + flutter build aar + + # For iOS builds: + flutter build ios-framework --output=../ios_using_prebuilt_module/Flutter + cd ../ios_fullscreen + pod install + cd ../ios_using_plugin + pod install +``` + +Once those commands have run, you can go into any of the app directories (the +ones beginning `android_` or `ios_`), and build the apps as you normally would. + ## Installing Cocoapods -The iOS samples in this repo require the latest version of Cocoapods. To install -it, run the following command on a macOS machine: +The iOS samples in this repo require the latest version of Cocoapods. To make +sure you've got it, run the following command on a macOS machine: ```bash sudo gem install cocoapods @@ -41,10 +74,9 @@ There are three Flutter modules included in the codebase: interop inside wrapper API and data classes that are shared between the platform and Flutter. - Before using them, you need to resolve the Flutter modules' dependencies. Do so -by running this command from within the `flutter_module` and -`flutter_module_using_plugin` directories: +by running this command from within the `flutter_module`, +`flutter_module_using_plugin`, and `flutter_module_books` directories: ```bash flutter pub get @@ -57,7 +89,7 @@ Android and iOS applications that demonstrate different ways of importing them. With the exception of `android_using_prebuilt_module`, the Android apps are -ready to run once you've completed the `flutter packages get` commands listed +ready to run once you've completed the `flutter pub get` commands listed above. Two of the iOS apps (`ios_fullscreen` and `ios_using_plugin`) use Cocoapods, though, so you need to run this command within their project directories to install their dependencies: @@ -178,7 +210,7 @@ page. requirements. * If the `schema.dart` is modified, the generated classes can be updated with - ```shell + ```bash flutter pub run pigeon \ --input pigeon/schema.dart \ --java_out ../android_books/app/src/main/java/dev/flutter/example/books/Api.java \ diff --git a/add_to_app/android_books/README.md b/add_to_app/android_books/README.md new file mode 100644 index 000000000..5e1dd1339 --- /dev/null +++ b/add_to_app/android_books/README.md @@ -0,0 +1,14 @@ +# android_books + +An example Android application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/android_fullscreen/README.md b/add_to_app/android_fullscreen/README.md new file mode 100644 index 000000000..8e22b36eb --- /dev/null +++ b/add_to_app/android_fullscreen/README.md @@ -0,0 +1,14 @@ +# android_fullscreen + +An example Android application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/android_using_plugin/README.md b/add_to_app/android_using_plugin/README.md new file mode 100644 index 000000000..670a3346d --- /dev/null +++ b/add_to_app/android_using_plugin/README.md @@ -0,0 +1,14 @@ +# android_using_plugin + +An example Android application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/android_using_prebuilt_module/README.md b/add_to_app/android_using_prebuilt_module/README.md new file mode 100644 index 000000000..d03a84c28 --- /dev/null +++ b/add_to_app/android_using_prebuilt_module/README.md @@ -0,0 +1,14 @@ +# android_using_prebuilt_module + +An example Android application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/flutter_module/README.md b/add_to_app/flutter_module/README.md index e8d441328..f46611690 100644 --- a/add_to_app/flutter_module/README.md +++ b/add_to_app/flutter_module/README.md @@ -1,11 +1,14 @@ # flutter_module -An example Flutter module used in the Flutter add-to-app samples. +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. ## Getting Started -For more information, see the Add-to-App guide at -[flutter.dev](https://flutter.dev): +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). -For instructions integrating Flutter modules to your existing applications, -see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app). +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/flutter_module_books/README.md b/add_to_app/flutter_module_books/README.md index 8c9dcc7cf..2aaedcbed 100644 --- a/add_to_app/flutter_module_books/README.md +++ b/add_to_app/flutter_module_books/README.md @@ -1,8 +1,11 @@ # Books add-to-app sample -This application simulates a mock scenario where an existing app with -business logic and middleware already exists. This sample demonstrates how to -do an add-to-app Flutter integration into existing conventions. +This application simulates a mock scenario in which an existing app with +business logic and middleware already exists. It demonstrates how to add Flutter +to an app that has established patterns for these domains. For more information +this and the other add-to-app samples available in this repo, see the +[README](../README.md) file located in the [/add_to_app](/add_to_app) directory +of this repo. This application also utilizes the [Pigeon](https://pub.dev/packages/pigeon) plugin to avoid manual platform channel wiring. Pigeon autogenerates the @@ -29,14 +32,21 @@ flutter pub run pigeon \ * 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. + +## More info + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/flutter_module_using_plugin/README.md b/add_to_app/flutter_module_using_plugin/README.md index 808c90cdd..70fc2c983 100644 --- a/add_to_app/flutter_module_using_plugin/README.md +++ b/add_to_app/flutter_module_using_plugin/README.md @@ -1,12 +1,15 @@ # flutter_module_using_plugin -An example Flutter module that uses a plugin and is consumed by native apps -in the Flutter add-to-app samples. +An example Flutter module that uses a native plugin, intended for use 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. ## Getting Started -For more information, see the Add-to-App guide at -[flutter.dev](https://flutter.dev): +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). -For instructions integrating Flutter modules to your existing applications, -see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app). +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/ios_fullscreen/README.md b/add_to_app/ios_fullscreen/README.md new file mode 100644 index 000000000..e3ff162f9 --- /dev/null +++ b/add_to_app/ios_fullscreen/README.md @@ -0,0 +1,14 @@ +# ios_fullscreen + +An example iOS application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/ios_using_plugin/README.md b/add_to_app/ios_using_plugin/README.md new file mode 100644 index 000000000..2b363eabb --- /dev/null +++ b/add_to_app/ios_using_plugin/README.md @@ -0,0 +1,14 @@ +# ios_using_plugin + +An example iOS application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app). diff --git a/add_to_app/ios_using_prebuilt_module/README.md b/add_to_app/ios_using_prebuilt_module/README.md new file mode 100644 index 000000000..bff7a9cd0 --- /dev/null +++ b/add_to_app/ios_using_prebuilt_module/README.md @@ -0,0 +1,14 @@ +# ios_using_prebuilt_module + +An example iOS application 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. + +## Getting Started + +For more information about Flutter, check out +[flutter.dev](https://flutter.dev). + +For instructions on how to integrate Flutter modules into your existing +applications, see Flutter's +[add-to-app documentation](https://flutter.dev/docs/development/add-to-app).