Last updated:
0 purchases
quds interactive
Quds Interactive #
An easy localization (with customizing), with dynamic theme!
Why Quds Interactive? #
Every app today should considers two factors:
User language.
Device brightness mode.
This library introduce a simple way to control those factors with saving, restoring preferences.
How to use? #
Initializing: #
void main() async{
await QudsInteractiveApp.initialize(
supportedLanguageCodes: ['en', 'ar_ps', 'fr'],);
// Then run your app
runApp(MyApp());
}
copied to clipboard
Wrapping the app in QudsInteractiveApp #
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return QudsInteractiveApp(
builder: (c) => MyHomePage(title: 'Test Translation'.tr),
);
}
}
copied to clipboard
QudsInteractiveApp
used to apply the changes to the app.
To Translate
Text('hi_message'.tr); // <- Translate to the default selected language.
copied to clipboard
Translated (Widget)
To translate to custome lang (Not the default)
Translated(langCode:'ar', child:CustomWidget() );
class CustomWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
var lang = QudsTranslated.of(context);
return Text(lang.translate('hi_message'));
}
}
copied to clipboard
How to support additional translations? #
In initializing, you can add more specific translations,
await QudsInteractiveApp.initialize(
supportedLanguageCodes: ['en', 'ar_ps', 'fr'],
additionalDictionaries: {'ar': arabicSupport, 'en': englishSupport});
copied to clipboard
ar.dart
var arabicSupport = {
'app_title': 'عنوان التطبيق',
'Test Translation': 'تجربة الترجمة',
'hi_message': 'أهلًا أخي'
};
copied to clipboard
en.dart
var englishSupport = {
'app_title': 'App title',
'hi_message': 'Hi Bro!'
};
copied to clipboard
How to change the selected language and theme? #
By default the default language will be the device language, and the brightness will have the default device option.
To change the translation:
QudsTranslation.setLanguage('en', onChanged:(){
// To save the lang
// QudsInteractiveApp.appController.saveStateInSharedPreferences();
});
copied to clipboard
To toggle the theme:
QudsTheme.toggleTheme();
copied to clipboard
The package provides simple ui to change the current language and theme:
// To change the translation
QudsTranslation.showLanguagesSelectionBorderSheet(context);
// To change the theme
QudsTheme.showThemesSelectionBorderSheet(context);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.