Skip to content

Commit

Permalink
fix(YaruMasterTile): let onTap override scope ontap
Browse files Browse the repository at this point in the history
  • Loading branch information
Feichtmeier committed Jul 27, 2023
1 parent 0cc96d8 commit 01799fd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/src/widgets/master_detail/yaru_master_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ class YaruMasterTile extends StatelessWidget {
/// See [ListTile.trailing].
final Widget? trailing;

/// See [ListTile.onTap].
/// An optional [VoidCallback] forwarded to the internal [ListTile]
/// If not provided [YaruMasterTileScope] `onTap` will be called.
final VoidCallback? onTap;

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final scope = YaruMasterTileScope.maybeOf(context);

final isSelected = selected ?? scope?.selected ?? false;
final scrollbarThicknessWithTrack =
_calcScrollbarThicknessWithTrack(context);
Expand Down Expand Up @@ -76,8 +78,11 @@ class YaruMasterTile extends StatelessWidget {
trailing: trailing,
selected: isSelected,
onTap: () {
scope?.onTap();
onTap?.call();
if (onTap != null) {
onTap!.call();
} else {
scope?.onTap();
}
},
),
),
Expand Down

0 comments on commit 01799fd

Please sign in to comment.