h-1.flutter.4/lib/screens/invoice_screen.dart
joe 8951016ad9 feat: 販売管理関連画面を追加
- 見積入力画面 (estimate_screen.dart)
- 請求書発行画面 (invoice_screen.dart)
- 発注入力画面 (order_screen.dart)
- 売上返品入力画面 (sales_return_screen.dart)
- 売上入力画面 (sales_screen.dart)

販売管理モジュールの実装完了です。
2026-03-06 21:06:40 +09:00

127 lines
No EOL
3.9 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Version: 1.0.0
import 'package:flutter/material.dart';
/// 請求書発行画面Material Design テンプレート)
class InvoiceScreen extends StatelessWidget {
const InvoiceScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('請求書発行'),
actions: [
IconButton(
icon: const Icon(Icons.insert_drive_file),
onPressed: () => _showSaveDialog(context),
),
],
),
body: ListView(
padding: const EdgeInsets.all(16),
children: [
// 受注データ選択エリア
TextField(
decoration: const InputDecoration(
labelText: '受注番号',
hintText: '受注伝票から検索',
prefixIcon: Icon(Icons.arrow_upward),
),
readOnly: true,
onTap: () => _showOrderSelection(context),
),
const SizedBox(height: 16),
// 請求書情報表示エリア
Card(
margin: EdgeInsets.zero,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('請求書総額', style: const TextStyle(fontWeight: FontWeight.bold)),
Text('¥0', style: const TextStyle(fontSize: 24, color: Colors.green)),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('請求元:'),
Text('株式会社サンプル'),
],
),
],
),
),
),
const SizedBox(height: 16),
// 商品リスト(簡易テンプレート)
Card(
margin: EdgeInsets.zero,
child: ExpansionTile(
title: const Text('請求書商品'),
children: [
ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
itemCount: 0, // デモ用
itemBuilder: (context, index) => Card(
margin: const EdgeInsets.symmetric(vertical: 4),
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.purple.shade100,
child: Icon(Icons.receipt_long, color: Colors.purple),
),
title: Text('商品${index + 1}'),
subtitle: Text('数量0 pcs / 金額¥0'),
),
),
),
],
),
),
],
),
);
}
void _showSaveDialog(BuildContext context) {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
title: const Text('請求書発行'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('請求書を発行しますか?'),
],
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx),
child: const Text('キャンセル'),
),
ElevatedButton(
onPressed: () {
Navigator.pop(ctx);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('請求書発行しました')),
);
},
style: ElevatedButton.styleFrom(backgroundColor: Colors.blue),
child: const Text('発行'),
),
],
),
);
}
void _showOrderSelection(BuildContext context) {
// TODO: 受注伝票一覧から選択ダイアログ
}
}