From 36ba966ef7fbf0327b743279a73310d279d16a72 Mon Sep 17 00:00:00 2001 From: vyPal Date: Wed, 6 Sep 2023 10:18:23 +0200 Subject: [PATCH] Start add language selection --- lib/home.dart | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/home.dart b/lib/home.dart index 0f33db6..07151b2 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -727,6 +727,38 @@ class HomePageState extends State { ), ), const Divider(), + ListTile( + leading: const Icon(Icons.language), + title: const Text('Language'), + trailing: SizedBox( + height: 32, + child: Container( + decoration: BoxDecoration( + border: Border.all(color: Colors.grey), + borderRadius: BorderRadius.circular(4), + ), + padding: const EdgeInsets.symmetric(horizontal: 8), + child: DropdownButton( + value: Localizations.localeOf(context), + onChanged: (Locale? locale) { + if (locale != null) { + // Handle locale selection + } + }, + icon: const Icon(Icons.arrow_drop_down), + underline: Container(), + style: Theme.of(context).textTheme.titleMedium, + items: AppLocalizations.supportedLocales + .map((locale) => DropdownMenuItem( + value: locale, + child: Text(locale.languageCode), + )) + .toList(), + ), + ), + ), + ), + const Divider(), InkWell( highlightColor: Colors.transparent, splashColor: Colors.transparent,