change button language
This commit is contained in:
21
covas_mobile/lib/locale_provider.dart
Normal file
21
covas_mobile/lib/locale_provider.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LocaleProvider with ChangeNotifier {
|
||||
Locale _locale = const Locale('en');
|
||||
|
||||
Locale get locale => _locale;
|
||||
|
||||
void setLocale(Locale locale) {
|
||||
if (!L10n.all.contains(locale)) return;
|
||||
|
||||
_locale = locale;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
class L10n {
|
||||
static final all = [
|
||||
const Locale('en'),
|
||||
const Locale('fr'),
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user