menuScreenWidget property
Widget
menuScreenWidget
Builds the layers of menuScreen
Implementation
Widget get menuScreenWidget {
// Add layer - GestureDetector
Widget menuScreen = GestureDetector(
behavior: HitTestBehavior.translucent,
// onTap shouldn't be null to avoid loosing state
onTap: _menuScreenTapHandler,
// Full width and hight to make menuScreen behind mainScreen
child: SizedBox.expand(
// Without Align, SizedBox won't work
child: Align(
alignment: widget.isRtl ? Alignment.topRight : Alignment.topLeft,
// By default menuScreen width is calculated based on slideWidth
// Unless user set menuScreenWidth
child: SizedBox(
width: widget.menuScreenWidth ??
widget.slideWidth -
(context.screenWidth / widget.slideWidth) -
50,
child: widget.menuScreen,
),
),
),
);
// Add layer - Transform
if (widget.moveMenuScreen && widget.style != DrawerStyle.style1) {
final left = (1 - _animationValue) * widget.slideWidth * _slideDirection;
menuScreen = Transform.translate(
offset: Offset(-left, 0),
child: menuScreen,
);
}
// Add layer - Overlay color
// Material widget needs to be set after ColorFilter,
// Storing Material widget in variable will make
// ColorFiltered renders only 50% of the width
if (widget.menuScreenOverlayColor != null) {
final overlayColor = ColorTween(
begin: widget.menuScreenOverlayColor,
end: widget.menuScreenOverlayColor!.withOpacity(0.0),
);
menuScreen = ColorFiltered(
colorFilter: ColorFilter.mode(
overlayColor.lerp(_animationValue)!,
widget.overlayBlend,
),
child: ColoredBox(
color: widget.menuBackgroundColor,
child: menuScreen,
),
);
} else {
menuScreen = ColoredBox(
color: widget.menuBackgroundColor,
child: menuScreen,
);
}
return menuScreen;
}