-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
37 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,6 @@ | |
// Generated file. Do not edit. | ||
// | ||
|
||
// clang-format off | ||
|
||
#include "generated_plugin_registrant.h" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import 'dart:io'; | ||
import 'dart:ui'; | ||
|
||
import 'package:flutter/widgets.dart'; | ||
import 'package:universal_io/io.dart'; | ||
|
||
Locale getCurrentLocale() | ||
{ | ||
return _localeFromString(Platform.localeName); | ||
} | ||
/// Returns the current device locale | ||
Locale getCurrentLocale() | ||
{ | ||
return _localeFromString(Platform.localeName); | ||
} | ||
|
||
List<Locale> getPreferredLocales() | ||
{ | ||
final deviceLocales = WidgetsBinding.instance.window.locales; | ||
/// Returns preferred device locales | ||
List<Locale> getPreferredLocales() | ||
{ | ||
final deviceLocales = WidgetsBinding.instance.window.locales; | ||
|
||
return deviceLocales; | ||
} | ||
return deviceLocales; | ||
} | ||
|
||
Locale _localeFromString(String code) | ||
{ | ||
var separator = code.contains('_') ? '_' : code.contains('-') ? '-' : null; | ||
Locale _localeFromString(String code) | ||
{ | ||
var separator = code.contains('_') ? '_' : code.contains('-') ? '-' : null; | ||
|
||
if (separator != null) | ||
{ | ||
var parts = code.split(RegExp(separator)); | ||
if (separator != null) | ||
{ | ||
var parts = code.split(RegExp(separator)); | ||
|
||
return Locale(parts[0], parts[1]); | ||
} | ||
else | ||
{ | ||
return Locale(code); | ||
} | ||
} | ||
return Locale(parts[0], parts[1]); | ||
} | ||
else | ||
{ | ||
return Locale(code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters