From 2d65aeec2907d29bbe274116829fd5d28101a14a Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Sun, 9 Aug 2026 15:18:06 -0700 Subject: [PATCH] fix(settings): limit web-session dialog to the profile status icon Tapping the display name or surrounding whitespace was opening the web-session dialog; only the checkmark/info icon should. Co-authored-by: Cursor --- .../account/widgets/profile_card.dart | 115 ++++++++++-------- 1 file changed, 62 insertions(+), 53 deletions(-) diff --git a/lib/screens/settings/account/widgets/profile_card.dart b/lib/screens/settings/account/widgets/profile_card.dart index b9c5efa7..a91593f4 100644 --- a/lib/screens/settings/account/widgets/profile_card.dart +++ b/lib/screens/settings/account/widgets/profile_card.dart @@ -46,62 +46,71 @@ class ProfileCard extends StatelessWidget { userLogin: authStore.user.details!.login, radius: 12, ), - title: GestureDetector( - onTap: () { - final navigator = Navigator.of(context); - showDialog( - context: context, - builder: (dialogContext) => FrostyDialog( - title: 'Web session', - message: hasToken - ? 'Your Twitch web session is linked. When using the native player, ads will be avoided on channels where you have a subscription or Twitch Turbo.' - : 'Your Twitch web session is not linked. Log in again to avoid ads when using the native player on channels where you have a subscription or Twitch Turbo.', - actions: hasToken - ? [ - TextButton( - onPressed: Navigator.of(dialogContext).pop, - child: const Text('OK'), - ), - ] - : [ - TextButton( - onPressed: Navigator.of(dialogContext).pop, - child: const Text('Cancel'), - ), - FilledButton( - onPressed: () { - Navigator.of(dialogContext).pop(); - navigator.push( - MaterialPageRoute( - builder: (context) => LoginWebView(), - ), - ); - }, - child: const Text('Log in'), - ), - ], - ), - ); - }, - child: Text.rich( - TextSpan( - text: authStore.user.details!.displayName, - children: [ - const WidgetSpan(child: SizedBox(width: 6)), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Icon( - hasToken - ? Icons.check_circle_outline_rounded - : Icons.info_outline_rounded, - size: 16, - color: hasToken ? Colors.green : Colors.amber, + title: Text.rich( + TextSpan( + text: authStore.user.details!.displayName, + children: [ + const WidgetSpan(child: SizedBox(width: 6)), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + final navigator = Navigator.of(context); + showDialog( + context: context, + builder: (dialogContext) => FrostyDialog( + title: 'Web session', + message: hasToken + ? 'Your Twitch web session is linked. When using the native player, ads will be avoided on channels where you have a subscription or Twitch Turbo.' + : 'Your Twitch web session is not linked. Log in again to avoid ads when using the native player on channels where you have a subscription or Twitch Turbo.', + actions: hasToken + ? [ + TextButton( + onPressed: + Navigator.of(dialogContext).pop, + child: const Text('OK'), + ), + ] + : [ + TextButton( + onPressed: + Navigator.of(dialogContext).pop, + child: const Text('Cancel'), + ), + FilledButton( + onPressed: () { + Navigator.of(dialogContext).pop(); + navigator.push( + MaterialPageRoute( + builder: (context) => + LoginWebView(), + ), + ); + }, + child: const Text('Log in'), + ), + ], + ), + ); + }, + // Padding enlarges the hit target without stealing taps + // on the display name / surrounding ListTile. + child: Padding( + padding: const EdgeInsets.all(4), + child: Icon( + hasToken + ? Icons.check_circle_outline_rounded + : Icons.info_outline_rounded, + size: 16, + color: hasToken ? Colors.green : Colors.amber, + ), ), ), - ], - ), - overflow: TextOverflow.ellipsis, + ), + ], ), + overflow: TextOverflow.ellipsis, ), trailing: const Icon(Icons.chevron_right_rounded), onTap: () => _showAccountOptionsModalBottomSheet(context),