Skip to content

Repository files navigation

Flutter Inspector

Flutter Dart Version License

A universal Flutter UI/UX inspector tool for runtime debugging
Inspect any UI element like Chrome DevTools - shows details on mobile screen and terminal


Features

Feature Description
πŸ” Runtime Inspection Inspect any UI element at runtime
πŸ“± Mobile Screen Details See element properties directly on your phone
πŸ’» Terminal Output Structured logging via dart:developer
πŸ”’ Debug Only Only active in debug mode, no trace in release
🎨 Customizable Theme Light and dark themes available
πŸ”§ Configurable Enable/disable logging, button, etc.
πŸ–±οΈ Draggable Button Move inspector button anywhere on screen
🎯 Real-time Hover Element highlights as you move your finger

Quick Start

1. Add Dependency

# pubspec.yaml
dependencies:
  flutter_inspector:
    path: /path/to/flutter_inspector

2. Run pub get

flutter pub get

3. Wrap Your App

import 'package:flutter_inspector/flutter_inspector.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FlutterInspector(
      child: MaterialApp(
        home: YourApp(),
      ),
    );
  }
}

4. Run Your App

flutter run

That's it! Inspector button will appear automatically in debug mode.


How It Works

Debug Mode

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your App Content                   β”‚
β”‚                                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Inspector Button (πŸ”)      β”‚    β”‚
β”‚  β”‚  - Draggable                β”‚    β”‚
β”‚  β”‚  - Tap to activate          β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                     β”‚
β”‚  When activated:                    β”‚
β”‚  - Move finger to hover elements    β”‚
β”‚  - See tooltip with element name    β”‚
β”‚  - Tap to select and see details    β”‚
β”‚                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Release Mode

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Your App Content                   β”‚
β”‚                                     β”‚
β”‚  (No inspector, no button, no code) β”‚
β”‚                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Terminal Output

When you inspect an element, you'll see:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ πŸ” Flutter Inspector - Element Details                 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Widget:    Container
β”‚ Key:       null
β”‚ Type:      RenderDecoratedBox
β”‚ Size:      375.0 Γ— 812.0
β”‚ Position:  (0.0, 0.0)
β”‚ Constraints: BoxConstraints(w=375.0, h=812.0)
β”‚ Color:     Color(0xFF2196F3)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration Options

FlutterInspector(
  config: InspectorConfig(
    enabled: true,           // Enable/disable inspector
    showButton: true,        // Show/hide floating button
    enableLogging: true,     // Enable/disable terminal logging
    theme: InspectorTheme.dark,  // Use dark theme
  ),
  child: MyApp(),
)

InspectorConfig

Option Type Default Description
enabled bool true Enable/disable inspector
showButton bool true Show/hide floating button
enableLogging bool true Enable/disable terminal logging
theme InspectorTheme InspectorTheme() Custom theme

InspectorTheme

const InspectorTheme({
  this.highlightColor = const Color(0x332196F3),
  this.borderColor = const Color(0xFF2196F3),
  this.buttonColor = const Color(0xFF2196F3),
  this.panelBackground = const Color(0xFF1E1E1E),
  this.panelHeaderColor = const Color(0xFF2D2D2D),
  this.textColor = const Color(0xFFFFFFFF),
  this.labelColor = const Color(0xFFB0B0B0),
  this.borderWidth = 2.0,
  this.buttonSize = 56.0,
  this.borderRadius = 8.0,
})

Usage Examples

Basic Usage

import 'package:flutter_inspector/flutter_inspector.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return FlutterInspector(
      child: MaterialApp(
        home: Scaffold(
          appBar: AppBar(title: Text('My App')),
          body: Center(child: Text('Hello World')),
        ),
      ),
    );
  }
}

With Dark Theme

FlutterInspector(
  config: InspectorConfig(
    theme: InspectorTheme.dark,
  ),
  child: MyApp(),
)

Disable Inspector

FlutterInspector(
  enabled: false,
  child: MyApp(),
)

Programmatic Control

// Enable inspector
FlutterInspector.enable();

// Disable inspector
FlutterInspector.disable();

// Check status
final status = getInspectorStatus();
print('Inspector: ${status['status']}');

Check Inspector Status

Command Line

cd your_flutter_project
/path/to/flutter_inspector/check_inspector.sh

Dart Code

import 'package:flutter_inspector/flutter_inspector.dart';

void main() {
  // Check inspector status
  final status = getInspectorStatus();
  print('Inspector Status: $status');
  
  // Print detailed status
  printInspectorStatus();
  
  runApp(MyApp());
}

Debug vs Release

Mode Inspector Status Button Visible Logging Active
Debug (flutter run) βœ… Active βœ… Yes βœ… Yes
Release (flutter build) ❌ Not included ❌ No ❌ No

Build Commands

# Debug mode - Inspector active
flutter run

# Release mode - Inspector removed
flutter build apk
flutter build ios

Project Structure

flutter_inspector/
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ flutter_inspector.dart          # Main export file
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ inspector_overlay.dart      # Main overlay widget
β”‚   β”‚   β”œβ”€β”€ inspector_service.dart      # Terminal logging
β”‚   β”‚   β”œβ”€β”€ inspector_theme.dart        # Custom themes
β”‚   β”‚   └── inspector_config.dart       # Configuration
β”‚   └── widgets/
β”‚       β”œβ”€β”€ inspector_button.dart       # Draggable floating button
β”‚       β”œβ”€β”€ highlight_border.dart       # Element highlight
β”‚       └── element_details_card.dart   # Details panel
β”œβ”€β”€ example/
β”‚   └── main.dart                       # Demo app
β”œβ”€β”€ check_inspector.sh                  # Check script
β”œβ”€β”€ pubspec.yaml
└── README.md

Features in Detail

1. Draggable Inspector Button

  • Position: Start at top-left, drag anywhere
  • Tap: Activate inspection mode
  • Drag: Move without activating
  • Visual: Circle with search icon

2. Real-time Element Hover

  • Hover: Move finger to highlight elements
  • Tooltip: Shows element name and size
  • Border: Blue border around hovered element

3. Element Selection

  • Tap: Select highlighted element
  • Details Panel: Shows at bottom with:
    • Widget type
    • Size (width Γ— height)
    • Position (x, y)
    • Constraints
    • Padding
    • Color
  • Close: Tap close button to deselect

4. Terminal Logging

  • Format: Structured with borders
  • Content: Widget type, size, position, properties
  • Library: dart:developer for structured logging

Troubleshooting

Issue: Inspector button not showing

Solution: Make sure you're running in debug mode

flutter run

Issue: Element detection not working

Solution: Try tapping directly on the element

Issue: No terminal output

Solution: Check if logging is enabled

FlutterInspector(
  config: InspectorConfig(
    enableLogging: true,
  ),
  child: MyApp(),
)

Contributing

See CONTRIBUTING.md for details.

License

MIT License - See LICENSE for details.

Author

Created with ❀️ for the Flutter community

About

πŸ” A universal Flutter UI/UX inspector tool for runtime debugging - inspect any element like Chrome DevTools, shows details on mobile screen and terminal. Debug only, zero trace in release.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages