passo_mobile_app/lib/screens/docsms/components/request_receipt.dart

154 lines
6.7 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
import 'package:fluttericon/entypo_icons.dart';
import 'package:form_builder_validators/form_builder_validators.dart';
import 'package:unit2/screens/docsms/components/doc_info_tile.dart';
import 'package:unit2/theme-data.dart/colors.dart';
import 'package:unit2/utils/text_container.dart';
import 'package:unit2/widgets/costum_divider.dart';
import 'package:unit2/widgets/text_icon.dart';
2023-04-25 07:50:36 +00:00
import '../../../test_data.dart';
import '../../../theme-data.dart/btn-style.dart';
import '../../../theme-data.dart/form-style.dart';
import '../../../utils/global.dart';
class RequetAutoReceipt extends StatefulWidget {
RequetAutoReceipt({super.key});
@override
State<RequetAutoReceipt> createState() => _RequetAutoReceiptState();
}
class _RequetAutoReceiptState extends State<RequetAutoReceipt> {
final _formKey = GlobalKey<FormBuilderState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
appBar: AppBar(
backgroundColor: primary,
),
body: SingleChildScrollView(
// ignore: avoid_unnecessary_containers
child: Container(
padding: const EdgeInsets.symmetric(vertical: 8),
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
const DocInfo(title: "4427", subTitle: documentId),
const CostumDivider(),
2024-07-11 01:27:35 +00:00
const DocInfo(
title: "Purchase of Diesel", subTitle: documentTitle),
const CostumDivider(),
const DocInfo(title: "N/A", subTitle: documentSubject),
const CostumDivider(),
2024-07-11 01:27:35 +00:00
const DocInfo(
title: "Request for Quotation", subTitle: documentType),
const CostumDivider(),
Form(
child: Column(children: [
FormBuilder(
key: _formKey,
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 25),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const TextIcon(title: "Source", icon: Entypo.reply),
const SizedBox(
height: 8,
),
Text(
2022-12-20 06:26:37 +00:00
sourceRemarks,
2024-07-11 01:27:35 +00:00
style: Theme.of(context).textTheme.bodyMedium,
),
const SizedBox(
height: 12,
),
FormBuilderTextField(
name: "remarks",
2024-07-11 01:27:35 +00:00
validator: FormBuilderValidators.required(
errorText: remarksRequired),
autovalidateMode:
AutovalidateMode.onUserInteraction,
maxLines: 5,
2024-07-11 01:27:35 +00:00
decoration:
normalTextFieldStyle(enterRemarks, "..."),
),
const SizedBox(
height: 8,
),
const TextIcon(
title: "Destination", icon: Entypo.forward),
const SizedBox(
height: 8,
),
FormBuilderDropdown<String?>(
name: 'department',
autofocus: false,
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(
2022-12-20 06:26:37 +00:00
errorText: departmentRequired)
]),
decoration:
normalTextFieldStyle("Department", ""),
items: puroks
.map((purok) => DropdownMenuItem(
value: purok,
child: Text(purok),
))
.toList()),
const SizedBox(
height: 12,
),
FormBuilderDropdown<String?>(
2022-12-20 06:26:37 +00:00
name: 'substation',
autofocus: false,
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(
2022-12-20 06:26:37 +00:00
errorText: substationRequired)
]),
decoration:
normalTextFieldStyle("Substation", ""),
items: puroks
.map((purok) => DropdownMenuItem(
value: purok,
child: Text(purok),
))
.toList()),
const SizedBox(
height: 24,
),
SizedBox(
width: double.infinity,
height: screenHeight * .06,
child: ElevatedButton(
2024-07-11 01:27:35 +00:00
style: secondaryBtnStyle(primary,
Colors.transparent, Colors.white54),
child: const Text(
2022-12-20 06:26:37 +00:00
requestAutoReceipt,
style: TextStyle(color: Colors.white),
),
onPressed: () {
if (_formKey.currentState!
.saveAndValidate()) {
debugPrint(_formKey
.currentState!.value['remarks']);
}
},
),
),
],
),
)),
]),
)
]),
),
),
),
);
}
}