forked from brianegan/flutter_architecture_samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocalization.dart
30 lines (23 loc) · 902 Bytes
/
localization.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2018 The Flutter Architecture Sample Authors. All rights reserved.
// Use of this source code is governed by the MIT license that can be found
// in the LICENSE file.
import 'dart:async';
import 'package:flutter/material.dart';
class ScopedModelLocalizations {
static ScopedModelLocalizations of(BuildContext context) {
return Localizations.of<ScopedModelLocalizations>(
context, ScopedModelLocalizations);
}
String get appTitle => "scoped_model example";
}
class ScopedModelLocalizationsDelegate
extends LocalizationsDelegate<ScopedModelLocalizations> {
@override
Future<ScopedModelLocalizations> load(Locale locale) =>
Future(() => ScopedModelLocalizations());
@override
bool shouldReload(ScopedModelLocalizationsDelegate old) => false;
@override
bool isSupported(Locale locale) =>
locale.languageCode.toLowerCase().contains("en");
}