some styling and loading stuff on load

This commit is contained in:
Aaron Fischer 2019-08-12 16:48:17 +02:00
parent 429ffe7c75
commit ceae866d97
3 changed files with 32 additions and 25 deletions

View file

@ -260,21 +260,22 @@ class GitHubAdapter extends ChangeNotifier {
await storage.setItem('activeRosterFilePath', _activeRosterFilePath);
}
Future<void> load() async {
await storage.ready;
load() {
storage.ready.then((_) {
String lastSync = storage.getItem('lastSync');
if (lastSync != null) {
_lastSync = DateTime.parse(lastSync);
}
String lastSync = storage.getItem('lastSync');
if (lastSync != null) {
_lastSync = DateTime.parse(lastSync);
}
_activeRosterFilePath = storage.getItem('activeRosterFilePath');
_activeRosterFilePath = storage.getItem('activeRosterFilePath');
List<dynamic> rosters = storage.getItem('rosters');
if (rosters != null) {
rosters.forEach((warband) {
_rosters.add(WarbandRoster.fromJson(warband));
});
}
List<dynamic> rosters = storage.getItem('rosters');
if (rosters != null) {
rosters.forEach((warband) {
_rosters.add(WarbandRoster.fromJson(warband));
});
}
notifyListeners();
});
}
}

View file

@ -110,9 +110,9 @@ class HenchmenGroup extends Unit {
var matches = matchList.first;
h['name'] = matches.group(1);
h['name'] = matches.group(1).trim();
h['number'] = matches.group(2);
h['type'] = matches.group(3);
h['type'] = matches.group(3).trim();
h['experience'] = matches.group(4);
return h;
@ -207,8 +207,8 @@ class Hero extends Unit {
var matches = matchList.first;
h['name'] = matches.group(1);
h['type'] = matches.group(2);
h['name'] = matches.group(1).trim();
h['type'] = matches.group(2).trim();
h['experience'] = matches.group(3);
return h;

View file

@ -64,13 +64,16 @@ class WarbandRosterScreen extends StatelessWidget {
for (var hero in github.activeRoster.heros)
ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 7),
padding: const EdgeInsets.only(bottom: 5),
child: Row(children: <Widget>[
Text(hero.name,
style: TextStyle(
fontWeight: hero.rules.contains('Leader')
? FontWeight.bold
: FontWeight.normal)),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(hero.name,
style: TextStyle(
fontWeight: hero.rules.contains('Leader')
? FontWeight.bold
: FontWeight.normal)),
),
Text(
'(' + hero.type + ')',
style: TextStyle(fontSize: 10),
@ -104,7 +107,10 @@ class WarbandRosterScreen extends StatelessWidget {
title: Padding(
padding: const EdgeInsets.only(bottom: 7),
child: Row(children: <Widget>[
Text(henchmenGroup.name),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(henchmenGroup.name),
),
Text(
'(' + henchmenGroup.type + ')',
style: TextStyle(fontSize: 10),