some styling and loading stuff on load
This commit is contained in:
parent
429ffe7c75
commit
ceae866d97
3 changed files with 32 additions and 25 deletions
|
@ -260,21 +260,22 @@ 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');
|
||||||
|
if (lastSync != null) {
|
||||||
|
_lastSync = DateTime.parse(lastSync);
|
||||||
|
}
|
||||||
|
|
||||||
String lastSync = storage.getItem('lastSync');
|
_activeRosterFilePath = storage.getItem('activeRosterFilePath');
|
||||||
if (lastSync != null) {
|
|
||||||
_lastSync = DateTime.parse(lastSync);
|
|
||||||
}
|
|
||||||
|
|
||||||
_activeRosterFilePath = storage.getItem('activeRosterFilePath');
|
List<dynamic> rosters = storage.getItem('rosters');
|
||||||
|
if (rosters != null) {
|
||||||
List<dynamic> rosters = storage.getItem('rosters');
|
rosters.forEach((warband) {
|
||||||
if (rosters != null) {
|
_rosters.add(WarbandRoster.fromJson(warband));
|
||||||
rosters.forEach((warband) {
|
});
|
||||||
_rosters.add(WarbandRoster.fromJson(warband));
|
}
|
||||||
});
|
notifyListeners();
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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(
|
||||||
style: TextStyle(
|
padding: const EdgeInsets.only(right: 5),
|
||||||
fontWeight: hero.rules.contains('Leader')
|
child: Text(hero.name,
|
||||||
? FontWeight.bold
|
style: TextStyle(
|
||||||
: FontWeight.normal)),
|
fontWeight: hero.rules.contains('Leader')
|
||||||
|
? FontWeight.bold
|
||||||
|
: 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),
|
||||||
|
|
Loading…
Reference in a new issue