clean up
This commit is contained in:
25
lib/localization/app_translations_delegate.dart
Normal file
25
lib/localization/app_translations_delegate.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'app_translations.dart';
|
||||
import 'transalation.dart';
|
||||
|
||||
class AppTranslationsDelegate extends LocalizationsDelegate<AppTranslations> {
|
||||
final Locale newLocale;
|
||||
|
||||
const AppTranslationsDelegate({this.newLocale});
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) {
|
||||
return Translation().supportedLanguagesCodes.contains(locale.languageCode);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<AppTranslations> load(Locale locale) {
|
||||
return AppTranslations.load(newLocale ?? locale);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldReload(LocalizationsDelegate<AppTranslations> old) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user