Skip to content
Open
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class StackedHookViewExample extends StackedView<HomeViewModel> {
const StackedHookViewExample({Key key}) : super(key: key);

@override
Widget builder(BuildContext context, HomeViewModel model, Widget? child) {
Widget builder(BuildContext context, HomeViewModel viewModel, Widget? child) {
return Scaffold(
body: Center(child: _HookForm()),
);
Expand Down
8 changes: 5 additions & 3 deletions example/lib/app/app.locator.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 64 additions & 7 deletions example/lib/app/app.router.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class WithStackedHookView extends StackedView<WithStackedHookViewModel> {

class _HookForm extends StackedHookView<WithStackedHookViewModel> {
@override
Widget builder(BuildContext context, WithStackedHookViewModel model) {
Widget builder(BuildContext context, WithStackedHookViewModel viewModel) {
final title = useTextEditingController();
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Title: ${model.title}'),
TextField(controller: title, onChanged: model.updateTitle)
Text('Title: ${viewModel.title}'),
TextField(controller: title, onChanged: viewModel.updateTitle)
],
);
}
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ dev_dependencies:
# rules and activating additional ones.
flutter_lints: ^1.0.0
build_runner: ^2.2.0

stacked_generator: ^0.8.1
stacked_generator:
mockito: ^5.1.0

# For information on the generic Dart part of this file, see the
Expand Down
3 changes: 1 addition & 2 deletions example/test/helpers/test_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ MockBottomSheetService getAndRegisterBottomSheetService<T>({
customData: anyNamed('customData'),
data: anyNamed('data'),
description: anyNamed('description'),
)).thenAnswer((realInvocation) =>
Future.value(showCustomSheetResponse ?? SheetResponse<T>()));
)).thenAnswer((realInvocation) => Future.value(showCustomSheetResponse ?? SheetResponse<T>()));

locator.registerSingleton<BottomSheetService>(service);
return service;
Expand Down
9 changes: 6 additions & 3 deletions example/test/helpers/test_helpers.mocks.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Mocks generated by Mockito 5.3.2 from annotations
// Mocks generated by Mockito 5.4.2 from annotations
// in stacked_hooks_example/test/helpers/test_helpers.dart.
// Do not manually edit this file.

Expand Down Expand Up @@ -495,8 +495,7 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
_i3.BuildContext,
_i2.DialogRequest<dynamic>,
dynamic Function(_i2.DialogResponse<dynamic>),
)?
builder,
)? builder,
}) =>
super.noSuchMethod(
Invocation.method(
Expand Down Expand Up @@ -591,7 +590,9 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
String? title,
String? description,
String? cancelTitle = r'Cancel',
_i5.Color? cancelTitleColor,
String? confirmationTitle = r'Ok',
_i5.Color? confirmationTitleColor,
bool? barrierDismissible = false,
_i2.DialogPlatform? dialogPlatform,
}) =>
Expand All @@ -603,7 +604,9 @@ class MockDialogService extends _i1.Mock implements _i2.DialogService {
#title: title,
#description: description,
#cancelTitle: cancelTitle,
#cancelTitleColor: cancelTitleColor,
#confirmationTitle: confirmationTitle,
#confirmationTitleColor: confirmationTitleColor,
#barrierDismissible: barrierDismissible,
#dialogPlatform: dialogPlatform,
},
Expand Down
2 changes: 1 addition & 1 deletion lib/src/_stacked_hook_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class StackedHookView<T> extends HookWidget {
Provider.of<T>(context, listen: reactive),
);

Widget builder(BuildContext context, T model);
Widget builder(BuildContext context, T viewModel);
}

@Deprecated(
Expand Down