Skip to content

Commit

Permalink
more languages
Browse files Browse the repository at this point in the history
  • Loading branch information
bipinkrish committed Apr 26, 2024
1 parent d4ba743 commit 3ff3510
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 19 deletions.
17 changes: 17 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,26 @@ final bool isAndroid = Platform.isAndroid;
final bool isIos = Platform.isIOS;

const Map<String, String> langs = {
"ar": "Arabic",
"bn": "Bengali",
"zh-CN": "Chinese",
"de": "German",
"en_US": "English",
"es": "Spanish",
"fr": "French",
"gu": "Gujarati",
"hi": "Hindi",
"it": "Italian",
"ja": "Japanese",
"kn": "Kannada",
"ko": "Korean",
"ml": "Malayalam",
"mr": "Marathi",
"pt-BR": "Portuguese",
"ru": "Russian",
"ta": "Tamil",
"te": "Telugu",
"ur": "Urdu",
};

String baseURL = "https://bipinkrish-signbridge.hf.space";
52 changes: 34 additions & 18 deletions lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Text(
isActive
? "Talk something or type"
: "Failed to connect. check 'Base URL'",
: 'Failed to connect. check "Base URL"',
style: TextStyle(
color: tertiaryColor,
),
Expand Down Expand Up @@ -329,7 +329,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
child: TextButton(
onPressed: () {
_showOptionsDialog(context, tertiaryColor);
_showOptionsDialog(context, secondaryColor, tertiaryColor);
},
child: Text(
langs[selectedId]!,
Expand Down Expand Up @@ -476,28 +476,44 @@ class _MyHomePageState extends State<MyHomePage> {
}

Future<void> _showOptionsDialog(
BuildContext context, Color tertiaryColor) async {
BuildContext context, Color secondaryColor, Color tertiaryColor) async {
String? selectedOption = await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
scrollable: true,
titleTextStyle: TextStyle(
fontWeight: FontWeight.bold,
color: tertiaryColor,
fontSize: 24,
title: ListTile(
title: const Text('Select a language'),
isThreeLine: true,
contentPadding: const EdgeInsets.symmetric(vertical: 8),
minVerticalPadding: 0,
titleTextStyle: TextStyle(
fontWeight: FontWeight.bold,
color: secondaryColor,
fontSize: 24,
),
subtitle: const Text(
"You need to have the language pack installed for the selected language.",
),
subtitleTextStyle: TextStyle(
fontStyle: FontStyle.italic,
color: tertiaryColor,
fontSize: 14,
),
),
title: const Text('Select a language'),
content: SingleChildScrollView(
child: ListBody(
children: langs.keys.map((String key) {
return ListTile(
title: Text(langs[key]!),
onTap: () {
Navigator.of(context).pop(key);
},
);
}).toList(),
content: Container(
constraints: const BoxConstraints(maxHeight: 400),
child: SingleChildScrollView(
child: ListBody(
children: langs.keys.map((String key) {
return ListTile(
title: Text(langs[key]!),
onTap: () {
Navigator.of(context).pop(key);
},
);
}).toList(),
),
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: signbridge
description: Effortless Real-Time Sign Language Production

publish_to: "none"
version: 1.0.1+1
version: 1.1.0+1

environment:
sdk: ">=3.2.0 <4.0.0"
Expand Down

0 comments on commit 3ff3510

Please sign in to comment.