fix(#1275): one app-bar title style on every screen

Ten screens built their two-line header by hand with different sizes
(titles 24 / 22 / 18 bold / 16, subtitles 11 / 12 / 14), and eleven more
shrank a long title to fit (AdaptiveAppBarTitle) instead of cutting it
off. A new AppBarTitle gives every app bar the app bar's own title style
and a 14 normal subtitle, cut off with an ellipsis when long. It replaces
AdaptiveAppBarTitle, which is removed.

The DM subtitle loses its dotted underline and tap: the full path is
reached from Path Management.

Regression test app_bar_title_test.dart: sizes, no shrink-to-fit, every
AppBar title in lib goes through AppBarTitle or plain Text with no
hard-coded size, and no dotted underline in the DM header. The two
source guards fail against dev.

Epic: #1272

Agent: StormyElk (session 088ce922)
pull/1353/head
diffwireauto 2 days ago
parent e4e0228938
commit 074d186c09

@ -4,7 +4,7 @@ import 'package:provider/provider.dart';
import '../l10n/l10n.dart';
import '../services/app_debug_log_service.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../helpers/snack_bar_builder.dart';
import '../utils/log_export.dart';
import 'send_logs_screen.dart';
@ -21,7 +21,7 @@ class AppDebugLogScreen extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(context.l10n.debugLog_appTitle),
title: AppBarTitle(context.l10n.debugLog_appTitle),
centerTitle: true,
actions: [
IconButton(

@ -4,7 +4,7 @@ import 'package:flutter/services.dart';
import '../l10n/l10n.dart';
import '../services/ble_debug_log_service.dart';
import '../connector/meshcore_protocol.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../helpers/snack_bar_builder.dart';
import '../utils/log_export.dart';
import 'send_logs_screen.dart';
@ -33,7 +33,7 @@ class _BleDebugLogScreenState extends State<BleDebugLogScreen> {
: rawEntries.isNotEmpty;
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(context.l10n.debugLog_bleTitle),
title: AppBarTitle(context.l10n.debugLog_bleTitle),
actions: [
IconButton(
tooltip: LogExport.tooltip(context),

@ -45,6 +45,7 @@ import '../utils/route_transitions.dart';
import 'chat_screen.dart';
import 'settings_screen.dart';
import '../utils/dialog_utils.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/app_shell.dart';
import '../widgets/channel_drawer_list.dart';
import '../widgets/composer_budget_notice.dart';
@ -470,32 +471,24 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
_channelIcon(_currentChannel),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
child: Consumer<MeshCoreConnector>(
builder: (context, connector, _) {
final unreadCount = connector.getUnreadCountForChannelIndex(
_currentChannel.index,
);
final privacy = _currentChannel.isPublicChannel
? context.l10n.channels_public
: context.l10n.channels_private;
return AppBarTitle(
_currentChannel.name.isEmpty
? context.l10n.channels_channelIndex(
_currentChannel.index,
)
: _currentChannel.name,
style: const TextStyle(fontSize: 16),
),
Consumer<MeshCoreConnector>(
builder: (context, connector, _) {
final unreadCount = connector
.getUnreadCountForChannelIndex(_currentChannel.index);
final privacy = _currentChannel.isPublicChannel
? context.l10n.channels_public
: context.l10n.channels_private;
return Text(
subtitle:
'$privacy • ${context.l10n.chat_unread(unreadCount)}',
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 12),
);
},
),
],
);
},
),
),
],

@ -16,7 +16,7 @@ import '../l10n/l10n.dart';
import '../models/channel_message.dart';
import '../models/app_settings.dart';
import '../models/contact.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/osm_attribution.dart';
class ChannelMessagePathScreen extends StatelessWidget {
@ -71,7 +71,7 @@ class ChannelMessagePathScreen extends StatelessWidget {
final extraPaths = _otherPaths(primaryPath, message.pathVariants);
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(l10n.channelPath_title),
title: AppBarTitle(l10n.channelPath_title),
actions: [
IconButton(
icon: const Icon(Icons.radar_outlined),
@ -550,9 +550,7 @@ class _ChannelMessagePathMapScreenState
_pathDistance = _getPathDistance(points);
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(context.l10n.channelPath_mapTitle),
),
appBar: AppBar(title: AppBarTitle(context.l10n.channelPath_mapTitle)),
body: SafeArea(
top: false,
child: Stack(

@ -31,6 +31,7 @@ import '../services/block_service.dart';
import '../services/chat_text_scale_service.dart';
import '../services/path_history_service.dart';
import '../services/translation_service.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/chat_zoom_wrapper.dart';
import '../widgets/composer_budget_notice.dart';
import '../widgets/contact_settings_dialog.dart';
@ -195,32 +196,11 @@ class _ChatScreenState extends State<ChatScreen> {
final unreadLabel = context.l10n.chat_unread(unreadCount);
final pathLabel = _currentPathLabel(contact);
// Show path details if we have non-empty path data (from device or override)
final effectivePath = contact.pathOverrideBytes ?? contact.path;
final hasPathData = effectivePath.isNotEmpty;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(contact.name),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: hasPathData
? () => _showFullPathDialog(context, effectivePath)
: null,
child: Text(
'$pathLabel • $unreadLabel',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.normal,
decoration: hasPathData ? TextDecoration.underline : null,
decorationStyle: TextDecorationStyle.dotted,
),
),
),
],
// The full path is reached from Path Management, so the subtitle
// is plain text, not a dotted-underline shortcut. (#1275)
return AppBarTitle(
contact.name,
subtitle: '$pathLabel • $unreadLabel',
);
},
),

@ -7,7 +7,7 @@ import '../l10n/l10n.dart';
import '../models/channel.dart';
import '../models/community.dart';
import '../storage/community_store.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/qr_scanner_widget.dart';
import '../helpers/channel_share_add.dart';
import '../helpers/channel_slot_ui.dart';
@ -34,7 +34,7 @@ class _CommunityQrScannerScreenState extends State<CommunityQrScannerScreen> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(context.l10n.channels_scanQr),
title: AppBarTitle(context.l10n.channels_scanQr),
centerTitle: true,
),
body: _isProcessing

@ -24,6 +24,7 @@ import '../helpers/snack_bar_builder.dart';
import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../services/cli_console_transport.dart';
import '../widgets/app_bar_title.dart';
enum _EntryKind { command, reply, timeout, sendFailed }
@ -334,21 +335,7 @@ class _DeviceCliScreenState extends State<DeviceCliScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(title),
if (subtitle.isNotEmpty)
Text(
subtitle,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
title: AppBarTitle(title, subtitle: subtitle),
centerTitle: false,
actions: [
IconButton(

@ -13,7 +13,7 @@ import '../connector/meshcore_connector.dart';
import '../l10n/l10n.dart';
import '../services/stock_config_export_service.dart';
import '../utils/stock_config_file.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
class ExportConfigScreen extends StatefulWidget {
const ExportConfigScreen({super.key});
@ -34,7 +34,7 @@ class _ExportConfigScreenState extends State<ExportConfigScreen> {
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(l10n.exportConfig_title),
title: AppBarTitle(l10n.exportConfig_title),
centerTitle: true,
actions: [
IconButton(

@ -20,7 +20,7 @@ import '../l10n/l10n.dart';
import '../models/stock_config.dart';
import '../services/stock_config_export_service.dart' show StockConfigSection;
import '../services/stock_config_import_service.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import 'export_config_screen.dart' show sectionLabel;
class ImportConfigScreen extends StatefulWidget {
@ -45,7 +45,7 @@ class _ImportConfigScreenState extends State<ImportConfigScreen> {
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(l10n.importConfig_title),
title: AppBarTitle(l10n.importConfig_title),
centerTitle: true,
actions: [
if (config != null)

@ -8,7 +8,7 @@ import '../l10n/app_localizations.dart';
import '../l10n/l10n.dart';
import '../services/app_settings_service.dart';
import '../services/map_tile_cache_service.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/osm_attribution.dart';
import '../helpers/snack_bar_builder.dart';
@ -289,7 +289,7 @@ class _MapCacheScreenState extends State<MapCacheScreen> {
return Scaffold(
appBar: AppBar(
title: AdaptiveAppBarTitle(l10n.mapCache_title),
title: AppBarTitle(l10n.mapCache_title),
centerTitle: true,
),
body: Column(

@ -9,6 +9,7 @@ import '../models/path_selection.dart';
import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../services/repeater_command_service.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/path_management_dialog.dart';
import '../widgets/signal_ui.dart';
import '../widgets/snr_indicator.dart';
@ -274,22 +275,9 @@ class _NeighborsScreenState extends State<NeighborsScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
l10n.neighbors_repeatersNeighbors,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
Text(
repeater.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
title: AppBarTitle(
l10n.neighbors_repeatersNeighbors,
subtitle: repeater.name,
),
centerTitle: false,
actions: [

@ -15,6 +15,7 @@ import 'package:meshcore_open/services/app_settings_service.dart';
import 'package:meshcore_open/services/map_tile_cache_service.dart';
import 'package:meshcore_open/utils/app_logger.dart';
import 'package:meshcore_open/widgets/osm_attribution.dart';
import 'package:meshcore_open/widgets/app_bar_title.dart';
import 'package:meshcore_open/widgets/signal_ui.dart';
import 'package:meshcore_open/widgets/snr_indicator.dart';
import 'package:provider/provider.dart';
@ -604,19 +605,7 @@ class _PathTraceMapScreenState extends State<PathTraceMapScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
widget.title,
style: const TextStyle(fontSize: 24),
),
),
],
),
title: AppBarTitle(widget.title),
centerTitle: false,
actions: [
IconButton(

@ -8,6 +8,7 @@ import '../connector/meshcore_connector.dart';
import '../connector/meshcore_protocol.dart';
import '../widgets/debug_frame_viewer.dart';
import '../services/repeater_command_service.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/path_management_dialog.dart';
import '../helpers/snack_bar_builder.dart';
@ -255,20 +256,7 @@ class _RepeaterCliScreenState extends State<RepeaterCliScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(l10n.repeater_cliTitle),
Text(
repeater.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
title: AppBarTitle(l10n.repeater_cliTitle, subtitle: repeater.name),
centerTitle: false,
actions: [
PopupMenuButton<String>(

@ -5,6 +5,7 @@ import '../l10n/l10n.dart';
import '../models/contact.dart';
import '../l10n/contact_localization.dart';
import '../services/app_settings_service.dart';
import '../widgets/app_bar_title.dart';
import 'repeater_status_screen.dart';
import 'repeater_cli_screen.dart';
import 'repeater_settings_screen.dart';
@ -35,30 +36,15 @@ class RepeaterHubScreen extends StatelessWidget {
);
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
if (isAdmin)
Text(
repeater.type == advTypeRepeater
title: AppBarTitle(
isAdmin
? (repeater.type == advTypeRepeater
? l10n.repeater_management
: l10n.room_management,
),
if (!isAdmin)
Text(
repeater.type == advTypeRepeater
: l10n.room_management)
: (repeater.type == advTypeRepeater
? l10n.repeater_guest
: l10n.room_guest,
),
Text(
repeater.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
: l10n.room_guest),
subtitle: repeater.name,
),
centerTitle: false,
),

@ -10,6 +10,7 @@ import '../models/radio_preset.dart';
import '../services/radio_preset_service.dart';
import '../services/repeater_command_service.dart';
import '../services/storage_service.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/path_management_dialog.dart';
import '../widgets/radio_preset_picker.dart';
import '../helpers/remote_radio_commands.dart';
@ -1153,19 +1154,9 @@ class _RepeaterSettingsScreenState extends State<RepeaterSettingsScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(l10n.repeater_settingsTitle),
Text(
repeater.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
title: AppBarTitle(
l10n.repeater_settingsTitle,
subtitle: repeater.name,
),
centerTitle: false,
actions: [

@ -11,6 +11,7 @@ import '../connector/meshcore_protocol.dart';
import '../services/app_settings_service.dart';
import '../services/repeater_command_service.dart';
import '../utils/battery_utils.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/path_management_dialog.dart';
import '../helpers/snack_bar_builder.dart';
@ -356,20 +357,7 @@ class _RepeaterStatusScreenState extends State<RepeaterStatusScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(l10n.repeater_statusTitle),
Text(
repeater.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
),
title: AppBarTitle(l10n.repeater_statusTitle, subtitle: repeater.name),
centerTitle: false,
actions: [
PopupMenuButton<String>(

@ -9,7 +9,7 @@ import '../connector/meshcore_connector.dart';
import '../l10n/l10n.dart';
import '../services/linux_ble_error_classifier.dart';
import '../utils/app_logger.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/battery_optimization_banner.dart';
import '../widgets/device_tile.dart';
import '../helpers/snack_bar_builder.dart';
@ -142,7 +142,7 @@ class _ScannerScreenState extends State<ScannerScreen> {
},
)
: null,
title: AdaptiveAppBarTitle(context.l10n.scanner_title),
title: AppBarTitle(context.l10n.scanner_title),
centerTitle: true,
automaticallyImplyLeading: false,
actions: [

@ -8,7 +8,7 @@ import '../l10n/l10n.dart';
import '../services/app_settings_service.dart';
import '../utils/app_logger.dart';
import '../utils/platform_info.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../helpers/snack_bar_builder.dart';
import 'channels_screen.dart';
import 'usb_screen.dart';
@ -86,7 +86,7 @@ class _TcpScreenState extends State<TcpScreen> {
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.of(context).maybePop(),
),
title: AdaptiveAppBarTitle(context.l10n.tcpScreenTitle),
title: AppBarTitle(context.l10n.tcpScreenTitle),
centerTitle: true,
),
body: SafeArea(

@ -13,6 +13,7 @@ import '../connector/meshcore_protocol.dart';
import '../services/app_settings_service.dart';
import '../services/repeater_command_service.dart';
import '../utils/app_logger.dart';
import '../widgets/app_bar_title.dart';
import '../widgets/path_management_dialog.dart';
import '../helpers/cayenne_lpp.dart';
import '../utils/battery_utils.dart';
@ -327,22 +328,9 @@ class _TelemetryScreenState extends State<TelemetryScreen> {
return Scaffold(
appBar: AppBar(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
l10n.repeater_telemetry,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
Text(
widget.contact.name,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
title: AppBarTitle(
l10n.repeater_telemetry,
subtitle: widget.contact.name,
),
centerTitle: false,
bottom: const SyncProgressAppBarBottom(),

@ -7,7 +7,7 @@ import '../connector/meshcore_protocol.dart';
import '../helpers/snack_bar_builder.dart';
import '../models/contact.dart';
import '../services/mesh_topology_service.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
/// Read-only diagnostic view of the passively-learned mesh topology (#196 /
/// epic #186). It answers one question on real hardware: is
@ -33,7 +33,7 @@ class TopologyDebugScreen extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: const AdaptiveAppBarTitle('Mesh topology'),
title: const AppBarTitle('Mesh topology'),
centerTitle: true,
actions: [
IconButton(

@ -9,7 +9,7 @@ import '../l10n/l10n.dart';
import '../utils/app_logger.dart';
import '../utils/platform_info.dart';
import '../utils/usb_port_labels.dart';
import '../widgets/adaptive_app_bar_title.dart';
import '../widgets/app_bar_title.dart';
import '../helpers/snack_bar_builder.dart';
import 'channels_screen.dart';
import 'scanner_screen.dart';
@ -90,7 +90,7 @@ class _UsbScreenState extends State<UsbScreen> {
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.of(context).maybePop(),
),
title: AdaptiveAppBarTitle(context.l10n.usbScreenTitle),
title: AppBarTitle(context.l10n.usbScreenTitle),
centerTitle: true,
),
body: SafeArea(

@ -1,17 +0,0 @@
import 'package:flutter/material.dart';
class AdaptiveAppBarTitle extends StatelessWidget {
final String text;
const AdaptiveAppBarTitle(this.text, {super.key});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) => SizedBox(
width: constraints.maxWidth,
child: FittedBox(fit: BoxFit.scaleDown, child: Text(text, maxLines: 1)),
),
);
}
}

@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
/// The two-line app-bar title: the title in the app bar's own style, and a
/// subtitle under it. Every screen with a subtitle uses this, so the sizes
/// cannot drift apart again. (#1275)
class AppBarTitle extends StatelessWidget {
final String title;
final String? subtitle;
static const subtitleStyle = TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
);
const AppBarTitle(this.title, {super.key, this.subtitle});
@override
Widget build(BuildContext context) {
final sub = subtitle;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(title, maxLines: 1, overflow: TextOverflow.ellipsis),
if (sub != null && sub.isNotEmpty)
Text(
sub,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: subtitleStyle,
),
],
);
}
}

@ -0,0 +1,87 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/widgets/app_bar_title.dart';
// #1275: two-line app-bar headers were built by hand on each screen with
// different sizes (titles 24 / 22 / 18 bold / 16, subtitles 11 / 12 / 14),
// and 11 screens shrank a long title to fit instead of cutting it off.
void main() {
testWidgets('title takes the app bar style, subtitle is 14 normal', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const AppBarTitle('Alpha', subtitle: 'Beta')),
),
),
);
final appBarStyle = Theme.of(
tester.element(find.byType(AppBar)),
).textTheme.titleLarge!;
final title = tester.renderObject<RenderParagraph>(find.text('Alpha'));
final subtitle = tester.renderObject<RenderParagraph>(find.text('Beta'));
expect(title.text.style!.fontSize, appBarStyle.fontSize);
expect(subtitle.text.style!.fontSize, 14);
expect(subtitle.text.style!.fontWeight, FontWeight.normal);
expect(subtitle.text.style!.decoration, isNot(TextDecoration.underline));
expect(find.byType(FittedBox), findsNothing);
});
testWidgets('a long title keeps its size and is cut off', (tester) async {
tester.view.physicalSize = const Size(320, 640);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
appBar: AppBar(title: AppBarTitle('W' * 60, subtitle: 'x' * 90)),
),
),
);
final title = tester.renderObject<RenderParagraph>(find.text('W' * 60));
expect(title.didExceedMaxLines, isTrue);
expect(tester.takeException(), isNull);
});
test('every app bar title goes through AppBarTitle or plain Text', () {
final offenders = <String>[];
final appBar = RegExp(r'\bAppBar\(');
final title = RegExp(r'\btitle:\s*');
for (final f in Directory('lib').listSync(recursive: true)) {
if (f is! File || !f.path.endsWith('.dart')) continue;
final src = f.readAsStringSync();
for (final m in appBar.allMatches(src)) {
final window = src.substring(m.end, (m.end + 400).clamp(0, src.length));
final t = title.firstMatch(window);
if (t == null) continue;
final value = window.substring(t.end);
final head = value.substring(0, value.length.clamp(0, 220));
// A Consumer wrapper is fine as long as what it builds is AppBarTitle.
final consumer = RegExp(r'^Consumer\d?<[^>]+>\(').hasMatch(value);
final ok = consumer
? src
.substring(m.end, (m.end + 1200).clamp(0, src.length))
.contains('AppBarTitle(')
: RegExp(r'^(const\s+)?(AppBarTitle|Text|Row)\(').hasMatch(value) &&
!head.contains('fontSize') &&
!head.contains('FittedBox');
if (!ok) {
final line = '\n'.allMatches(src.substring(0, m.start)).length + 1;
offenders.add('${f.path}:$line');
}
}
}
expect(offenders, isEmpty);
});
test('no dotted-underline tap targets remain in headers', () {
final chat = File('lib/screens/chat_screen.dart').readAsStringSync();
expect(chat.contains('TextDecorationStyle.dotted'), isFalse);
});
}
Loading…
Cancel
Save

Powered by TurnKey Linux.