isActive method

  1. @override
bool isActive(
  1. BuildContext context
)
override

A method that returns true based on conditions related to the context of the screen such as MediaQuery.sizeOf(context).width.

Implementation

@override
bool isActive(BuildContext context) {
  final TargetPlatform host = Theme.of(context).platform;
  final bool isRightPlatform = platform?.contains(host) ?? true;

  // Null boundaries are unbounded, assign the max/min of their associated
  // direction on a number line.
  final double width = MediaQuery.sizeOf(context).width;
  final double lowerBound = begin ?? double.negativeInfinity;
  final double upperBound = end ?? double.infinity;

  return width >= lowerBound && width < upperBound && isRightPlatform;
}