54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:hl_lieferservice/widget/home/bloc/navigation_bloc.dart';
|
|
import 'package:hl_lieferservice/widget/home/bloc/navigation_state.dart';
|
|
|
|
class AppNavigationBar extends StatefulWidget {
|
|
final Function(int) onSelect;
|
|
|
|
const AppNavigationBar({required this.onSelect});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _AppNavigationBarState();
|
|
}
|
|
|
|
class _AppNavigationBarState extends State<AppNavigationBar> {
|
|
int _selectedPage = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<NavigationBloc, NavigationState>(
|
|
builder: (context, state) {
|
|
if (state is NavigateToRoute) {
|
|
return NavigationBar(
|
|
selectedIndex: _selectedPage,
|
|
destinations: const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.barcode_reader),
|
|
label: "Beladung",
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.fire_truck),
|
|
label: "Auslieferung",
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.local_shipping),
|
|
label: "Fahrzeuge",
|
|
),
|
|
],
|
|
onDestinationSelected: (int index) {
|
|
widget.onSelect(index);
|
|
|
|
setState(() {
|
|
_selectedPage = index;
|
|
});
|
|
},
|
|
);
|
|
}
|
|
|
|
return Container();
|
|
},
|
|
);
|
|
}
|
|
}
|