73 lines
No EOL
2.2 KiB
Dart
73 lines
No EOL
2.2 KiB
Dart
// Version: 1.6 - 倉庫管理画面(簡易実装)
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// 倉庫管理画面
|
|
class WarehouseMasterScreen extends StatefulWidget {
|
|
const WarehouseMasterScreen({super.key});
|
|
|
|
@override
|
|
State<WarehouseMasterScreen> createState() => _WarehouseMasterScreenState();
|
|
}
|
|
|
|
class _WarehouseMasterScreenState extends State<WarehouseMasterScreen> {
|
|
String _warehouseName = ''; // 倉庫名
|
|
List<String> _warehouses = []; // 倉庫リスト
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
// TODO: DatabaseHelper.instance.getWarehouses() を使用
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: const Text('倉庫管理')),
|
|
body: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
// 倉庫名入力
|
|
TextField(
|
|
decoration: const InputDecoration(hintText: '倉庫名', border: OutlineInputBorder()),
|
|
onChanged: (value) => setState(() => _warehouseName = value),
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
// 倉庫リスト(簡易)
|
|
if (_warehouses.isEmpty)
|
|
Center(child: Text('倉庫データがありません'))
|
|
else ..._warehouses.map(
|
|
(w) => Card(
|
|
child: ListTile(
|
|
title: Text(w),
|
|
trailing: IconButton(icon: const Icon(Icons.delete), onPressed: () {}),
|
|
),
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
// 追加ボタン(簡易)
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
if (_warehouseName.isNotEmpty) {
|
|
setState(() => _warehouses.add(_warehouseName));
|
|
_warehouseName = '';
|
|
}
|
|
},
|
|
style: ElevatedButton.styleFrom(padding: const EdgeInsets.symmetric(vertical: 12)),
|
|
child: const Text('倉庫を追加'),
|
|
),
|
|
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
} |