149 lines
4.7 KiB
Dart
149 lines
4.7 KiB
Dart
import 'package:didvan/config/design_config.dart';
|
|
import 'package:didvan/config/theme_data.dart';
|
|
import 'package:didvan/constants/app_icons.dart';
|
|
import 'package:didvan/views/widgets/didvan/text.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../audio/player_navbar.dart';
|
|
|
|
class DidvanBNB extends StatelessWidget {
|
|
final int currentTabIndex;
|
|
final void Function(int index) onTabChanged;
|
|
|
|
const DidvanBNB(
|
|
{Key? key, required this.currentTabIndex, required this.onTabChanged})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
const PlayerNavBar(
|
|
inHome: true,
|
|
),
|
|
Positioned(
|
|
bottom: 0,
|
|
left: 0,
|
|
right: 0,
|
|
child: Container(
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.surface,
|
|
borderRadius:
|
|
const BorderRadius.vertical(top: Radius.circular(16)),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0XFF1B3C59).withOpacity(0.15),
|
|
blurRadius: 8,
|
|
spreadRadius: 0,
|
|
offset: const Offset(0, -8),
|
|
)
|
|
],
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Row(
|
|
children: [
|
|
_NavBarItem(
|
|
isSelected: currentTabIndex == 0,
|
|
title: 'خانه',
|
|
selectedIcon: DidvanIcons.house_solid,
|
|
unselectedIcon: DidvanIcons.house_light,
|
|
onTap: () => onTabChanged(0),
|
|
),
|
|
_NavBarItem(
|
|
isSelected: currentTabIndex == 1,
|
|
title: 'دستهبندی',
|
|
selectedIcon: DidvanIcons.category_solid,
|
|
unselectedIcon: DidvanIcons.category_light,
|
|
onTap: () => onTabChanged(1),
|
|
),
|
|
_NavBarItem(
|
|
isSelected: currentTabIndex == 2,
|
|
title: 'هوشان',
|
|
selectedIcon: DidvanIcons.ai_solid,
|
|
unselectedIcon: DidvanIcons.ai_regular,
|
|
onTap: () => onTabChanged(2),
|
|
),
|
|
_NavBarItem(
|
|
isSelected: currentTabIndex == 3,
|
|
title: 'آمار و داده',
|
|
selectedIcon: DidvanIcons.stats__solid,
|
|
unselectedIcon: DidvanIcons.stats__light,
|
|
onTap: () => onTabChanged(3),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class _NavBarItem extends StatelessWidget {
|
|
final VoidCallback onTap;
|
|
final bool isSelected;
|
|
final String title;
|
|
final IconData selectedIcon;
|
|
final IconData unselectedIcon;
|
|
|
|
const _NavBarItem({
|
|
Key? key,
|
|
required this.isSelected,
|
|
required this.title,
|
|
required this.selectedIcon,
|
|
required this.unselectedIcon,
|
|
required this.onTap,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Expanded(
|
|
child: Tooltip(
|
|
message: title,
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.title,
|
|
borderRadius: DesignConfig.highBorderRadius,
|
|
boxShadow: DesignConfig.defaultShadow,
|
|
),
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
color: Colors.transparent,
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(
|
|
height: 4,
|
|
),
|
|
AnimatedContainer(
|
|
padding: const EdgeInsets.all(4),
|
|
duration: DesignConfig.lowAnimationDuration,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: isSelected
|
|
? Theme.of(context).colorScheme.focused
|
|
: Theme.of(context).colorScheme.surface,
|
|
),
|
|
child: Icon(
|
|
isSelected ? selectedIcon : unselectedIcon,
|
|
size: 32,
|
|
color: DesignConfig.isDark
|
|
? Theme.of(context).colorScheme.text
|
|
: Theme.of(context).colorScheme.title,
|
|
),
|
|
),
|
|
DidvanText(
|
|
title,
|
|
style: Theme.of(context).textTheme.bodySmall,
|
|
color: Theme.of(context).colorScheme.title,
|
|
),
|
|
const Spacer(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|