61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:image_picker/image_picker.dart';
|
|
import 'dart:io'; // Add this line at the top of these files
|
|
|
|
|
|
class AirManualImageRequest extends StatefulWidget {
|
|
@override
|
|
State<AirManualImageRequest> createState() => _AirManualImageRequestState();
|
|
}
|
|
|
|
class _AirManualImageRequestState extends State<AirManualImageRequest> {
|
|
XFile? _image;
|
|
final picker = ImagePicker();
|
|
final _descriptionController = TextEditingController();
|
|
|
|
Future<void> _pickImage() async {
|
|
final pickedFile = await picker.pickImage(source: ImageSource.camera);
|
|
setState(() => _image = pickedFile);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text("Air Manual Image Request")),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
children: [
|
|
ElevatedButton.icon(
|
|
icon: Icon(Icons.camera_alt),
|
|
label: Text("Capture Image"),
|
|
onPressed: _pickImage,
|
|
),
|
|
SizedBox(height: 16),
|
|
if (_image != null)
|
|
Image.file(
|
|
File(_image!.path),
|
|
height: 200,
|
|
),
|
|
SizedBox(height: 16),
|
|
TextField(
|
|
controller: _descriptionController,
|
|
decoration: InputDecoration(labelText: "Description"),
|
|
maxLines: 3,
|
|
),
|
|
SizedBox(height: 24),
|
|
ElevatedButton(
|
|
onPressed: () {
|
|
// Submit logic here
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(content: Text("Image request submitted")),
|
|
);
|
|
},
|
|
child: Text("Submit Request"),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |