fix(chrome): drop the global AppBar, give each root its own title row
The prototype (t4) draws no global app bar anywhere: every root paints a plain ~56px title row inside its own content instead (Alarmas line 325, Ajustes line 511, Explorar line 641). app.dart wrapped every tab in PluriWaveScaffold(appBar: AppBar(title: Text(appTitle), ...)), adding 56dp of chrome and a "PluriWave" title the prototype never shows. Add PluriRootHeader, a shared 56px title-row widget reused by all 5 roots. Extract app.dart's old _mostrarTimerDialog (only reachable from the removed AppBar action) into a free function, showPluriSleepTimerSheet, so every root's header can open the same sheet directly and the sleep-timer feature stays reachable from every tab with no behaviour change. S1, Tier 1 visual-fidelity pass (audit id 2521).
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pluriwave/l10n/gen/app_localizations.dart';
|
||||
import 'package:pluriwave/tema/pluriwave_theme.dart';
|
||||
import 'package:pluriwave/widgets/pluri_root_header.dart';
|
||||
|
||||
/// S1 (Tier 1 visual fidelity): the prototype draws no global `AppBar` —
|
||||
/// each root instead owns a plain 56px title row inside its own content
|
||||
/// (`t4`, e.g. Alarmas line 325 `height:56px`, Ajustes line 511, Explorar
|
||||
/// line 641). [PluriRootHeader] is that row, shared by all 5 roots so the
|
||||
/// sleep-timer action that used to live on `app.dart`'s single global
|
||||
/// `AppBar` stays reachable from every tab.
|
||||
void main() {
|
||||
Widget host(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: PluriWaveTheme.dark(),
|
||||
locale: const Locale('en'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(body: child),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('renders the given title and is exactly 56px tall', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
host(PluriRootHeader(title: 'Settings', onSleepTimer: () {})),
|
||||
);
|
||||
|
||||
expect(find.text('Settings'), findsOneWidget);
|
||||
expect(PluriRootHeader.height, 56);
|
||||
final size = tester.getSize(find.byType(PluriRootHeader));
|
||||
expect(size.height, 56);
|
||||
});
|
||||
|
||||
testWidgets('exposes a bedtime action that invokes onSleepTimer when '
|
||||
'tapped', (tester) async {
|
||||
var tapped = false;
|
||||
await tester.pumpWidget(
|
||||
host(PluriRootHeader(title: 'Alarms', onSleepTimer: () => tapped = true)),
|
||||
);
|
||||
|
||||
expect(find.byIcon(Icons.bedtime_outlined), findsOneWidget);
|
||||
await tester.tap(find.byIcon(Icons.bedtime_outlined));
|
||||
await tester.pump();
|
||||
|
||||
expect(tapped, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('never builds a Material AppBar', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
host(PluriRootHeader(title: 'Search signal', onSleepTimer: () {})),
|
||||
);
|
||||
|
||||
expect(find.byType(AppBar), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user