update Localizations
parent
254706218d
commit
cc929ba4a5
@ -1,3 +1,4 @@
|
|||||||
final TOKEN = 'token';
|
final TOKEN = 'token';
|
||||||
final PROJECT_ID="projectID";
|
final PROJECT_ID="projectID";
|
||||||
final SLECTED_PATIENT_TYPE="slectedPatientType";
|
final SLECTED_PATIENT_TYPE="slectedPatientType";
|
||||||
|
final APP_Language = "Language";
|
||||||
@ -1,11 +1,64 @@
|
|||||||
|
import 'package:doctor_app_flutter/providers/projects_provider.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
class SettingsScreen extends StatelessWidget {
|
class SettingsScreen extends StatelessWidget {
|
||||||
|
|
||||||
|
ProjectsProvider projectsProvider;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
projectsProvider = Provider.of(context);
|
||||||
return AppScaffold(
|
return AppScaffold(
|
||||||
appBarTitle: "SETTINS",
|
appBarTitle: TranslationBase.of(context).settings.toUpperCase(),
|
||||||
body: Container(),
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
AppText(TranslationBase.of(context).language.toUpperCase(),fontSize: 18,margin: 5,fontWeight: FontWeight.bold,),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 10),
|
||||||
|
height: 50,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey[600],width: 2.0),
|
||||||
|
borderRadius: BorderRadius.circular(8.0)
|
||||||
|
),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(7.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () { projectsProvider.changeDirection('en'); },
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 350),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: !projectsProvider.isArabic ? Hexcolor('#58434F') : Colors.transparent,
|
||||||
|
border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0))
|
||||||
|
),
|
||||||
|
child: Center(child: AppText(TranslationBase.of(context).lanEnglish, color: !projectsProvider.isArabic ? Colors.white : Colors.grey[500]))
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: (){projectsProvider.changeDirection('ar');},
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 350),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: projectsProvider.isArabic ? Hexcolor('#58434F') : Colors.transparent,
|
||||||
|
border: Border(right: BorderSide(color: Colors.grey[200], width: 2.0))
|
||||||
|
),
|
||||||
|
child: Center(child: AppText(TranslationBase.of(context).lanArabic, color: projectsProvider.isArabic ? Colors.white : Colors.grey[500],))
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' show SynchronousFuture;
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class TranslationBase {
|
||||||
|
TranslationBase(this.locale);
|
||||||
|
|
||||||
|
final Locale locale;
|
||||||
|
|
||||||
|
static TranslationBase of(BuildContext context) {
|
||||||
|
return Localizations.of<TranslationBase>(context, TranslationBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Map<String, Map<String, String>> _localizedValues = {
|
||||||
|
'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'},
|
||||||
|
'settings': {'en': 'Settings', 'ar': 'الاعدادات'},
|
||||||
|
'language': {'en': 'App Language', 'ar': 'لغة التطبيق'},
|
||||||
|
'lanEnglish': {'en': 'English', 'ar': 'English'},
|
||||||
|
'lanArabic': {'en': 'العربية', 'ar': 'العربية'}
|
||||||
|
};
|
||||||
|
|
||||||
|
String get dashboardScreenToolbarTitle => _localizedValues['dashboardScreenToolbarTitle'][locale.languageCode];
|
||||||
|
|
||||||
|
String get settings => _localizedValues['settings'][locale.languageCode];
|
||||||
|
|
||||||
|
String get language => _localizedValues['language'][locale.languageCode];
|
||||||
|
|
||||||
|
String get lanEnglish => _localizedValues['lanEnglish'][locale.languageCode];
|
||||||
|
|
||||||
|
String get lanArabic => _localizedValues['lanArabic'][locale.languageCode];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {
|
||||||
|
const TranslationBaseDelegate();
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool isSupported(Locale locale) => ['en', 'ar'].contains(locale.languageCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<TranslationBase> load(Locale locale) {
|
||||||
|
return SynchronousFuture<TranslationBase>(TranslationBase(locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldReload(TranslationBaseDelegate old) => false;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue