ShadyBoukhary / flutter_clean_architecture

Clean architecture flutter: A Flutter package that makes it easy and intuitive to implement Uncle Bob's Clean Architecture in Flutter. This package provides basic classes that are tuned to work with Flutter and are designed according to the Clean Architecture.
https://pub.dartlang.org/packages/flutter_clean_architecture
MIT License
691 stars 172 forks source link

Cant add AppBar via ControlledWidgetBuilder.builder #67

Closed vadimlukutin closed 3 years ago

vadimlukutin commented 3 years ago

Have error if add App Bar via ControlledWidgetBuilder.builder.

final result = Scaffold(

 appBar: ControlledWidgetBuilder<CategoryGroupListController>(
          builder: (context, controller) {
            return BaseAppBar(title: controller.title);
          },
        ),
        body: columnContainer
    );

Error log:

error: The argument type 'ControlledWidgetBuilder<CategoryGroupListController>' can't be assigned to the parameter type 'PreferredSizeWidget'. (argument_type_not_assignable at [project_name] lib/project_name/fca/app/pages/category/category_group_list/category_group_list_view.dart:62)

Please describe how resolve this problem?

ShadyBoukhary commented 3 years ago

Seems like PreferredSizeWidget should be used as a mixin with ControlledWidget. We don't currently do that. You can inherit from the the ControlledWidgetBuilder and have it return a ControlledWidget that also inherits from PreferedSizeWidget. Feel free to add it to the library via a pull request or maybe @rafaelcmm would be willing to add this. It should be relatively straightforward.

rafaelcmm commented 3 years ago

@vadimlukutin seems to be like: https://github.com/ShadyBoukhary/flutter_clean_architecture/issues/62#issuecomment-788558161

Please take a look and check if this solves your issue.

Feel free to re-open if needed.