39 lines
1.2 KiB
Dart
39 lines
1.2 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:please_pay_me/theme/tokens.dart';
|
|
|
|
class AppTabItem {
|
|
const AppTabItem({required this.icon, required this.label, this.activeIcon});
|
|
|
|
final IconData icon;
|
|
final IconData? activeIcon;
|
|
final String label;
|
|
}
|
|
|
|
/// Bottom tab bar (iOS): 49pt, hairline top border, tint = brand accent.
|
|
///
|
|
/// Extends [CupertinoTabBar] so it can be passed to [CupertinoTabScaffold];
|
|
/// dynamic colors are resolved by the base class against the active theme.
|
|
class AppTabBar extends CupertinoTabBar {
|
|
AppTabBar({
|
|
super.key,
|
|
required List<AppTabItem> items,
|
|
required super.currentIndex,
|
|
required ValueChanged<int> super.onTap,
|
|
}) : super(
|
|
items: [
|
|
for (final item in items)
|
|
BottomNavigationBarItem(
|
|
icon: Icon(item.icon),
|
|
activeIcon: item.activeIcon == null ? null : Icon(item.activeIcon),
|
|
label: item.label,
|
|
),
|
|
],
|
|
activeColor: AppColors.accent,
|
|
inactiveColor: AppColors.systemGray,
|
|
backgroundColor: AppColors.barBackground,
|
|
border: const Border(
|
|
top: BorderSide(color: AppColors.separator, width: AppSizes.hairline),
|
|
),
|
|
);
|
|
}
|