dwyl / flutter-todo-list-tutorial

✅ A detailed example/tutorial building a cross-platform Todo List App using Flutter 🦋
GNU General Public License v2.0
96 stars 9 forks source link

Adding code example to the repository #12

Open SimonLab opened 4 years ago

SimonLab commented 4 years ago

The repository currently only contains the README file.

nelsonic commented 4 years ago

Thanks @SimonLab ❤️ If you can help us create something similar to https://github.com/dwyl/phoenix-todo-list-tutorial which takes the person from Zero to Finished fully working App with 100% tests and all the code and commit snapshots it would be amazing. We need to ensure that everyone in our team/community understands everything from first principals. 👍

SimonLab commented 4 years ago

To create a new Flutter project we can use the flutter create command. See also flutter create --help to see the available flags for the command:

Create a new Flutter project.

If run on a project that already exists, this will repair the project, recreating any files that are missing.

Usage: flutter create <output directory>
-h, --help                     Print this usage information.
    --[no-]pub                 Whether to run "flutter pub get" after the project has been created.
                               (defaults to on)
    --[no-]offline             When "flutter pub get" is run by the create command, this indicates whether to run it in offline mode or not. In offline mode, it will need to have all dependencies already
                               available in the pub cache to succeed.
    --[no-]with-driver-test    Also add a flutter_driver dependency and generate a sample 'flutter drive' test.
-t, --template=<type>          Specify the type of project to create.

          [app]                (default) Generate a Flutter application.
          [module]             Generate a project to add a Flutter module to an existing Android or iOS application.
          [package]            Generate a shareable Flutter project containing modular Dart code.
          [plugin]             Generate a shareable Flutter project containing an API in Dart code with a platform-specific implementation for Android, for iOS code, or for both.

-s, --sample=<id>              Specifies the Flutter code sample to use as the main.dart for an application. Implies --template=app. The value should be the sample ID of the desired sample from the API
                               documentation website (http://docs.flutter.dev). An example can be found at https://master-api.flutter.dev/flutter/widgets/SingleChildScrollView-class.html
    --list-samples=<path>      Specifies a JSON output file for a listing of Flutter code samples that can created with --sample.
    --[no-]overwrite           When performing operations, overwrite existing files.
    --description              The description to use for your new Flutter project. This string ends up in the pubspec.yaml file.
                               (defaults to "A new Flutter project.")
    --org                      The organization responsible for your new Flutter project, in reverse domain name notation. This string is used in Java package names and as prefix in the iOS bundle identifier.
                               (defaults to "com.example")
    --project-name             The project name for this new Flutter project. This must be a valid dart package name.
-i, --ios-language             [objc, swift (default)]
-a, --android-language         [java, kotlin (default)]

Run "flutter help" to see global options.

I first created the project with flutter create app which creates the app folder. While adding a ,travis.yml file for running the tests on Travis I noticed that we don't want to create a new folder for the application but instead create the Flutter app along the existing README.md file. We can do this with flutter create --project-name=app . where the flutter app name is passed with the --project-name flag and we specify where to create the project, i.e. the current folder .