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, + ), + ), ], ), );