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,
                  reverse: shouldReversePreview,
                  onPageChanged: (int index) {
                    currentIndex = index;
                    pageStreamController.add(index);
                  },
                  scrollDirection: Axis.horizontal,
                ),
              ),
              if (isWeChatMoment && hasVideo) ...<Widget>[
                momentVideoBackButton(context),
                PositionedDirectional(
                  end: 16,
                  bottom: context.bottomPadding + 16,
                  child: confirmButton(context),
                ),
              ] else ...<Widget>[
                appBar(context),
                if (selectedAssets != null ||
                    (isWeChatMoment && hasVideo && isAppleOS))
                  bottomDetailBuilder(context),
              ],
            ],
          ),
        ),
      ),
    ),
  );
}