Skip to content

Commit

Permalink
remove explicit references to FontWeight since it's an enum and alrea…
Browse files Browse the repository at this point in the history
…dy covered
  • Loading branch information
JanMichaelPeter committed Apr 9, 2024
1 parent e095ea5 commit f49cb6c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion widget_driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ As soon as your `Driver` has new data to display, then you want to call the `not

If you have a method or property which returns a future, then you can use the `@TestDriverDefaultFutureValue({default value})` instead. It will take the default value and return it as a future.

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`, `IconData` and `FontWeight` are already covered. More complex types, like your custom classes, must be covered with annotations in your code. You can also optionally add annotations for any of the public fields, properties or methods with return types that are already covered.
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. More complex types, like your custom classes, must be covered with annotations in your code. You can also optionally add annotations for any of the public fields, properties or methods with return types that are already covered.


```dart
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`, `IconData` and `FontWeight` 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.

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
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class DefaultReturnValueHelper {
"void": "",
"Color": "Colors.black",
"IconData": "const IconData(0)",
"FontWeight": "FontWeight.normal",
};

static bool _hasDefaultValueForTypeName(String typeName) {
Expand Down

0 comments on commit f49cb6c

Please sign in to comment.