diff --git a/mobile-app/lib/data/github_adapter.dart b/mobile-app/lib/data/github_adapter.dart index 7f05d2d..1f6bc43 100644 --- a/mobile-app/lib/data/github_adapter.dart +++ b/mobile-app/lib/data/github_adapter.dart @@ -260,21 +260,22 @@ class GitHubAdapter extends ChangeNotifier { await storage.setItem('activeRosterFilePath', _activeRosterFilePath); } - Future 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 rosters = storage.getItem('rosters'); - if (rosters != null) { - rosters.forEach((warband) { - _rosters.add(WarbandRoster.fromJson(warband)); - }); - } + List rosters = storage.getItem('rosters'); + if (rosters != null) { + rosters.forEach((warband) { + _rosters.add(WarbandRoster.fromJson(warband)); + }); + } + notifyListeners(); + }); } } diff --git a/mobile-app/lib/data/warband_roster.dart b/mobile-app/lib/data/warband_roster.dart index 751ea96..3342744 100644 --- a/mobile-app/lib/data/warband_roster.dart +++ b/mobile-app/lib/data/warband_roster.dart @@ -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; diff --git a/mobile-app/lib/screens/warband_roster_screen.dart b/mobile-app/lib/screens/warband_roster_screen.dart index 262f2aa..3f35fad 100644 --- a/mobile-app/lib/screens/warband_roster_screen.dart +++ b/mobile-app/lib/screens/warband_roster_screen.dart @@ -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: [ - 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: [ - Text(henchmenGroup.name), + Padding( + padding: const EdgeInsets.only(right: 5), + child: Text(henchmenGroup.name), + ), Text( '(' + henchmenGroup.type + ')', style: TextStyle(fontSize: 10),