No content changes: git diff --ignore-all-space over these files is empty. The churn came from editing on Windows against a repo checked out with LF.
99 lines
3.4 KiB
Dart
99 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:intl/intl.dart';
|
|
import '../../../config/app_config.dart';
|
|
import 'editor_text_field.dart';
|
|
|
|
class HeaderDetailsCard extends StatelessWidget {
|
|
final TextEditingController tanggalCtrl;
|
|
final TextEditingController noPoCtrl;
|
|
final TextEditingController noSoCtrl;
|
|
final TextEditingController noDoCtrl;
|
|
|
|
const HeaderDetailsCard({
|
|
super.key,
|
|
required this.tanggalCtrl,
|
|
required this.noPoCtrl,
|
|
required this.noSoCtrl,
|
|
required this.noDoCtrl,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(AppConfig.borderRadiusMedium),
|
|
side: BorderSide(color: Colors.grey.shade300),
|
|
),
|
|
child: Padding(
|
|
padding: AppConfig.paddingLarge,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Detail Header', style: AppConfig.h2),
|
|
const SizedBox(height: AppConfig.spaceLarge),
|
|
EditorTextField(
|
|
label: 'Tanggal',
|
|
controller: tanggalCtrl,
|
|
readOnly: true,
|
|
onTap: () async {
|
|
DateTime? pickedDate = await showDatePicker(
|
|
context: context,
|
|
initialDate: DateTime.now(),
|
|
firstDate: DateTime(2000),
|
|
lastDate: DateTime(2101),
|
|
builder: (context, child) {
|
|
return Theme(
|
|
data: Theme.of(context).copyWith(
|
|
colorScheme: const ColorScheme.light(
|
|
primary: AppConfig.primaryColor,
|
|
onPrimary: Colors.white,
|
|
onSurface: AppConfig.textPrimary,
|
|
),
|
|
),
|
|
child: child!,
|
|
);
|
|
},
|
|
);
|
|
if (pickedDate != null) {
|
|
String formattedDate = DateFormat('dd MMMM yyyy').format(pickedDate);
|
|
tanggalCtrl.text = formattedDate;
|
|
}
|
|
},
|
|
),
|
|
EditorTextField(
|
|
label: 'No PO',
|
|
controller: noPoCtrl,
|
|
validator: (val) {
|
|
if (val == null || val.isEmpty) return 'No PO harus diisi';
|
|
if (!RegExp(r'^PO/\d{2}/\d{10}$').hasMatch(val)) {
|
|
return 'Format harus PO/[XX]/[XXXXXXXXXX]';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
EditorTextField(
|
|
label: 'No SO',
|
|
controller: noSoCtrl,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
LengthLimitingTextInputFormatter(10),
|
|
],
|
|
validator: (val) {
|
|
if (val == null || val.isEmpty) return 'No SO harus diisi';
|
|
if (val.length != 10) {
|
|
return 'SO harus persis 10 angka';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
EditorTextField(label: 'No DO', controller: noDoCtrl),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|