inspector 1.1.1 inspector: ^1.1.1 copied to clipboard
A Flutter package for inspecting widget size and color. Useful for quick debugging or QA testing.
import 'package:flutter/material.dart';
import 'package:inspector/inspector.dart';
void main() {
runApp(
MaterialApp(
home: ExampleApp(),
darkTheme: ThemeData.dark(),
themeMode: ThemeMode.system,
builder: (context, child) => Inspector(
child: child!,
isEnabled: true,
),
),
);
}
class ExampleApp extends StatefulWidget {
const ExampleApp({Key? key}) : super(key: key);
@override
_ExampleAppState createState() => _ExampleAppState();
}
class _ExampleAppState extends State<ExampleApp> {
Widget _buildListItem(int index) {
return ListTile(
title: Text('Item #$index'),
subtitle: Text('A subtitle'),
leading: Container(
width: 32.0,
height: 32.0,
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
shape: BoxShape.circle,
),
alignment: Alignment.center,
child: Text(
'$index',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
trailing: IconButton(
icon: Icon(Icons.add),
onPressed: () {},
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Example'),
),
body: ListView.builder(
itemCount: 100,
itemBuilder: (context, i) => _buildListItem(i),
),
);
}
}