tracpulse/lib/app_bar.dart
fiatcode 4ce1f51062
refactor: extract consistent AppBar builder, remove icon from EVENT LOG title
- Add buildTracPulseAppBar() helper in lib/app_bar.dart
  - Reads backgroundColor/elevation from ThemeData.appBarTheme
  - Consistent back button (#9e9e9e, size 20) via Navigator.pop
  - Monospace title style (14px, weight 700, letter-spacing 2)
  - Optional onTitleTap for tappable titles
- Update all screens to use the new helper, removing redundant overrides
- Remove terminal icon from status_screen title, use plain centered text
- Change appBarTheme centerTitle to false (left-aligned)
- Remove bottom dividers from all screens
2026-05-06 08:01:12 +07:00

55 lines
1.8 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
/// Consistent AppBar builder for TracPulse screens.
///
/// Reads base styles (backgroundColor, elevation) from the current
/// [ThemeData.appBarTheme], then applies TracPulse's standard back button
/// and title styling on top.
///
/// Parameters:
/// - [title] App bar title text (left-aligned, monospace, 14px, weight 700, letter-spacing 2)
/// - [actions] optional list of action [IconButton]s placed on the right
/// - [onTitleTap] optional callback when the title is tapped (e.g. Easter egg)
AppBar buildTracPulseAppBar({
required String title,
List<Widget>? actions,
VoidCallback? onTitleTap,
}) {
return AppBar(
// Inherit backgroundColor, elevation from theme (defined once in MaterialApp.appBarTheme)
automaticallyImplyLeading: true,
actions: actions,
title: onTitleTap != null
? GestureDetector(
onTap: onTitleTap,
child: Text(
title,
style: const TextStyle(
fontFamily: 'monospace',
fontSize: 14,
fontWeight: FontWeight.w700,
letterSpacing: 2,
color: Color(0xFFe0e0e0),
),
),
)
: Text(
title,
style: const TextStyle(
fontFamily: 'monospace',
fontSize: 14,
fontWeight: FontWeight.w700,
letterSpacing: 2,
color: Color(0xFFe0e0e0),
),
),
// Consistent back button: #9e9e9e, size 20 (distinct from title #e0e0e0)
leading: Builder(
builder: (context) => IconButton(
icon: const Icon(Icons.arrow_back, color: Color(0xFF9e9e9e), size: 20),
onPressed: () => Navigator.pop(context),
),
),
leadingWidth: 48,
);
}