diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_file_card.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_file_card.dart index 7122e5de..4e44a891 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_file_card.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_file_card.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -100,22 +99,12 @@ class ChatShownFileCard extends StatelessWidget { ), ], ); - final cupertino = chatShownCupertino(context); return ChatShownSurface( label: image ? 'Shown image $title' : 'Shown file $title', child: Semantics( button: true, onTap: open, - child: cupertino - ? CupertinoButton( - padding: EdgeInsets.zero, - onPressed: open, - child: DefaultTextStyle.merge( - style: CupertinoTheme.of(context).textTheme.textStyle, - child: body, - ), - ) - : InkWell(onTap: open, child: body), + child: InkWell(onTap: open, child: body), ), ); } diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_html_card.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_html_card.dart index 1336b521..5ff10247 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_html_card.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_html_card.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../../core/api_gateway.dart'; -import '../../../../../ui/adaptive/host.dart'; import '../../../../artifacts/ui/artifact_fullscreen.dart'; import '../../../../artifacts/ui/artifact_html_view.dart'; import '../../../../artifacts/ui/artifact_viewer_scaffold.dart'; @@ -42,12 +40,13 @@ class ChatShownHtmlCard extends StatelessWidget { final expired = item['expired'] == true || html.isEmpty; final bytes = item['html_bytes']; final size = bytes is num ? fileSizeLabel(bytes.toInt()) : null; - final cupertino = chatShownCupertino(context); final open = expired ? null : () => Navigator.of(context, rootNavigator: true).push( + // The Material host: the route is a MaterialPageRoute whatever + // this flag says, so the flag is always false here. artifactFullscreenRoute( - cupertino: usesCupertinoHost(context), + cupertino: false, builder: (_) => ChatShownHtmlPage( title: title, html: html, @@ -57,13 +56,6 @@ class ChatShownHtmlCard extends StatelessWidget { ); final action = open == null ? null - : cupertino - ? CupertinoButton( - key: const Key('chat-shown-html-open'), - padding: const EdgeInsets.symmetric(horizontal: 8), - onPressed: open, - child: const Text('Open'), - ) : TextButton( key: const Key('chat-shown-html-open'), onPressed: open, @@ -76,10 +68,7 @@ class ChatShownHtmlCard extends StatelessWidget { subtitle: expired ? 'This view is no longer retained' : ['View', ?size].join(' ยท '), - leading: Icon( - cupertino ? CupertinoIcons.chart_bar_square : Icons.web_asset, - color: chatShownSecondary(context), - ), + leading: Icon(Icons.web_asset, color: chatShownSecondary(context)), trailing: action, ), ); diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_link_image.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_link_image.dart index fd7c7848..b8927e6b 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_link_image.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_link_image.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../../core/api_gateway.dart'; @@ -84,16 +83,7 @@ class ChatShownLinkImage extends StatelessWidget { button: true, link: true, onTap: open, - child: chatShownCupertino(context) - ? CupertinoButton( - padding: EdgeInsets.zero, - onPressed: open, - child: DefaultTextStyle.merge( - style: CupertinoTheme.of(context).textTheme.textStyle, - child: body, - ), - ) - : InkWell(onTap: open, child: body), + child: InkWell(onTap: open, child: body), ), ); } diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_notify_row.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_notify_row.dart index 3c6dcc56..596fee16 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_notify_row.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_notify_row.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../../core/api_gateway.dart'; @@ -24,24 +23,15 @@ class ChatShownNotifyRow extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = chatShownCupertino(context); final delivered = item['delivered'] == true; final secondary = chatShownSecondary(context); - final color = delivered - ? secondary - : (cupertino - ? CupertinoColors.systemRed.resolveFrom(context) - : Theme.of(context).colorScheme.error); - final base = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodySmall; + final color = delivered ? secondary : Theme.of(context).colorScheme.error; + final base = Theme.of(context).textTheme.bodySmall; final text = chatShownNotifyText(item); final message = '${item['message'] ?? ''}'.trim(); final icon = delivered - ? (cupertino ? CupertinoIcons.bell : Icons.notifications_outlined) - : (cupertino - ? CupertinoIcons.bell_slash - : Icons.notifications_off_outlined); + ? Icons.notifications_outlined + : Icons.notifications_off_outlined; return Semantics( container: true, label: text, diff --git a/app/lib/features/chat/ui/transcript/shown/chat_shown_surface.dart b/app/lib/features/chat/ui/transcript/shown/chat_shown_surface.dart index 2f4fbdde..6398c9ba 100644 --- a/app/lib/features/chat/ui/transcript/shown/chat_shown_surface.dart +++ b/app/lib/features/chat/ui/transcript/shown/chat_shown_surface.dart @@ -1,17 +1,10 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../../core/api_gateway.dart'; -import '../../sessions/chat_adaptive.dart'; -/// Whether the transcript draws Cupertino controls. -bool chatShownCupertino(BuildContext context) => - chatControlsStyleOf(context) == ChatControlsStyle.cupertino; - -/// The secondary text colour of either host. -Color chatShownSecondary(BuildContext context) => chatShownCupertino(context) - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; +/// The secondary text colour of a shown entry. +Color chatShownSecondary(BuildContext context) => + Theme.of(context).colorScheme.onSurfaceVariant; /// The item's title, else [fallback]. String chatShownTitle(JsonMap item, String fallback) { @@ -36,25 +29,11 @@ class ChatShownSurface extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = chatShownCupertino(context); - const radius = BorderRadius.all(Radius.circular(12)); - final card = cupertino - ? DecoratedBox( - decoration: BoxDecoration( - color: CupertinoColors.secondarySystemGroupedBackground - .resolveFrom(context), - border: Border.all( - color: CupertinoColors.separator.resolveFrom(context), - ), - borderRadius: radius, - ), - child: ClipRRect(borderRadius: radius, child: child), - ) - : Card.outlined( - margin: EdgeInsets.zero, - clipBehavior: Clip.antiAlias, - child: child, - ); + final card = Card.outlined( + margin: EdgeInsets.zero, + clipBehavior: Clip.antiAlias, + child: child, + ); return Semantics( container: true, explicitChildNodes: true, @@ -90,22 +69,10 @@ class ChatShownHeading extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = chatShownCupertino(context); - final titleStyle = cupertino - ? CupertinoTheme.of( - context, - ).textTheme.textStyle.copyWith(fontWeight: FontWeight.w600) - : Theme.of(context).textTheme.titleSmall; - // Cupertino has no caption role; the body style at a smaller size keeps - // the line secondary while still following text scaling. - final cupertinoBody = CupertinoTheme.of(context).textTheme.textStyle; - final subtitleStyle = - (cupertino - ? cupertinoBody.copyWith( - fontSize: (cupertinoBody.fontSize ?? 17) * 0.8, - ) - : Theme.of(context).textTheme.bodySmall) - ?.copyWith(color: chatShownSecondary(context)); + final titleStyle = Theme.of(context).textTheme.titleSmall; + final subtitleStyle = Theme.of( + context, + ).textTheme.bodySmall?.copyWith(color: chatShownSecondary(context)); final sub = subtitle; return Row( children: [ diff --git a/app/test/features/chat/ui/transcript/shown/chat_shown_card_test.dart b/app/test/features/chat/ui/transcript/shown/chat_shown_card_test.dart index 2765ae5e..45792de2 100644 --- a/app/test/features/chat/ui/transcript/shown/chat_shown_card_test.dart +++ b/app/test/features/chat/ui/transcript/shown/chat_shown_card_test.dart @@ -212,4 +212,20 @@ void main() { findsOneWidget, ); }); + + testWidgets('an undelivered notify row draws the error icon in the theme', ( + tester, + ) async { + await pump(tester, { + 'id': 'n3', + 'kind': 'notify', + 'title': 'Build done', + 'delivered': false, + }); + final icon = find.byIcon(Icons.notifications_off_outlined); + expect(icon, findsOneWidget); + final theme = Theme.of(tester.element(icon)); + expect(tester.widget(icon).color, theme.colorScheme.error); + expect(find.byIcon(Icons.notifications_outlined), findsNothing); + }); }