From f2143eaa616d7c665221834c8eae83fa86a8da29 Mon Sep 17 00:00:00 2001 From: Mike Rydstrom Date: Sun, 31 Jan 2021 04:42:04 +0200 Subject: [PATCH] Release 1.4.1 --- .github/workflows/build.yml | 7 +- .github/workflows/build.yml.old-with-sep-jobs | 90 ------------------- .github/workflows/deploy.yml | 4 +- .github/workflows/test.yml | 15 ++++ CHANGELOG.md | 15 ++-- README.md | 12 +-- example/lib/example4/main.dart | 2 +- example/lib/example5/main.dart | 27 +++--- example/lib/shared/subpage.dart | 8 +- example/pubspec.lock | 2 +- example/pubspec.yaml | 3 +- 11 files changed, 56 insertions(+), 129 deletions(-) delete mode 100644 .github/workflows/build.yml.old-with-sep-jobs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c27db188..84b2ebd32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,8 @@ # - Show outdated packages, just added for info. # - Verify that dart format is used by all committed code, fails if not. Controversial but pub.dev penalizes you if # dart format is not used. -# - Run all tests. +# - Run all tests with coverage. +# - Upload code coverage output to Codecov for analysis. # - Install linux rpl tool. It is used to automate the needed change of a line in index.html. # - Build 5 different WEB example apps using FlexColorScheme. All examples use these steps: # - Flutter clean. @@ -20,8 +21,8 @@ # but runs on release, when it is published, created or edited. # # TODO Maybe set this workflow up to also run on a weekly schedule to check that nothing is broken? -# Also planning to setup another matrix test run, but this one is also a nice test -# since it does not just runs tests, but also builds actual Web apps using the package. +# Also planning to setup a matrix test run, but this one is anyway a nice test +# since it does not just runs tests, it also builds actual Web apps using the package. # name: Build Web on: diff --git a/.github/workflows/build.yml.old-with-sep-jobs b/.github/workflows/build.yml.old-with-sep-jobs deleted file mode 100644 index 2fa234294..000000000 --- a/.github/workflows/build.yml.old-with-sep-jobs +++ /dev/null @@ -1,90 +0,0 @@ -name: Build Web -on: - pull_request: - branches: [ master ] -jobs: - flutter_tests: - name: Run Flutter analyze and tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install Flutter and Dart SDK - uses: subosito/flutter-action@v1.4.0 - with: - channel: dev - - name: Show Dart SDK version - run: dart --version - - - name: Show Flutter SDK version - run: flutter --version - - - name: Flutter Enable Web - run: flutter config --enable-web - - - name: Install Flutter package dependencies - run: flutter pub get - - - name: Analyze Dart source with fatal-infos, fail if fatal-infos - run: dart analyze --fatal-infos - - - name: Verify that Dart formatting is used, fail if not - run: dart format --output=none --set-exit-if-changed . - - - name: Test package FlexColorScheme with test coverage - run: flutter test - - build_web: - name: Build Flutter Web Example 2 - needs: [flutter_tests] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install Flutter and Dart SDK - uses: subosito/flutter-action@v1.4.0 - with: - channel: "dev" - - name: Show Dart SDK version - run: dart --version - - - name: Show Flutter SDK version - run: flutter --version - - - name: Flutter Enable Web - run: flutter config --enable-web - - - name: Install Flutter package dependencies - run: flutter pub get - - - name: Install repl - run: sudo apt-get install rpl - - - name: Build Web Example 2 with CanvasKit - run: cd example && flutter build web --web-renderer canvaskit --release lib/example2/main.dart - - - name: List files (dir) - run: ls example - - - name: Show content of index.html BEFORE rpl fix href URL - run: cat example/build/web/index.html - - - name: Fix href URL reference before publish - run: rpl '' '' example/build/web/index.html - - - name: Show content of index.html AFTER rpl fix href URL - run: cat example/build/web/index.html - - - name: Push built Web Example-2 to GitHub Pages repository, site is published on commit. - uses: dmnemec/copy_file_to_another_repo_action@v1.0.4 - env: - API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} - with: - source_file: 'example/build/web/.' - destination_folder: 'flexcolorscheme2' - destination_repo: 'rydmike/rydmike.github.io' - user_email: 'm.rydstrom@gmail.com' - user_name: 'rydmike' - # The commit message is not supported on version 1.0.4, need new release for that. - # commit_message: 'Update FlexColorScheme live Web example2' - - - diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b9559f61c..9857dcf27 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,4 @@ # This GitHub action runs on a release, when it is published, created or edited. -# TODO: Test how this trigger works in practice! # # - Installs dart and flutter # - Uses flutter dev channel for now, will change to stable when web supported on stable. @@ -11,7 +10,8 @@ # - Show outdated packages, just added for info. # - Verify that dart format is used by all committed code, fails if not. Controversial but pub.dev penalizes you if # dart format is not used. -# - Run all tests. +# - Run all tests with coverage. +# - Upload code coverage output to Codecov for analysis. # - Install linux rpl tool. It is used to automate the needed change of a line in index.html. # - Build 5 different WEB example apps using FlexColorScheme. All examples use these steps: # - Flutter clean. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4137928dd..a62478ec1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,15 @@ +# This GitHub action runs on push to master, it: +# +# - Installs dart and flutter +# - Uses flutter stable channel for now, might setup a matrix later with beta and dev included too. +# - Gets package dependencies +# - Runs dart analyze, allows deprecation warnings, we on purpose allow use of deprecated features for now. +# - Show outdated packages, just added for info. +# - Verify that dart format is used by all committed code, fails if not. Controversial but pub.dev penalizes you if +# dart format is not used. +# - Run all tests with coverage. +# - Upload code coverage output to Codecov for analysis. +# name: Test on: push: @@ -23,6 +35,9 @@ jobs: - name: Analyze Dart source run: dart analyze + - name: Show outdated packges + run: flutter pub outdated + - name: Verify that Dart formatting is used, fail if not run: dart format --output=none --set-exit-if-changed . diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d5813579..bc89ff9d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to the **FlexColorScheme** package will be documented in this file. -## [1.4.1] - January 30, 2021 +## [1.4.1] - January 31, 2021 * Added four new built-in color schemes. * **Barossa** - Barossa red and cardin green theme. @@ -15,8 +15,9 @@ All notable changes to the **FlexColorScheme** package will be documented in thi Use enum value `FlexScheme.damask` for easy access to it. * Improved Semantics for the ThemeMode Widget buttons. -* Improved the widget tests, makes and checks for system mode changes. Totally 723 tests, codecov > 99.5%. -* Added GitHub actions to automate build and publish the examples on the web. +* Improved FlexThemeModeSwitch widget tests, makes and checks for system mode changes. +* More tests, totally 723 tests, codecov is now > 99.5%. +* Added GitHub actions to automate build and to publish the examples on the Web on a new release. * Minor changes to the examples. Modified to not need the `late` keyword when they are converted to null safe versions. * **Documentation:** @@ -207,7 +208,7 @@ Feel free to open a [suggestion or issue](https://github.com/rydmike/flex_color_ - Version 1.4.0: Increased unit and widget test to 689 tests. All color definitions are now also tested to ensure they will not be changed by any accidental edit. Test coverage is higher than 95%, certainly sufficient for this type of package, but there are still some areas that could and will be improved. -- Version 1.4.1 Consider testing sufficient for now. +- Version 1.4.1 More tests, tests are now considered sufficient for current features. - Version 1.4.1 Added automated build and publish pipes for the Web examples! ### MAYBE @@ -223,10 +224,10 @@ Feel free to open a [suggestion or issue](https://github.com/rydmike/flex_color_ `FlexColorScheme` to be functionally on a level similar to `ColorScheme`, and therefore it should not cover serialization of itself. Serialization have to deal with a lot of potential failure points that I think should not have to be a concern in this type of component. I am not planning to add it, not yet at least, I might - reconsider it later. + reconsider this later. - My recommendation for saving the state of a `FlexColorScheme`. Include values for its settings that you - use in your implementation, in other models in your application, like an "AppSettings" model or similar. + My recommendation for saving the state of a `FlexColorScheme` is to include values for its settings that you + use in your implementation in other models in your application, like an "AppSettings" model or similar. You probably serialize and store such data already, perhaps with shared preferences, hive, get_storage or some other solution. Include the values you need for your `FlexColorScheme` implementation in your stored settings and then use those values to restore your `FlexColorScheme` configuration and theme. This way, your implementation diff --git a/README.md b/README.md index 3fbaa658f..38a9eb974 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ color branding on surfaces. The created themes are based on the same concept as Flutter's ColorScheme based themes, but with a few interesting twists and convenience features. -For some additional information about **FlexColorScheme**, its background and use cases, this package companion +For some additional information about **FlexColorScheme**, its background and use cases, the package companion [**blog post and article**](https://rydmike.com/colorscheme) is also recommended reading. ColorScheme Intro @@ -242,7 +242,7 @@ to using FlexColorScheme and is really only there to better demonstrate the resu > **NOTE:** -> Version 1.4.0 introduces the easier and less verbose `scheme` convenience factory property used above. +> Version 1.4.0 introduced the easier and less verbose `scheme` convenience factory property used above. > You can use it instead of `colors` if all you want to do is just use one of the built-in color schemes. > The previous way of > using `colors` with the `FlexColor.schemes` **map**, with the `FlexScheme` enum values as keys, works as before @@ -306,9 +306,9 @@ With them you can see the active theme's colors, and the created theme's impact ColorScheme example 1 lightColorScheme example 1 lightbColorScheme example 1 dark -The default sample app, example 1, just shows the simplest use-case of FlexColorScheme and barely scratches the -surface of what it can do. To get the full details in a step by step progression you should go through the tutorial -that uses examples 1 through 5 to introduce more features in a step by step complexity progression. +The default sample app, example 1, shows the simplest use-case of FlexColorScheme and barely scratches the +surface of what it can do. To get the full details in a step by step progression, go through the tutorial +that uses examples 1 through 5, to introduce more features in a step by step complexity progression. > **Building the examples** >If you cloned the repository to build the examples, you can open the package `/example` folder with your IDE to build @@ -434,7 +434,7 @@ widget shows the theme with several common Material widgets. This example is basically a repeat of the Flutter default counter app modification earlier, but with a different `HomePage` and a way to change the `MaterialApp` active `themeMode` property value via the `FlexThemeModeSwitch` -switch on the `HomePage`, using a basic value changed callback function. +switch on the `HomePage`, using a normal value changed callback function. ```dart void main() => runApp(const DemoApp()); diff --git a/example/lib/example4/main.dart b/example/lib/example4/main.dart index 8a17f7cd4..0775fe7cf 100644 --- a/example/lib/example4/main.dart +++ b/example/lib/example4/main.dart @@ -281,7 +281,7 @@ class HomePage extends StatelessWidget { EdgeInsets.symmetric(horizontal: AppConst.edgePadding), child: ShowThemeColors(), ), - const Divider(), + const SizedBox(height: 8), // Open a sub-page ListTile( title: const Text('Open a demo subpage'), diff --git a/example/lib/example5/main.dart b/example/lib/example5/main.dart index fc2e470ef..1fcf22b32 100644 --- a/example/lib/example5/main.dart +++ b/example/lib/example5/main.dart @@ -750,6 +750,20 @@ class _HomePageState extends State { child: ShowThemeColors(), ), const SizedBox(height: 8), + // Open a sub-page + ListTile( + title: const Text('Open a demo subpage'), + subtitle: const Text( + 'The subpage will use the same ' + 'color scheme based theme automatically.', + ), + trailing: const Icon(Icons.chevron_right, size: 34), + onTap: () { + Subpage.show(context); + }, + ), + const Divider(), + // const SizedBox(height: 8), SwitchListTile.adaptive( title: const Text('Compute dark theme'), subtitle: const Text( @@ -925,19 +939,6 @@ class _HomePageState extends State { onChanged: widget.onUseToThemeChanged, ), const Divider(), - // Open a sub-page - ListTile( - title: const Text('Open a demo subpage'), - subtitle: const Text( - 'The subpage will use the same ' - 'color scheme based theme automatically.', - ), - trailing: const Icon(Icons.chevron_right, size: 34), - onTap: () { - Subpage.show(context); - }, - ), - const Divider(), Text('Menu', style: headline4), const Text( 'The menu is a just a demo to make a larger ' diff --git a/example/lib/shared/subpage.dart b/example/lib/shared/subpage.dart index 9685c68b7..e40bd74a1 100644 --- a/example/lib/shared/subpage.dart +++ b/example/lib/shared/subpage.dart @@ -46,10 +46,10 @@ class _SubpageState extends State { actions: const [AboutIconButton()], bottom: const TabBar( tabs: [ - Tab(icon: Icon(Icons.home), text: 'Home'), - Tab(icon: Icon(Icons.star), text: 'Favorites'), - Tab(icon: Icon(Icons.face), text: 'Profile'), - Tab(icon: Icon(Icons.settings), text: 'Settings'), + Tab(text: 'Home'), + Tab(text: 'Favorites'), + Tab(text: 'Profile'), + Tab(text: 'Settings'), ], ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index d82a232c5..b81eb358f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -219,4 +219,4 @@ packages: version: "2.1.0-nullsafety.5" sdks: dart: ">=2.12.0-0.0 <3.0.0" - flutter: ">=1.22.0 <2.0.0" + flutter: ">=1.22.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 2a1ba7b80..c2d0240a5 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -11,8 +11,7 @@ dependencies: cupertino_icons: ^1.0.0 # Color scheme package (by Mike Rydstrom, rydmike.com). - flex_color_scheme: - path: ../ + flex_color_scheme: any # The Flutter SDK (by Google flutter.dev). flutter: