146 lines
No EOL
4.2 KiB
Dart
146 lines
No EOL
4.2 KiB
Dart
// Version: 2.1 - マスタ編集フィールド部品(全てのマスタ画面で共通使用)
|
|
// ※ 簡素版のため、各マスター画面で独自実装は不要です
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// テキスト入力フィールド(マスタ編集用)
|
|
class MasterTextField extends StatelessWidget {
|
|
final String label;
|
|
final TextEditingController controller;
|
|
final String? hintText;
|
|
|
|
const MasterTextField({
|
|
super.key,
|
|
required this.label,
|
|
required this.controller,
|
|
this.hintText,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
TextField(
|
|
controller: controller,
|
|
decoration: InputDecoration(hintText: hintText, border: OutlineInputBorder()),
|
|
),
|
|
],),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// テキストエリア入力フィールド(マスタ編集用)
|
|
class MasterTextArea extends StatelessWidget {
|
|
final String label;
|
|
final TextEditingController controller;
|
|
final String? hintText;
|
|
final int maxLines;
|
|
|
|
const MasterTextArea({
|
|
super.key,
|
|
required this.label,
|
|
required this.controller,
|
|
this.hintText,
|
|
this.maxLines = 2,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
TextField(
|
|
controller: controller,
|
|
maxLines: maxLines,
|
|
decoration: InputDecoration(hintText: hintText, border: OutlineInputBorder()),
|
|
),
|
|
],),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 数値入力フィールド(マスタ編集用)
|
|
class MasterNumberField extends StatelessWidget {
|
|
final String label;
|
|
final TextEditingController controller;
|
|
final String? hintText;
|
|
final bool readOnly;
|
|
|
|
const MasterNumberField({
|
|
super.key,
|
|
required this.label,
|
|
required this.controller,
|
|
this.hintText,
|
|
this.readOnly = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
Text(label, style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
TextField(
|
|
controller: controller,
|
|
keyboardType: TextInputType.number,
|
|
readOnly: readOnly,
|
|
decoration: InputDecoration(hintText: hintText, border: OutlineInputBorder()),
|
|
),
|
|
],),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// ステータス表示フィールド(マスタ編集用)
|
|
class MasterStatusField extends StatelessWidget {
|
|
final String label;
|
|
final String? status;
|
|
|
|
const MasterStatusField({super.key, required this.label, this.status});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: Row(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
|
Expanded(child: Text(label, style: const TextStyle(fontWeight: FontWeight.bold))),
|
|
const SizedBox(width: 8),
|
|
if (status != null) ...[
|
|
Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4)),
|
|
child: Text(status!, style: const TextStyle(fontWeight: FontWeight.bold)),
|
|
),
|
|
],
|
|
],),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// チェックボックスフィールド(マスタ編集用)
|
|
class MasterCheckboxField extends StatelessWidget {
|
|
final String label;
|
|
final bool? checked;
|
|
final Function(bool)? onChanged;
|
|
|
|
const MasterCheckboxField({
|
|
super.key,
|
|
required this.label,
|
|
this.checked,
|
|
this.onChanged,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
|
Text(label),
|
|
Checkbox(value: checked ?? false, onChanged: onChanged),
|
|
],),
|
|
);
|
|
}
|
|
} |