build method
Subclasses should override this function to actually call the appropriate
build
function (e.g., StatelessWidget.build or State.build) for
their widget.
Implementation
@override
Widget build() {
// 使用 Builder 确保获取到正确的 BuildContext
return consumer.buildProviderTree(
Builder(
builder: (context) {
consumer.updateContext(context);
return super.build();
},
),
);
}