build method

Widget build(
  1. BuildContext context
)

Yes, the build method. 没错,是它是它就是它,我们亲爱的 build 方法~

Implementation

Widget build(BuildContext context) {
  // Schedule the scroll position's restoration callback if this feature
  // is enabled and offsets are different.
  if (keepScrollOffset && Constants.scrollPosition != null) {
    SchedulerBinding.instance!.addPostFrameCallback((_) {
      // Update only if the controller has clients.
      if (gridScrollController.hasClients) {
        gridScrollController.jumpTo(Constants.scrollPosition!.pixels);
      }
    });
  }
  return AnnotatedRegion<SystemUiOverlayStyle>(
    value: overlayStyle,
    child: Theme(
      data: theme,
      child: ChangeNotifierProvider<AssetPickerProvider<Asset, Path>>.value(
        value: provider,
        builder: (BuildContext c, __) => Material(
          color: theme.canvasColor,
          child: Stack(
            fit: StackFit.expand,
            children: <Widget>[
              if (isAppleOS) appleOSLayout(c) else androidLayout(c),
              if (Platform.isIOS) iOSPermissionOverlay(c),
            ],
          ),
        ),
      ),
    ),
  );
}