FilledStacks / FilledStacks/flutter-tutorials

architecture same issues

Open
#112 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
4.8k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Thank you for your valuable advice on the architecture。

I'm looking at your code, there are still many things I can't understand. Need to ask you。

```
return BaseWidget(
viewModel: HomeViewModel(),
onModelReady: (model) => model.initialise(),
child: ScreenTypeLayout(
mobile: OrientationLayout(
//ioc view
portrait: (context) => HomeMobilePortrait(),
landscape: (context) => HomeMobileLandscape(),
),
tablet: HomeViewTablet(),
),
);

```
BaseWidget need provider ViewModel type . why not create instance according to this ViewModel type ? like java invoke.

```
abstract class BaseModelWidget extends Widget {
@protected
Widget build(BuildContext context, T model);

@override
DataProviderElement createElement() => DataProviderElement(this);
}

//
class DataProviderElement extends ComponentElement {
DataProviderElement(BaseModelWidget widget) : super(widget);

@override
BaseModelWidget get widget => super.widget;

@override
Widget build() => widget.build(this, Provider.of(this));

@override
void update(BaseModelWidget newWidget) {
super.update(newWidget);
assert(widget == newWidget);
rebuild();
}
}

```
BaseModelWidget Does it really have a meaning, more often, I think it just comes from provider .

Sometimes, I get confused by its name, whether this is a widget or a viewmodel or even a model .

Please forgive me, this bad English

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.