open static method

Future<void> open(
  1. BuildContext context, {
  2. DbLensConfig? config,
  3. DbLensThemeData? theme,
})

Open the built-in DbLens panel. Tidak berjalan di release build.

Implementation

static Future<void> open(
  BuildContext context, {
  DbLensConfig? config,
  DbLensThemeData? theme,
}) async {
  if (kReleaseMode) return;

  final panelConfig = config ?? const DbLensConfig();
  final panelTheme = DbLensTheme(theme);

  switch (panelConfig.presentationMode) {
    case DbLensPresentationMode.fullPage:
      await Navigator.of(context).push(
        MaterialPageRoute(
          fullscreenDialog: panelConfig.fullscreenDialog,
          builder: (_) => DbLensThemeScope(
            theme: panelTheme,
            child: Scaffold(
              backgroundColor: Colors.transparent,
              body: DbLensPanel(config: panelConfig),
            ),
          ),
        ),
      );
      return;
    case DbLensPresentationMode.bottomSheet:
      await showModalBottomSheet(
        context: context,
        isScrollControlled: true,
        backgroundColor: Colors.transparent,
        barrierColor: Colors.black54,
        enableDrag: false,
        useSafeArea: true,
        builder: (_) => DbLensThemeScope(
          theme: panelTheme,
          child: DbLensPanel(config: panelConfig),
        ),
      );
      return;
  }
}