Add tests for material_state_mouse_cursor.0.dart API example. (#145987)

This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Updates `examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart` to allow enable/disable `ListTile` in tests;
- Adds tests for `examples/api/lib/material/material_state/material_state_mouse_cursor.0.dart`.
This commit is contained in:
Kostia Sokolovskyi
2024-04-03 04:39:46 +02:00
committed by GitHub
parent 69db714fbb
commit e6f078fff5
3 changed files with 92 additions and 7 deletions

View File

@@ -17,7 +17,10 @@ class MaterialStateMouseCursorExampleApp extends StatelessWidget {
home: Scaffold(
appBar: AppBar(title: const Text('MaterialStateMouseCursor Sample')),
body: const Center(
child: MaterialStateMouseCursorExample(),
child: MaterialStateMouseCursorExample(
// TRY THIS: Switch to get a different mouse cursor while hovering ListTile.
enabled: false,
),
),
),
);
@@ -40,14 +43,20 @@ class ListTileCursor extends MaterialStateMouseCursor {
}
class MaterialStateMouseCursorExample extends StatelessWidget {
const MaterialStateMouseCursorExample({super.key});
const MaterialStateMouseCursorExample({
required this.enabled,
super.key,
});
final bool enabled;
@override
Widget build(BuildContext context) {
return const ListTile(
title: Text('Disabled ListTile'),
enabled: false,
mouseCursor: ListTileCursor(),
return ListTile(
title: const Text('ListTile'),
enabled: enabled,
onTap: () {},
mouseCursor: const ListTileCursor(),
);
}
}