inventory_mobile/lib/screens/title_bar.dart
2025-12-15 15:35:35 +08:00

69 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
class TitleBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
final List<Widget>? actions;
const TitleBar({super.key, required this.title, this.actions});
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: Colors.white,
elevation: 0,
iconTheme: const IconThemeData(color: Colors.black87), // For drawer icon
title: FittedBox(
fit: BoxFit.scaleDown,
alignment: Alignment.centerLeft,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: const TextStyle(
color: Colors.black87,
fontSize: 20,
fontWeight: FontWeight.w600,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
softWrap: false,
),
const SizedBox(width: 4),
if (title == 'Supplier')
Icon(Icons.local_shipping_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Manufacturer')
Icon(Icons.factory_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Station')
Icon(Icons.location_on_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Product')
Icon(Icons.inventory_2_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Item')
Icon(Icons.category_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Item Movement')
Icon(Icons.swap_horiz_rounded, color: Colors.grey.shade700, size: 20),
if (title == 'Product Request')
Icon(Icons.assignment_rounded, color: Colors.grey.shade700, size: 20),
// const SizedBox(width: 4),
// Text(
// title,
// style: const TextStyle(
// color: Colors.black87,
// fontSize: 20,
// fontWeight: FontWeight.w600,
// ),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// softWrap: false,
// ),
],
),
),
actions: actions,
);
}
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
}