Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the documentation to the new version of the widget_driver_generator #157

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions widget_driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.0.9

* Updates the documentation to the new version of the widget_driver_generator

## 1.0.8

* Adds a new `WidgetDriverTestConfigProvider` which you can use in your widget tests to control if a test driver or a real driver should be used.
Expand Down
2 changes: 1 addition & 1 deletion widget_driver/doc/widget_drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Any type of dependencies which your `driver` needs to be able to give your widge
You get three option here for how to resolve these dependencies. Either you can grab them out of the `BuildContext` (for example if you are using the `Provider` package). Or you can use some DI package like `get_it` and then just grab the dependencies from the DI container. Or you can pass in the dependencies to your driver using the `@driverProvidableProperty` annotation.

**Now what about those annotations?**
They are needed for the `testDrivers` to be generated correctly. So for properties and methods with complex return types which you expose to the widget, you will need to add these annotations. Simple return types like all of [Dart's built-in types](https://dart.dev/language/built-in-types), enums, Optionals and some frequently used types in widgets like `Color` and `IconData` are already covered.
They are needed for the `testDrivers` to be generated correctly. So for properties and methods with complex return types which you expose to the widget, you will need to add these annotations. Simple return types like all of [Dart's built-in types](https://dart.dev/language/built-in-types), enums, Optionals and some frequently used types in widgets like `Color` and `IconData` are already covered with default values (that you still could overwrite if you'd like).

For properties and methods you add `@TestDriverDefaultValue({default_value})`.
The `default_value` should be the default value which you want to use when this widget is being created by other widgets under test.
Expand Down
2 changes: 2 additions & 0 deletions widget_driver/example/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ part 'my_first_drivable_widget_driver.g.dart';
class MyFirstDrivableWidgetDriver extends WidgetDriver {
int _count = 0;

// The next line is not necessary, since it's a String but if you want to customize the generated output, you can add this.
@TestDriverDefaultValue('The app bar title')
String get appBarTitle => 'Intro to WidgetDriver';

String get counterTitle => 'Counter:';
Expand Down
2 changes: 1 addition & 1 deletion widget_driver/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dev_dependencies:
widget_driver_test:
path: ../../widget_driver_test
build_runner:
widget_driver_generator: ^1.0.2
widget_driver_generator: ^1.1.0

flutter:
uses-material-design: true
2 changes: 1 addition & 1 deletion widget_driver/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: widget_driver
description: A Flutter presentation layer framework, which will clean up your widget code and make your widgets testable without a need for thousands of mock objects. Let's go driving!
version: 1.0.8
version: 1.0.9
repository: https://github.com/bmw-tech/widget_driver/tree/master/widget_driver
issue_tracker: https://github.com/bmw-tech/widget_driver/issues

Expand Down
Loading