build method

  1. @override
Widget build(
  1. BuildContext context
)
override

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

Implementation

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