toolheim/mobile-app/lib/widgets/hero_list_tile_widget.dart
2019-08-13 22:37:22 +02:00

51 lines
1.5 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:toolheim/widgets/stats_widget.dart';
class HeroListTileWidget extends StatelessWidget {
final hero;
HeroListTileWidget(this.hero);
@override
Widget build(BuildContext context) {
return ListTile(
title: Padding(
padding: const EdgeInsets.only(bottom: 5),
child: Row(children: <Widget>[
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),
)
]),
),
leading: CircleAvatar(
child: Row(children: <Widget>[
Spacer(),
Text(hero.experience.toString(),
style: TextStyle(color: Colors.white)),
Text(
'xp',
style: TextStyle(fontSize: 8),
),
Spacer()
]),
backgroundColor: hero.hiredSword ? Colors.black : Colors.green,
foregroundColor: hero.hiredSword ? Colors.grey : Colors.greenAccent,
),
subtitle: StatsWidget(hero.stats),
isThreeLine: true,
onTap: () {
//Navigator.pushNamed(context, '/unit', arguments: hero);
});
}
}