jeremy/0129/fix-release-builds #32
2 changed files with 22 additions and 17 deletions
|
@ -5,6 +5,7 @@
|
|||
In most cases you can leave this as-is, but you if you want to provide
|
||||
additional functionality it is fine to subclass or reimplement
|
||||
FlutterApplication and put your custom class here. -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:name="io.flutter.app.FlutterApplication"
|
||||
android:label="Server pinger"
|
||||
|
|
|
@ -104,9 +104,7 @@ class _ServerListState extends State<ServerList> {
|
|||
if (_formKey.currentState.validate() &&
|
||||
uri.text.isNotEmpty) {
|
||||
_formKey.currentState.save();
|
||||
_addServer(
|
||||
serverName.text,
|
||||
uri.text);
|
||||
_addServer(serverName.text, uri.text);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -209,7 +207,9 @@ class _ServerListState extends State<ServerList> {
|
|||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
servers[index].displayName.isEmpty?servers[index].uri:servers[index].displayName,
|
||||
servers[index].displayName.isEmpty
|
||||
? servers[index].uri
|
||||
: servers[index].displayName,
|
||||
style: TextStyle(fontSize: 24),
|
||||
),
|
||||
),
|
||||
|
@ -461,23 +461,27 @@ class _ServerListState extends State<ServerList> {
|
|||
servers = [];
|
||||
SharedPreferences.getInstance().then((prefs) {
|
||||
List<String> serverStrings = prefs.getStringList('servers');
|
||||
Function(List<String> strs) finalize = (List<String> serverStrings) {
|
||||
serverStrings.forEach((str) {
|
||||
Server server = Server.fromPrefs(
|
||||
PrefsServer.fromJson(
|
||||
json.decode(str),
|
||||
),
|
||||
);
|
||||
_updateServerStatus(server);
|
||||
servers.add(server);
|
||||
});
|
||||
setState(() {
|
||||
serversInitialised = true;
|
||||
});
|
||||
};
|
||||
if (serverStrings == null) {
|
||||
prefs.setStringList('servers', []).then((_) {
|
||||
serverStrings = prefs.getStringList('servers');
|
||||
finalize(prefs.getStringList('servers'));
|
||||
});
|
||||
} else {
|
||||
finalize(serverStrings);
|
||||
}
|
||||
serverStrings.forEach((str) {
|
||||
Server server = Server.fromPrefs(
|
||||
PrefsServer.fromJson(
|
||||
json.decode(str),
|
||||
),
|
||||
);
|
||||
_updateServerStatus(server);
|
||||
servers.add(server);
|
||||
});
|
||||
setState(() {
|
||||
serversInitialised = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue