From 0ae4017eee4c90da3c2eb9f1e08c9f8c5034ddcc Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Wed, 20 May 2026 18:58:50 +0800 Subject: [PATCH] fix: unify input field widths and fix button spacing in boxing page - Unify all input fields (box number and quantity) to width 52 in both single-code and multi-code boxing modes - Flatten nested Row layout in multi-code submit row to ensure equal 8px spacing between quantity input, confirm button, and complete-box button Co-Authored-By: Claude Opus 4.6 --- lib/pages/boxing_page.dart | 169 +++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 90 deletions(-) diff --git a/lib/pages/boxing_page.dart b/lib/pages/boxing_page.dart index 1d71629..a3ebae0 100644 --- a/lib/pages/boxing_page.dart +++ b/lib/pages/boxing_page.dart @@ -2164,7 +2164,7 @@ class _BoxingPageState extends State with WidgetsBindingObserver { ), const SizedBox(width: 4), SizedBox( - width: 70, + width: 52, height: 34, child: TextField( controller: _quantityController, @@ -2765,102 +2765,91 @@ class _BoxingPageState extends State with WidgetsBindingObserver { child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ - // Left half: quantity label + input + confirm - Expanded( - flex: 1, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - '数量', - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.w600, - color: hasScan ? Colors.black54 : Colors.grey.shade400, + Text( + '数量', + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: hasScan ? Colors.black54 : Colors.grey.shade400, + ), + ), + const SizedBox(width: 6), + SizedBox( + width: 52, + height: 34, + child: TextField( + controller: _quantityController, + focusNode: _quantityFocusNode, + enabled: hasScan && !_isSubmitting, + keyboardType: TextInputType.none, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + textAlign: TextAlign.center, + onChanged: (_) => setState(() {}), + onEditingComplete: () {}, + onSubmitted: (_) => _submitFromKeyboard(), + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(6), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(6), + borderSide: BorderSide( + color: _quantityTooHigh + ? Colors.red + : Colors.grey.shade300, ), ), - const SizedBox(width: 6), - Expanded( - child: SizedBox( - height: 34, - child: TextField( - controller: _quantityController, - focusNode: _quantityFocusNode, - enabled: hasScan && !_isSubmitting, - keyboardType: TextInputType.none, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - onChanged: (_) => setState(() {}), - onEditingComplete: () {}, - onSubmitted: (_) => _submitFromKeyboard(), - decoration: InputDecoration( - contentPadding: const EdgeInsets.symmetric(horizontal: 10), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(6), - ), - enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(6), - borderSide: BorderSide( - color: _quantityTooHigh - ? Colors.red - : Colors.grey.shade300, - ), - ), - disabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(6), - borderSide: BorderSide(color: Colors.grey.shade200), - ), - filled: !hasScan, - fillColor: Colors.grey.shade100, - ), - style: const TextStyle( - fontSize: 15, - fontWeight: FontWeight.w600, - ), - ), - ), + disabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(6), + borderSide: BorderSide(color: Colors.grey.shade200), ), - const SizedBox(width: 8), - SizedBox( - height: 34, - child: ElevatedButton( - onPressed: _canSubmit ? _submit : null, - style: ElevatedButton.styleFrom( - backgroundColor: _canSubmit - ? Theme.of(context).colorScheme.primary - : Colors.grey.shade200, - foregroundColor: _canSubmit - ? Colors.white - : Colors.grey.shade400, - padding: const EdgeInsets.symmetric(horizontal: 18), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(6), - ), - ), - child: _isSubmitting - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Colors.white, - ), - ) - : const Text( - '确认', - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w700, - ), - ), - ), - ), - ], + filled: !hasScan, + fillColor: Colors.grey.shade100, + ), + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w600, + ), + ), + ), + const SizedBox(width: 8), + SizedBox( + height: 34, + child: ElevatedButton( + onPressed: _canSubmit ? _submit : null, + style: ElevatedButton.styleFrom( + backgroundColor: _canSubmit + ? Theme.of(context).colorScheme.primary + : Colors.grey.shade200, + foregroundColor: _canSubmit + ? Colors.white + : Colors.grey.shade400, + padding: const EdgeInsets.symmetric(horizontal: 18), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + ), + ), + child: _isSubmitting + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ) + : const Text( + '确认', + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w700, + ), + ), ), ), const SizedBox(width: 8), - // Right half: 完成本箱 Expanded( - flex: 1, child: SizedBox( height: 34, child: OutlinedButton(