mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-18 13:02:05 +00:00
40 lines
No EOL
1,002 B
Dart
40 lines
No EOL
1,002 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
import 'package:adguard_home_manager/config/app_screens.dart';
|
|
|
|
class BottomNavBar extends StatelessWidget {
|
|
final int selectedScreen;
|
|
final void Function(int) onSelect;
|
|
|
|
const BottomNavBar({
|
|
Key? key,
|
|
required this.selectedScreen,
|
|
required this.onSelect,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
String translatedName(String key) {
|
|
switch (key) {
|
|
case 'home':
|
|
return AppLocalizations.of(context)!.home;
|
|
|
|
case 'settings':
|
|
return AppLocalizations.of(context)!.settings;
|
|
|
|
default:
|
|
return '';
|
|
}
|
|
}
|
|
|
|
return NavigationBar(
|
|
selectedIndex: selectedScreen,
|
|
destinations: screens.map((screen) => NavigationDestination(
|
|
icon: Icon(screen.icon),
|
|
label: translatedName(screen.name)
|
|
)).toList(),
|
|
onDestinationSelected: onSelect,
|
|
);
|
|
}
|
|
} |