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 Theme(
    data: theme,
    child: AnnotatedRegion<SystemUiOverlayStyle>(
      value: overlayStyle,
      child: CNP<DefaultAssetPickerProvider>.value(
        value: provider,
        builder: (BuildContext context, _) => Scaffold(
          backgroundColor: theme.scaffoldBackgroundColor,
          body: Stack(
            fit: StackFit.expand,
            children: <Widget>[
              if (isAppleOS(context))
                appleOSLayout(context)
              else
                androidLayout(context),
              permissionOverlay(context),
            ],
          ),
        ),
      ),
    ),
  );
}