build method

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

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

Implementation

@override
Widget build(BuildContext context) {
  return WillPopScope(
    onWillPop: syncSelectedAssetsWhenPop,
    child: Theme(
      data: themeData,
      child: AnnotatedRegion<SystemUiOverlayStyle>(
        value: themeData.appBarTheme.systemOverlayStyle ??
            (themeData.effectiveBrightness.isDark
                ? SystemUiOverlayStyle.light
                : SystemUiOverlayStyle.dark),
        child: Material(
          color: Colors.black,
          child: Stack(
            children: <Widget>[
              Positioned.fill(
                child: ExtendedImageGesturePageView.builder(
                  physics: previewAssets.length == 1
                      ? const CustomClampingScrollPhysics()
                      : const CustomBouncingScrollPhysics(),
                  controller: pageController,
                  itemCount: previewAssets.length,
                  itemBuilder: assetPageBuilder,
                  onPageChanged: (int index) {
                    currentIndex = index;
                    pageStreamController.add(index);
                  },
                  scrollDirection: Axis.horizontal,
                ),
              ),
              appBar(context),
              if (selectedAssets != null ||
                  (isAppleOS && isWeChatMoment && hasVideo))
                bottomDetailBuilder(context),
            ],
          ),
        ),
      ),
    ),
  );
}