simple language dropdown without function

This commit is contained in:
2024-12-18 17:36:24 +01:00
parent c523b7495f
commit ff97898b90
2 changed files with 37 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
class LanguageDropdown extends StatelessWidget {
const LanguageDropdown({super.key});
@override
Widget build(BuildContext context) {
return DropdownButton(
value: 'de',
items: [
DropdownMenuItem(
value: 'de',
child: getMenuItem('Deutsch', 'assets/de_icon.png'),
),
DropdownMenuItem(
value: 'en',
child: getMenuItem('Englisch', 'assets/gb_icon.png'),
),
],
onChanged: _onChanged,
);
}
void _onChanged(dynamic value) {}
Widget getMenuItem(String label, String imagePath) {
return Row(
children: [
Text(label),
const Padding(padding: EdgeInsets.only(right: 8)),
Image.asset(imagePath, width: 30),
],
);
}
}