大佬我请教个问题,看了你的provider的封装
nws123045088 opened this issue · 4 comments
nws123045088 commented
这样固定返回一个consumer ,不是就不能局部刷新了吗 是不是粒度太大了
@OverRide
Widget build(BuildContext context) {
return ChangeNotifierProvider.value(
value: model,
child: Consumer(
builder: widget.builder,
child: widget.child,
),
);
}
lhh-sofy commented
同问,翻了很多代码,使用这种方式之后,没有办法进行局部刷新!
phoenixsky commented
是的,所以这里一般用在页面级的加载
iiuws <notifications@github.com>于2020年5月11日 周一20:44写道:
… 这样固定返回一个consumer ,不是就不能局部刷新了吗 是不是粒度太大了
@OverRide <https://github.com/override>
Widget build(BuildContext context) {
return ChangeNotifierProvider.value(
value: model,
child: Consumer(
builder: widget.builder,
child: widget.child,
),
);
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#70>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQQRLX5O53WEYDMDXX4R5TRQ7XJDANCNFSM4M54ARTA>
.
lhh-sofy commented
目前可以结合selector的方法进行局部刷新。
phoenixsky commented
代码里封装了selector的部分,因为使用场景,使用这套封装模版的都是页面级的widget,比如list,整个数据源都变了,所以当前widget肯定要刷新