// Version: 1.0.0 import 'package:flutter/material.dart'; /// 売上入力画面(レジモードの主戦場)(Material Design テンプレート) class SalesScreen extends StatelessWidget { const SalesScreen({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('売上入力'), actions: [ IconButton( icon: const Icon(Icons.receipt_long), onPressed: () => _showSaveDialog(context), ), ], ), body: ListView( padding: const EdgeInsets.all(16), children: [ // レジモードのメイン表示エリア Card( margin: EdgeInsets.zero, child: Padding( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ // 合計金額表示 Text( '合計:¥0', style: const TextStyle( fontSize: 32, fontWeight: FontWeight.bold, color: Colors.black87, ), ), const SizedBox(height: 16), // 税率/税額表示 Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('税別:¥0'), Text('税込:¥0', style: const TextStyle(fontWeight: FontWeight.bold)), ], ), ], ), ), ), const SizedBox(height: 16), // 商品入力エリア TextField( decoration: const InputDecoration( labelText: '商品検索', hintText: 'JAN コードまたは商品名を入力', prefixIcon: Icon(Icons.search), ), onChanged: (value) { /* TODO: 商品検索 */ }, ), 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.orange.shade100, child: Icon(Icons.store, color: Colors.orange), ), 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.green), child: const Text('確定'), ), ], ), ); } void _showCustomerPicker(BuildContext context) { // TODO: CustomerPickerModal を再利用して実装 } }