@@ -67,7 +67,8 @@ class CommanderDamageTracker extends StatelessWidget {
6767 ),
6868 child: Padding (
6969 padding: const EdgeInsets .all (8 ),
70- child: Column (
70+ child: Row (
71+ mainAxisSize: MainAxisSize .min,
7172 children: [
7273 CommanderDamageButton (
7374 playerId: playerId,
@@ -77,6 +78,7 @@ class CommanderDamageTracker extends StatelessWidget {
7778 commanderDamage: commanderDamage,
7879 damageType: DamageType .commander,
7980 ),
81+ const SizedBox (width: 4 ),
8082 CommanderDamageButton (
8183 playerId: playerId,
8284 commanderPlayerId: commanderPlayerId,
@@ -118,8 +120,6 @@ class CommanderDamageButton extends StatefulWidget {
118120class _CommanderDamageButtonState extends State <CommanderDamageButton >
119121 with SingleTickerProviderStateMixin {
120122 late final AnimationController _animationController;
121- Offset ? _tapDownPosition;
122-
123123 @override
124124 void initState () {
125125 super .initState ();
@@ -173,9 +173,9 @@ class _CommanderDamageButtonState extends State<CommanderDamageButton>
173173 );
174174 }
175175
176- bool _isRightHalf (Offset localPosition) {
176+ bool _isTopHalf (Offset localPosition) {
177177 final box = context.findRenderObject ()! as RenderBox ;
178- return localPosition.dx > box.size.width / 2 ;
178+ return localPosition.dy < box.size.height / 2 ;
179179 }
180180
181181 @override
@@ -189,17 +189,16 @@ class _CommanderDamageButtonState extends State<CommanderDamageButton>
189189 return TapRegion (
190190 onTapOutside: (_) => _handleTapOutside (),
191191 child: GestureDetector (
192- onTapDown: (details) => _tapDownPosition = details.localPosition,
193192 onTap: () {
194- if (isExpanded || _tapDownPosition == null ) return ;
195- _isRightHalf (_tapDownPosition ! ) ? _increment () : _decrement ();
193+ if (isExpanded) return ;
194+ _increment ();
196195 },
197196 onLongPressStart: (_) {
198197 if (! isExpanded) unawaited (_animationController.forward ());
199198 },
200199 onLongPressDown: (details) {
201200 if (! isExpanded) return ;
202- _isRightHalf (details.localPosition) ? _increment () : _decrement ();
201+ _isTopHalf (details.localPosition) ? _increment () : _decrement ();
203202 },
204203 child: AnimatedContainer (
205204 duration: const Duration (milliseconds: 200 ),
@@ -314,18 +313,34 @@ class _CommanderIcons extends StatelessWidget {
314313 @override
315314 Widget build (BuildContext context) {
316315 if (! animationController.isCompleted) return const SizedBox .shrink ();
317- return Row (
318- mainAxisAlignment: MainAxisAlignment .spaceBetween,
316+ return Column (
319317 children: [
320- Icon (
321- Icons .remove,
322- color: AppColors .white.withValues (alpha: 0.8 ),
323- size: 24 ,
318+ Expanded (
319+ child: Center (
320+ child: Icon (
321+ Icons .add,
322+ color: AppColors .white.withValues (alpha: 0.8 ),
323+ size: 24 ,
324+ ),
325+ ),
324326 ),
325- Icon (
326- Icons .add,
327- color: AppColors .white.withValues (alpha: 0.8 ),
328- size: 24 ,
327+ Expanded (
328+ child: Container (
329+ decoration: BoxDecoration (
330+ color: Colors .black.withValues (alpha: 0.4 ),
331+ borderRadius: const BorderRadius .only (
332+ bottomLeft: Radius .circular (10 ),
333+ bottomRight: Radius .circular (10 ),
334+ ),
335+ ),
336+ child: Center (
337+ child: Icon (
338+ Icons .remove,
339+ color: AppColors .white.withValues (alpha: 0.8 ),
340+ size: 24 ,
341+ ),
342+ ),
343+ ),
329344 ),
330345 ],
331346 );
0 commit comments