toolheim/mobile-app/lib/screens/warband_roaster_screen.dart

62 lines
1.8 KiB
Dart
Raw Normal View History

2019-07-10 14:16:13 +02:00
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:toolheim/data/github_adapter.dart';
import 'package:toolheim/data/warband_roaster.dart';
import 'package:toolheim/widgets/warband_drawer_widget.dart';
class WarbandRoasterScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
GitHubAdapter github = Provider.of<GitHubAdapter>(context);
if (github.lastSync == null) {
return Scaffold(
2019-07-10 22:28:51 +02:00
appBar: AppBar(title: const Text('Toolheim')),
body: Center(child: const Text('Please select a Warband.')),
drawer: Drawer(
child: SingleChildScrollView(child: WarbandDrawerWidget())));
2019-07-10 14:16:13 +02:00
}
WarbandRoaster roaster = github.activeRoaster;
2019-07-10 22:28:51 +02:00
List<Widget> tiles = new List();
roaster.heros.forEach((hero) {
tiles.add(new ListTile(
title: Text(hero.name),
leading: CircleAvatar(
child: Text(hero.experience.toString()),
backgroundColor: Colors.green,
foregroundColor: Colors.greenAccent,
2019-07-10 14:16:13 +02:00
),
2019-07-10 22:28:51 +02:00
subtitle: Text(hero.type),
));
});
2019-07-10 14:16:13 +02:00
2019-07-10 22:28:51 +02:00
tiles.add(Divider());
2019-07-10 14:16:13 +02:00
2019-07-10 22:28:51 +02:00
roaster.henchmenGroups.forEach((henchmenGroup) {
tiles.add(new ListTile(
title: Text(henchmenGroup.name),
trailing: Chip(label: Text(henchmenGroup.number.toString() + 'x')),
leading: CircleAvatar(
child: Text(henchmenGroup.experience.toString()),
backgroundColor: Colors.orange,
foregroundColor: Colors.white,
),
subtitle: Text(henchmenGroup.type),
));
});
return Scaffold(
appBar: AppBar(
title: Text(roaster.name),
),
drawer:
Drawer(child: SingleChildScrollView(child: WarbandDrawerWidget())),
body: SingleChildScrollView(child: Column(children: tiles)),
);
2019-07-10 14:16:13 +02:00
}
}