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:
committed by
GitHub
parent
69db714fbb
commit
e6f078fff5
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user