diff --git a/lib/lifeCounter.dart b/lib/lifeCounter.dart index e673156..005148d 100644 --- a/lib/lifeCounter.dart +++ b/lib/lifeCounter.dart @@ -106,20 +106,23 @@ class _LifeCounterState extends State { }); } - Widget getSetHealthButton(String text, int healthMultiplier) => - RawMaterialButton( - onPressed: () => setHealth(healthMultiplier, widget.player), - padding: EdgeInsets.all(40), - shape: CircleBorder(), - child: Text( - text, - style: TextStyle( - shadows: [textShadow], - fontSize: 50, - color: widget.player.life > 0 ? usedColor.textColor : Colors.red, - ), - ), - ); + Widget getSetHealthButton(int healthMultiplier) { + bool isPlus = healthMultiplier > 0; + String text = isPlus ? '+' : '-'; + return Expanded( + child: RawMaterialButton( + onPressed: () => setHealth(healthMultiplier, widget.player), + child: Text( + text, + style: TextStyle( + shadows: [textShadow], + // - is smaller than + for some reason by default + fontSize: isPlus ? 48 : 60, + color: widget.player.life > 0 ? usedColor.textColor : Colors.red, + ), + )), + ); + } @override Widget build(BuildContext context) { @@ -136,12 +139,12 @@ class _LifeCounterState extends State { child: Container( decoration: getLifeCounterContainerDecoration(), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - getSetHealthButton('-', -1), + getSetHealthButton(-1), Container( padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10), - width: 130, alignment: Alignment.center, child: Stack( alignment: Alignment.center, @@ -167,7 +170,7 @@ class _LifeCounterState extends State { ), ], )), - getSetHealthButton('+', 1), + getSetHealthButton(1), ], ), ), diff --git a/lib/main.dart b/lib/main.dart index 95a02f6..b4a010b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -30,7 +30,7 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { int startingLife = 20; int playerCount = 4; - bool useCardLayout = false; + bool useCardLayout = true; List players = [ PlayerStats(life: 20, playerNumber: 1),