Newer
Older
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:flutter_swipe/flutter_swipe.dart';
import 'package:scrobbles/common/config/activity_page.dart';
import 'package:scrobbles/common/cubit/nav/nav_cubit_pages.dart';
class BottomNavBar extends StatelessWidget {
const BottomNavBar({
super.key,
this.swipeController,
});
final SwiperController? swipeController;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.all(0),
elevation: 4,
shadowColor: Theme.of(context).colorScheme.shadow,
color: Theme.of(context).colorScheme.surfaceContainerHighest,
shape: const ContinuousRectangleBorder(),
child: BlocBuilder<NavCubitPage, int>(
builder: (BuildContext context, int pageIndex) {
final List<BottomNavigationBarItem> items = [];
ActivityPage.items.forEach((int pageIndex, ActivityPageItem item) {
items.add(BottomNavigationBarItem(
return BottomNavigationBar(
currentIndex: pageIndex,
onTap: (int index) {
BlocProvider.of<NavCubitPage>(context).updateIndex(index);
swipeController?.move(index);
},
type: BottomNavigationBarType.fixed,
elevation: 0,
backgroundColor: Colors.transparent,
selectedItemColor: Theme.of(context).colorScheme.primary,
unselectedItemColor: Theme.of(context).textTheme.bodySmall!.color,
items: items,
);
},
),
);
}
}