Ejemplo n.º 1
0
        public override Widget buildPage(BuildContext context, Animation <float> animation,
                                         Animation <float> secondaryAnimation)
        {
            BottomSheetThemeData sheetTheme = theme?.bottomSheetTheme ?? Theme.of(context).bottomSheetTheme;

            Widget bottomSheet = MediaQuery.removePadding(
                context: context,
                removeTop: true,
                child: new _ModalBottomSheet <T>(
                    route: this,
                    backgroundColor: backgroundColor ?? sheetTheme?.modalBackgroundColor ?? sheetTheme?.backgroundColor,
                    elevation: elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation,
                    shape: shape,
                    clipBehavior: clipBehavior,
                    isScrollControlled: isScrollControlled ?? false,
                    enableDrag: enableDrag
                    )
                );

            if (theme != null)
            {
                bottomSheet = new Theme(data: theme, child: bottomSheet);
            }

            return(bottomSheet);
        }
Ejemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            BottomSheetThemeData bottomSheetTheme = Theme.of(context).bottomSheetTheme;
            Color       color        = widget.backgroundColor ?? bottomSheetTheme?.backgroundColor;
            float       elevation    = widget.elevation ?? bottomSheetTheme?.elevation ?? 0;
            ShapeBorder shape        = widget.shape ?? bottomSheetTheme?.shape;
            Clip        clipBehavior = widget.clipBehavior ?? bottomSheetTheme?.clipBehavior ?? Clip.none;

            Widget bottomSheet = new Material(
                key: _childKey,
                color: color,
                elevation: elevation,
                shape: shape,
                clipBehavior: clipBehavior,
                child: new NotificationListener <DraggableScrollableNotification>(
                    onNotification: extentChanged,
                    child: widget.builder(context)
                    )
                );

            return(!widget.enableDrag
                ? bottomSheet
                : new GestureDetector(
                       onVerticalDragStart: _handleDragStart,
                       onVerticalDragUpdate: _handleDragUpdate,
                       onVerticalDragEnd: _handleDragEnd,
                       child: bottomSheet
                       ));
        }