4b781378b5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
863 B
Dart
22 lines
863 B
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../theme/app_design_tokens.dart';
|
|
|
|
/// Whether this runs on a desktop platform (macOS, Linux, Windows),
|
|
/// including a desktop browser. Hover and click targets there hug their
|
|
/// content; phones and tablets keep full-width touch rows. Uses the device's
|
|
/// platform, not the theme's: web themes are pinned to Android. A design
|
|
/// with [AppDesignTokens.largeTargets] (High contrast) keeps touch targets
|
|
/// on a desktop too.
|
|
bool prefersCompactHitTargets(BuildContext context) =>
|
|
!AppDesignTokens.of(context).largeTargets &&
|
|
switch (defaultTargetPlatform) {
|
|
TargetPlatform.macOS ||
|
|
TargetPlatform.linux ||
|
|
TargetPlatform.windows => true,
|
|
TargetPlatform.android ||
|
|
TargetPlatform.iOS ||
|
|
TargetPlatform.fuchsia => false,
|
|
};
|