execute method
Implementation
@override
FutureOr<void> execute(BuildContext context,
{Map<String, dynamic>? arguments}) {
final scaffoldState = Scaffold.maybeOf(context);
if (scaffoldState == null) {
vyuh.log?.d('DrawerAction requires a Scaffold ancestor');
return null;
}
if (isEndDrawer == false && scaffoldState.hasDrawer == false) {
vyuh.log
?.d('DrawerAction requires an drawer to be present in your Scaffold');
return null;
}
if (isEndDrawer && scaffoldState.hasEndDrawer == false) {
vyuh.log?.d(
'DrawerAction requires an endDrawer to be present in your Scaffold');
return null;
}
switch (actionType) {
case DrawerActionType.open:
if (isEndDrawer) {
scaffoldState.openEndDrawer();
} else {
scaffoldState.openDrawer();
}
break;
case DrawerActionType.close:
if (isEndDrawer) {
scaffoldState.openEndDrawer();
} else {
scaffoldState.openDrawer();
}
break;
}
}