From 0c338dc12b0add3a1806f6b0b2d228b4ac709507 Mon Sep 17 00:00:00 2001 From: joe Date: Fri, 27 Feb 2026 16:41:29 +0900 Subject: [PATCH] =?UTF-8?q?=E5=B0=91=E3=81=97=E8=A6=8B=E6=A0=84=E3=81=88?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/screens/invoice_detail_page.dart | 55 ++++++++++++++++++++------- lib/screens/invoice_input_screen.dart | 50 +++++++++++++++++++----- 2 files changed, 83 insertions(+), 22 deletions(-) diff --git a/lib/screens/invoice_detail_page.dart b/lib/screens/invoice_detail_page.dart index cc1a34c..9574e48 100644 --- a/lib/screens/invoice_detail_page.dart +++ b/lib/screens/invoice_detail_page.dart @@ -464,18 +464,33 @@ class _InvoiceDetailPageState extends State { final int tax = (subtotal * currentTaxRate).floor(); final int total = subtotal + tax; - return Column( - children: [ - _buildSummaryRow("小計", formatter.format(subtotal), textColor), - if (currentTaxRate > 0) ...[ - if (_companyInfo?.taxDisplayMode == 'normal') - _buildSummaryRow("消費税 (${(currentTaxRate * 100).toInt()}%)", formatter.format(tax), textColor), - if (_companyInfo?.taxDisplayMode == 'text_only') - _buildSummaryRow("消費税", "(税別)", textColor), + return Container( + width: double.infinity, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.indigo.shade900, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildSummaryRow("小計", "¥${formatter.format(subtotal)}", Colors.white70), + if (currentTaxRate > 0) ...[ + const Divider(color: Colors.white24), + if (_companyInfo?.taxDisplayMode == 'normal') + _buildSummaryRow("消費税 (${(currentTaxRate * 100).toInt()}%)", "¥${formatter.format(tax)}", Colors.white70), + if (_companyInfo?.taxDisplayMode == 'text_only') + _buildSummaryRow("消費税", "(税別)", Colors.white70), + ], + const Divider(color: Colors.white24), + _buildSummaryRow( + currentTaxRate > 0 ? "合計金額 (税込)" : "合計金額", + "¥${formatter.format(total)}", + Colors.white, + isTotal: true, + ), ], - const Divider(color: Colors.grey), - _buildSummaryRow(currentTaxRate > 0 ? "合計金額 (税込)" : "合計金額", "¥${formatter.format(total)}", textColor, isTotal: true), - ], + ), ); } @@ -485,8 +500,22 @@ class _InvoiceDetailPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(label, style: TextStyle(fontSize: isTotal ? 18 : 16, fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, color: textColor)), - Text(value, style: TextStyle(fontSize: isTotal ? 20 : 16, fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, color: isTotal ? Colors.orangeAccent : textColor)), + Text( + label, + style: TextStyle( + fontSize: isTotal ? 18 : 16, + fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, + color: textColor, + ), + ), + Text( + value, + style: TextStyle( + fontSize: isTotal ? 22 : 16, + fontWeight: FontWeight.bold, + color: isTotal ? Colors.white : textColor, + ), + ), ], ), ); diff --git a/lib/screens/invoice_input_screen.dart b/lib/screens/invoice_input_screen.dart index c26be4f..5809ea0 100644 --- a/lib/screens/invoice_input_screen.dart +++ b/lib/screens/invoice_input_screen.dart @@ -437,28 +437,60 @@ class _InvoiceInputFormState extends State { ); } - Widget _buildSummarySection(NumberFormat fmt) { + Widget _buildSummarySection(NumberFormat formatter) { + final int subtotal = _subTotal; + final int tax = _includeTax ? (subtotal * _taxRate).floor() : 0; + final int total = subtotal + tax; + return Container( + width: double.infinity, padding: const EdgeInsets.all(16), - decoration: BoxDecoration(color: Colors.indigo.shade900, borderRadius: BorderRadius.circular(12)), + decoration: BoxDecoration( + color: Colors.indigo.shade900, + borderRadius: BorderRadius.circular(12), + ), child: Column( - children: [ - _buildSummaryRow("小計", "¥${fmt.format(_subTotal)}", Colors.white70), + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildSummaryRow("小計", "¥${formatter.format(subtotal)}", Colors.white70), + if (tax > 0) ...[ const Divider(color: Colors.white24), - _buildSummaryRow("合計金額", "¥${fmt.format(_subTotal)}", Colors.white, fontSize: 24), + _buildSummaryRow("消費税", "¥${formatter.format(tax)}", Colors.white70), ], + const Divider(color: Colors.white24), + _buildSummaryRow( + tax > 0 ? "合計金額 (税込)" : "合計金額", + "¥${formatter.format(total)}", + Colors.white, + isTotal: true, + ), + ], ), ); } - Widget _buildSummaryRow(String label, String value, Color color, {double fontSize = 16}) { + Widget _buildSummaryRow(String label, String value, Color textColor, {bool isTotal = false}) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.symmetric(vertical: 2), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text(label, style: TextStyle(color: color, fontSize: fontSize)), - Text(value, style: TextStyle(color: color, fontSize: fontSize, fontWeight: FontWeight.bold)), + Text( + label, + style: TextStyle( + fontSize: isTotal ? 16 : 14, + fontWeight: isTotal ? FontWeight.w600 : FontWeight.normal, + color: textColor, + ), + ), + Text( + value, + style: TextStyle( + fontSize: isTotal ? 18 : 14, + fontWeight: FontWeight.w600, + color: isTotal ? Colors.white : textColor, + ), + ), ], ), );