Skip to content

Commit 296575a

Browse files
committed
Refactor LanguageSwitcher UI for improved aesthetics and consistency
1 parent d39b197 commit 296575a

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

lib/app/view/home_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class HomePage extends StatelessWidget {
2929
),
3030
actions: const [
3131
Padding(
32-
padding: EdgeInsets.all(8),
32+
padding: EdgeInsets.zero,
3333
child: LanguageSwitcher(),
3434
),
3535
],

lib/app/widgets/language_switcher.dart

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,26 @@ class LanguageSwitcher extends StatelessWidget {
1414
icon: Row(
1515
mainAxisSize: MainAxisSize.min,
1616
children: [
17-
Text(
18-
currentLanguage,
19-
style: const TextStyle(
20-
color: Colors.black87,
21-
fontWeight: FontWeight.w500,
17+
Chip(
18+
label: Text(
19+
currentLanguage,
20+
style: const TextStyle(
21+
color: Colors.black87,
22+
fontWeight: FontWeight.w500,
23+
fontSize: 14,
24+
),
2225
),
26+
avatar: const Icon(Icons.language, size: 18, color: Colors.black87),
27+
backgroundColor: Colors.grey.shade100,
28+
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
29+
shape: RoundedRectangleBorder(
30+
borderRadius: BorderRadius.circular(16),
31+
side: const BorderSide(color: Colors.black12, width: 1),
32+
),
33+
visualDensity: VisualDensity.compact,
34+
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
35+
elevation: 0,
2336
),
24-
const Icon(Icons.arrow_drop_down, color: Colors.black87),
2537
],
2638
),
2739
itemBuilder: (context) => [
@@ -32,7 +44,7 @@ class LanguageSwitcher extends StatelessWidget {
3244
const Text('English'),
3345
if (currentLocale.languageCode == 'en')
3446
const Padding(
35-
padding: EdgeInsets.only(left: 8.0),
47+
padding: EdgeInsets.only(left: 8),
3648
child: Icon(Icons.check, size: 18),
3749
),
3850
],
@@ -45,7 +57,7 @@ class LanguageSwitcher extends StatelessWidget {
4557
const Text('ไทย'),
4658
if (currentLocale.languageCode == 'th')
4759
const Padding(
48-
padding: EdgeInsets.only(left: 8.0),
60+
padding: EdgeInsets.only(left: 8),
4961
child: Icon(Icons.check, size: 18),
5062
),
5163
],
@@ -57,4 +69,4 @@ class LanguageSwitcher extends StatelessWidget {
5769
},
5870
);
5971
}
60-
}
72+
}

0 commit comments

Comments
 (0)