少し見栄え修正

This commit is contained in:
joe 2026-02-27 16:41:29 +09:00
parent 39759be02a
commit 0c338dc12b
2 changed files with 83 additions and 22 deletions

View file

@ -464,18 +464,33 @@ class _InvoiceDetailPageState extends State<InvoiceDetailPage> {
final int tax = (subtotal * currentTaxRate).floor(); final int tax = (subtotal * currentTaxRate).floor();
final int total = subtotal + tax; final int total = subtotal + tax;
return Column( return Container(
children: [ width: double.infinity,
_buildSummaryRow("小計", formatter.format(subtotal), textColor), padding: const EdgeInsets.all(16),
if (currentTaxRate > 0) ...[ decoration: BoxDecoration(
if (_companyInfo?.taxDisplayMode == 'normal') color: Colors.indigo.shade900,
_buildSummaryRow("消費税 (${(currentTaxRate * 100).toInt()}%)", formatter.format(tax), textColor), borderRadius: BorderRadius.circular(12),
if (_companyInfo?.taxDisplayMode == 'text_only') ),
_buildSummaryRow("消費税", "(税別)", textColor), 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<InvoiceDetailPage> {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(label, style: TextStyle(fontSize: isTotal ? 18 : 16, fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, color: textColor)), Text(
Text(value, style: TextStyle(fontSize: isTotal ? 20 : 16, fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, color: isTotal ? Colors.orangeAccent : textColor)), 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,
),
),
], ],
), ),
); );

View file

@ -437,28 +437,60 @@ class _InvoiceInputFormState extends State<InvoiceInputForm> {
); );
} }
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( return Container(
width: double.infinity,
padding: const EdgeInsets.all(16), 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( child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
_buildSummaryRow("小計", "${fmt.format(_subTotal)}", Colors.white70), children: [
_buildSummaryRow("小計", "${formatter.format(subtotal)}", Colors.white70),
if (tax > 0) ...[
const Divider(color: Colors.white24), 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( return Padding(
padding: const EdgeInsets.symmetric(vertical: 4), padding: const EdgeInsets.symmetric(vertical: 2),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(label, style: TextStyle(color: color, fontSize: fontSize)), Text(
Text(value, style: TextStyle(color: color, fontSize: fontSize, fontWeight: FontWeight.bold)), 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,
),
),
], ],
), ),
); );