import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class LanguageDropdown extends StatelessWidget {
  const LanguageDropdown({super.key});

  @override
  Widget build(BuildContext context) {
    return DropdownButton(
      value: 'de',
      items: [
        DropdownMenuItem(
          value: 'de',
          child: getMenuItem(
            AppLocalizations.of(context)!.german,
            'assets/de_icon.png',
          ),
        ),
        DropdownMenuItem(
          value: 'en',
          child: getMenuItem(
            AppLocalizations.of(context)!.english,
            '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),
      ],
    );
  }
}
