From 929ba43f9fd4c6b9c3702e1331a80a4ef9e7f361 Mon Sep 17 00:00:00 2001 From: Dewmal Date: Fri, 3 Apr 2020 21:08:20 +0530 Subject: [PATCH] Fix translations --- assets/data/constant_data.json | 16 +++--- assets/lang/en.json | 9 ++- assets/lang/si.json | 10 +++- assets/lang/ta.json | 8 ++- lib/page/screen/contact_us_screen.dart | 80 ++++++++++++++++---------- pubspec.yaml | 2 +- 6 files changed, 79 insertions(+), 46 deletions(-) diff --git a/assets/data/constant_data.json b/assets/data/constant_data.json index 68ae6de..944fec5 100644 --- a/assets/data/constant_data.json +++ b/assets/data/constant_data.json @@ -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": "" } diff --git a/assets/lang/en.json b/assets/lang/en.json index 04138f8..3491879 100644 --- a/assets/lang/en.json +++ b/assets/lang/en.json @@ -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", @@ -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" + } \ No newline at end of file diff --git a/assets/lang/si.json b/assets/lang/si.json index 32d4f44..de45bcd 100644 --- a/assets/lang/si.json +++ b/assets/lang/si.json @@ -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": "සබැඳි සිද්ධියක් සදහා ලියාපදිංචි වන්න", @@ -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 තොරතුරු" } \ No newline at end of file diff --git a/assets/lang/ta.json b/assets/lang/ta.json index 23ab779..f7aba23 100644 --- a/assets/lang/ta.json +++ b/assets/lang/ta.json @@ -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": "பதிவு செய்க", @@ -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 தகவல்" } \ No newline at end of file diff --git a/lib/page/screen/contact_us_screen.dart b/lib/page/screen/contact_us_screen.dart index 5740648..586d457 100644 --- a/lib/page/screen/contact_us_screen.dart +++ b/lib/page/screen/contact_us_screen.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; @@ -5,6 +7,7 @@ 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'; @@ -18,6 +21,7 @@ class ContactUsScreen extends StatefulWidget { class _ContactUsScreenState extends State { @override Widget build(BuildContext context) { + BuildContext contextOriginal = context; return Container( padding: const EdgeInsets.all(10.0), child: FutureBuilder( @@ -46,6 +50,7 @@ class _ContactUsScreenState extends State { itemBuilder: (context, index) { print(contacts[index]); return _contactCard( + contextOriginal, contacts[index].title, contacts[index].phoneNumber, contacts[index].address, @@ -68,8 +73,8 @@ class _ContactUsScreenState extends State { )); } - Widget _contactCard(String title, String phoneNumber, String address, - List subContacts) { + Widget _contactCard(BuildContext contextParent, String title, + String phoneNumber, String address, List subContacts) { return Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(20.0))), @@ -82,16 +87,18 @@ class _ContactUsScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - 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), @@ -111,7 +118,7 @@ class _ContactUsScreenState extends State { } else if (subContacts != null) { await showDialog( barrierDismissible: true, - context: context, + context: contextParent, child: AlertDialog( shape: RoundedRectangleBorder( borderRadius: @@ -138,41 +145,54 @@ class _ContactUsScreenState extends State { ), ), 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: [ + 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: @@ -203,7 +223,7 @@ class _ContactUsScreenState extends State { SizedBox( height: 2.0, ), - Text( + CustomText( address, style: TextStyle( color: Colors.black54, diff --git a/pubspec.yaml b/pubspec.yaml index a809c79..8632731 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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"