Skip to content

Commit

Permalink
Fix translations
Browse files Browse the repository at this point in the history
  • Loading branch information
dewmal committed Apr 3, 2020
1 parent 7c96333 commit 929ba43
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 46 deletions.
16 changes: 8 additions & 8 deletions assets/data/constant_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,39 @@
"contact_us_contacts": [
{
"id": 1,
"title": "Medical Emergency",
"title": "medical_emergency",
"phone_number": "1990",
"address": ""
},
{
"id": 2,
"title": "Free Of Charge",
"phone_number": "Medical Consultation",
"title": "medical_consultation_service_foc",
"phone_number": "medical_consultation_service_title",
"address": "",
"sub": [
{
"id": 1,
"title": "ODoc",
"phone_number": "com.developer.odoc",
"title": "oDoc",
"phone_number": "https://play.google.com/store/apps/details?id=com.developer.odoc,https://apps.apple.com/lk/app/odoc/id1263423673",
"address": ""
},
{
"id": 2,
"title": "MyDoctor",
"phone_number": "com.app.mydoctor",
"phone_number": "https://play.google.com/store/apps/details?id=com.app.mydoctor,https://apps.apple.com/us/app/mydoctor-customer-app/id1242769715",
"address": ""
}
]
},
{
"id": 3,
"title": "Health Information",
"title": "health_information",
"phone_number": "1999",
"address": ""
},
{
"id": 4,
"title": "Covid-19 Information",
"title": "covid_19_information",
"phone_number": "117",
"address": ""
}
Expand Down
9 changes: 7 additions & 2 deletions assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dashboard_home_tab_text": "Home",
"dashboard_location_tab_text": "Location",
"dashboard_safe_track_tab_text": "My Location",
"dashboard_contact_tab_text": "Tele Health",
"dashboard_contact_tab_text": "TeleHealth",
"dashboard_case_list_tab_text": "Case List",
"dashboard_register_tab_text": "Register",
"user_register_bar_title_text": "Register",
Expand Down Expand Up @@ -89,5 +89,10 @@
"case_item_register": "REGISTER",
"case_item_already_register": "Already Added for Registration",
"medical_consultation_service_title": "Medical Consultation Services",
"medical_consultation_service_foc": "Free Of Charge"
"medical_consultation_service_foc": "Free Of Charge",

"medical_emergency": "Medical Emergency",
"health_information": "Health Information",
"covid_19_information": "Covid-19 Information"

}
10 changes: 7 additions & 3 deletions assets/lang/si.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"dashboard_news_text": "පුවත්",
"dashboard_home_tab_text": "නිවැසුම",
"dashboard_location_tab_text": "පිහිටුම",
"dashboard_safe_track_tab_text": "සුරැකුම් පථය",
"dashboard_safe_track_tab_text": "ස්ථාන",
"dashboard_case_list_tab_text": "සිදුවීම්",
"dashboard_contact_tab_text": "Tele Health",
"dashboard_contact_tab_text": "ටෙලි වෛද්\u200Dය සේවා",
"dashboard_register_tab_text": "ලියාපදිංචි",
"user_register_bar_title_text": "ලියාපදිංචි වන්න",
"user_register_screen_title": "සබැඳි සිද්ධියක් සදහා ලියාපදිංචි වන්න",
Expand Down Expand Up @@ -85,5 +85,9 @@
"case_item_register": " ලියාපදිංචි වන්න",
"case_item_already_register": "දැනටමත් ලියාපදිංචිවී ඇත",
"medical_consultation_service_title": "වෛද්\u200Dය උපදේශන සේවාවන්",
"medical_consultation_service_foc": "මුදල් අයකිරීමකින් තොරයි."
"medical_consultation_service_foc": "මුදල් අයකිරීමකින් තොරයි.",

"medical_emergency": "හදිසි සෞඛ්\u200D අවශ්\u200Dයතා",
"health_information": "සෞඛ්\u200Dය තොරතුරු",
"covid_19_information": "Covid-19 තොරතුරු"
}
8 changes: 6 additions & 2 deletions assets/lang/ta.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dashboard_location_tab_text": "எனது இருப்பிடம்",
"dashboard_safe_track_tab_text": "நோயாளியின் பயணம்",
"dashboard_case_list_tab_text": "சம்பவங்கள்",
"dashboard_contact_tab_text": "Tele Health",
"dashboard_contact_tab_text": "டெலிஹெல்த்",
"dashboard_register_tab_text": "பதிவு செய்க",
"user_register_bar_title_text": "பதிவு செய்க",
"user_register_screen_title": "பதிவு செய்க",
Expand Down Expand Up @@ -97,5 +97,9 @@
"case_item_register": "பதிக",
"case_item_already_register": "பதிவுக்கு ஏற்கனவே சேர்க்கப்பட்டது",
"medical_consultation_service_title": "மருத்துவ ஆலோசனை சேவைகள்",
"medical_consultation_service_foc": "கட்டணம் இல்லாமல்"
"medical_consultation_service_foc": "கட்டணம் இல்லாமல்",

