import 'package:flutter/material.dart'; class TitleBar extends StatelessWidget implements PreferredSizeWidget { final String title; final List? 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); }