builder static method
A builder for MaterialApp.builder that shows the draggable debug button.
MaterialApp(builder: DioDebugLogger.builder());
enabled defaults to false in release builds. If the app already has
a builder, pass it as builder:
MaterialApp(
builder: DioDebugLogger.builder(
builder: (context, child) => MediaQuery(..., child: child!),
),
);
Implementation
static TransitionBuilder builder({
bool enabled = kDebugMode,
TransitionBuilder? builder,
Color? backgroundColor,
Color? foregroundColor,
IconData icon = Icons.bug_report_rounded,
double buttonSize = 56,
bool showBadge = true,
Alignment initialAlignment = Alignment.centerLeft,
bool snapToEdge = true,
}) {
if (enabled) ReleaseGuard.check('The debug button');
return (BuildContext context, Widget? child) {
final content = builder != null ? builder(context, child) : child;
return DebugOverlay(
enabled: enabled,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
icon: icon,
buttonSize: buttonSize,
showBadge: showBadge,
initialAlignment: initialAlignment,
snapToEdge: snapToEdge,
child: content ?? const SizedBox.shrink(),
);
};
}