// 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: 受注伝票一覧から選択ダイアログ } }