buildModalBarrier method
Build the barrier for this ModalRoute, subclasses can override this method to create their own barrier with customized features such as color or accessibility focus size.
See also:
- ModalBarrier, which is typically used to build a barrier.
- ModalBottomSheetRoute, which overrides this method to build a customized barrier.
Implementation
@override
Widget buildModalBarrier() {
final barrier = ModalBarrier(
dismissible: barrierDismissible,
semanticsLabel: barrierLabel,
barrierSemanticsDismissible: semanticsDismissible,
onDismiss: onBarrierDismiss,
);
final barrierColor = this.barrierColor;
if (offstage || barrierColor == null) {
return barrier;
}
return LiquidGlassVeil(
color: _spring.drive(
ColorTween(begin: barrierColor.withValues(alpha: 0), end: barrierColor),
),
child: barrier,
);
}