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,9 +260,8 @@ class GitHubAdapter extends ChangeNotifier {
await storage.setItem('activeRosterFilePath', _activeRosterFilePath); await storage.setItem('activeRosterFilePath', _activeRosterFilePath);
} }
Future<void> load() async { load() {
await storage.ready; storage.ready.then((_) {
String lastSync = storage.getItem('lastSync'); String lastSync = storage.getItem('lastSync');
if (lastSync != null) { if (lastSync != null) {
_lastSync = DateTime.parse(lastSync); _lastSync = DateTime.parse(lastSync);
@ -276,5 +275,7 @@ class GitHubAdapter extends ChangeNotifier {
_rosters.add(WarbandRoster.fromJson(warband)); _rosters.add(WarbandRoster.fromJson(warband));
}); });
} }
notifyListeners();
});
} }
} }

View file

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

View file

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