"medical_emergency": "மருத்துவ அவசரநிலைமை",
"health_information": "சுகாதார தகவல்",
"covid_19_information": "கோவிட் -19 தகவல்"
}
80 changes: 50 additions & 30 deletions lib/page/screen/contact_us_screen.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:selftrackingapp/app_localizations.dart';
import 'package:selftrackingapp/models/contact_us_contact.dart';
import 'package:selftrackingapp/networking/data_repository.dart';
import 'package:selftrackingapp/utils/tracker_colors.dart';
import 'package:selftrackingapp/widgets/custom_text.dart';
import 'package:url_launcher/url_launcher.dart';

import '../../theme.dart';
Expand All @@ -18,6 +21,7 @@ class ContactUsScreen extends StatefulWidget {
class _ContactUsScreenState extends State<ContactUsScreen> {
@override
Widget build(BuildContext context) {
BuildContext contextOriginal = context;
return Container(
padding: const EdgeInsets.all(10.0),
child: FutureBuilder(
Expand Down Expand Up @@ -46,6 +50,7 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
itemBuilder: (context, index) {
print(contacts[index]);
return _contactCard(
contextOriginal,
contacts[index].title,
contacts[index].phoneNumber,
contacts[index].address,
Expand All @@ -68,8 +73,8 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
));
}

Widget _contactCard(String title, String phoneNumber, String address,
List<ContactUsContact> subContacts) {
Widget _contactCard(BuildContext contextParent, String title,
String phoneNumber, String address, List<ContactUsContact> subContacts) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))),
Expand All @@ -82,16 +87,18 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
phoneNumber,
CustomText(
subContacts == null
? phoneNumber
: AppLocalizations.of(context).translate(phoneNumber),
style: h1TextStyle.copyWith(
color: Colors.white,
fontWeight: FontWeight.w400,
),
textAlign: TextAlign.center,
),
Text(
title,
CustomText(
AppLocalizations.of(context).translate(title),
style: h3TextStyle.copyWith(
color: Colors.white.withOpacity(0.5),
fontWeight: FontWeight.w600),
Expand All @@ -111,7 +118,7 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
} else if (subContacts != null) {
await showDialog(
barrierDismissible: true,
context: context,
context: contextParent,
child: AlertDialog(
shape: RoundedRectangleBorder(
borderRadius:
Expand All @@ -138,41 +145,54 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
),
),
content: Container(
width: 300,
child: ListView.builder(
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: FlatButton(
color: Colors.blue,
onPressed: () async {
await launch(
"https://play.google.com/store/apps/details?id=${subContacts[index].phoneNumber}");
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
width: 300,
height: 200,
child: ListView.builder(
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: FlatButton(
color: Colors.blue,
onPressed: () async {
await launch(subContacts[index]
.phoneNumber
.split(",")[
Platform.isIOS ? 1 : 0]);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CustomText(
subContacts[index].title,
style: TextStyle(
color: Colors.white),
),
),
),
);
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"${subContacts[index].title}",
style: TextStyle(color: Colors.white),
),
),
itemCount: subContacts.length,
),
);
},
itemCount: subContacts.length,
)
],
),
),
actions: [
FlatButton(
child: Text("Ok"),
onPressed: () => Navigator.of(context).pop()),
onPressed: () =>
Navigator.of(context, rootNavigator: true)
.pop()),
],
),
);
} else {
await showDialog(
barrierDismissible: true,
context: context,
context: contextParent,
child: AlertDialog(
shape: RoundedRectangleBorder(
borderRadius:
Expand Down Expand Up @@ -203,7 +223,7 @@ class _ContactUsScreenState extends State<ContactUsScreen> {
SizedBox(
height: 2.0,
),
Text(
CustomText(
address,
style: TextStyle(
color: Colors.black54,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: Self tracking app
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.7.0+22
version: 1.8.0+23

environment:
sdk: ">=2.1.0 <3.0.0"
Expand Down

0 comments on commit 929ba43

Please sign in to comment.