78 lines
2.4 KiB
Dart
78 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:toolheim/data/github_adapter.dart';
|
|
import 'package:toolheim/widgets/warband_drawer_widget.dart';
|
|
|
|
class WarbandRosterScreen extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
GitHubAdapter github = Provider.of<GitHubAdapter>(context);
|
|
|
|
if (github.activeRoster == null) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('Toolheim')),
|
|
body: Builder(builder: (BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
Image.asset(
|
|
'assets/images/heads.png',
|
|
width: 250,
|
|
),
|
|
FlatButton(
|
|
onPressed: () {
|
|
Scaffold.of(context).openDrawer();
|
|
},
|
|
child: Text(
|
|
'Select a warband',
|
|
style: TextStyle(color: Colors.blue),
|
|
),
|
|
),
|
|
]),
|
|
);
|
|
}),
|
|
drawer: Drawer(
|
|
child: SingleChildScrollView(child: WarbandDrawerWidget())));
|
|
}
|
|
|
|
List<Widget> tiles = new List();
|
|
|
|
github.activeRoster.heros.forEach((hero) {
|
|
tiles.add(new ListTile(
|
|
title: Text(hero.name),
|
|
leading: CircleAvatar(
|
|
child: Text(hero.experience.toString()),
|
|
backgroundColor: Colors.green,
|
|
foregroundColor: Colors.greenAccent,
|
|
),
|
|
subtitle: Text(hero.type),
|
|
));
|
|
});
|
|
|
|
tiles.add(Divider());
|
|
|
|
github.activeRoster.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(github.activeRoster.name),
|
|
),
|
|
drawer:
|
|
Drawer(child: SingleChildScrollView(child: WarbandDrawerWidget())),
|
|
body: SingleChildScrollView(child: Column(children: tiles)),
|
|
);
|
|
}
|
|
}
|