dev_tools_screen 0.0.3 copy "dev_tools_screen: ^0.0.3" to clipboard
dev_tools_screen: ^0.0.3 copied to clipboard

A Flutter package that provides a customizable developer tools screen for debugging and testing purposes.

Dev Tools Screen #

A Flutter package for creating a developer tools screen with customizable elements.

Features #

  • 🎛️ DevToolsDropdown - Dropdown selector for switching between options (e.g., API endpoints)
  • 🔘 DevToolsButton - Action button for triggering operations (e.g., opening logger)
  • 🔄 DevToolsSwitch - Toggle switch for feature flags

Installation #

Add this to your package's pubspec.yaml file:

dependencies:
  dev_tools_screen: ^latest_version

Usage #

import 'package:dev_tools_screen/dev_tools.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

class DevTools extends StatelessWidget {
  const DevTools({super.key});

  VoidCallback _openDevTools(BuildContext context) => () {
    DevToolsScreen(
      elements: [
        DevToolsDropdown(
          label: 'Api',
          items: [
            const DropdownMenuItem(
              value: 'Development Api',
              child: Text('Development Api'),
            ),
            const DropdownMenuItem(
              value: 'Stage Api',
              child: Text('Stage Api'),
            ),
            const DropdownMenuItem(
              value: 'Production Api',
              child: Text('Production Api'),
            ),
          ],
          initalElement: 'Development Api',
          onChanged: (value) {
            /// Handle API change
          },
        ),
        DevToolsButton(
          label: 'Open Logger',
          onPressed: () {
            /// Handle logger opening
          },
        ),
        DevToolsSwitch(
          label: 'Premium Mode',
          value: false,
          onChanged: (value) {
            /// Handle switch change
          },
        ),
      ],
    ).view(context);
  };

  @override
  Widget build(BuildContext context) {
    if (kReleaseMode) return const SizedBox.shrink();

    return FloatingActionButton(
      backgroundColor: Colors.black,
      onPressed: _openDevTools(context),
      child: const FittedBox(
        child: Text(
          kProfileMode ? 'STG' : 'DBG',
          style: TextStyle(
            color: Colors.white,
            fontWeight: FontWeight.bold,
            fontSize: 20,
          ),
        ),
      ),
    );
  }
}

Available Elements #

DevToolsDropdown #

Create a dropdown selector for switching between options:

DevToolsDropdown(
  label: 'Api',
  items: [...], // List of DropdownMenuItem
  initalElement: 'Development Api',
  onChanged: (value) {
    // Handle selection change
  },
)

DevToolsButton #

Add an action button:

DevToolsButton(
  label: 'Open Logger',
  onPressed: () {
    // Handle button press
  },
)

DevToolsSwitch #

Add a toggle switch:

DevToolsSwitch(
  label: 'Premium Mode',
  value: false,
  onChanged: (value) {
    // Handle switch toggle
  },
)
1
likes
130
points
41
downloads

Documentation

API reference

Publisher

verified publishercontributors.info

Weekly Downloads

A Flutter package that provides a customizable developer tools screen for debugging and testing purposes.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on dev_tools_screen