marco.pms.mobileapp/lib/model/directory/add_comment_bottom_sheet.dart
Vaibhav Surve 5c53a3f4be Refactor project structure and rename from 'marco' to 'on field work'
- Updated import paths across multiple files to reflect the new package name.
- Changed application name and identifiers in CMakeLists.txt, Runner.rc, and other configuration files.
- Modified web index.html and manifest.json to update the app title and name.
- Adjusted macOS and Windows project settings to align with the new application name.
- Ensured consistency in naming across all relevant files and directories.
2025-11-22 14:20:37 +05:30

73 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:on_field_work/controller/directory/add_comment_controller.dart';
import 'package:on_field_work/helpers/utils/base_bottom_sheet.dart';
class AddCommentBottomSheet extends StatefulWidget {
final String contactId;
const AddCommentBottomSheet({super.key, required this.contactId});
@override
State<AddCommentBottomSheet> createState() => _AddCommentBottomSheetState();
}
class _AddCommentBottomSheetState extends State<AddCommentBottomSheet> {
late final AddCommentController controller;
final TextEditingController textController = TextEditingController();
bool isSubmitting = false;
@override
void initState() {
super.initState();
controller = Get.put(AddCommentController(contactId: widget.contactId));
}
@override
void dispose() {
textController.dispose();
super.dispose();
}
Future<void> handleSubmit() async {
final noteText = textController.text.trim();
if (noteText.isEmpty) return;
setState(() {
isSubmitting = true;
});
controller.updateNote(noteText);
await controller.submitComment();
if (mounted) {
setState(() {
isSubmitting = false;
});
Get.back(result: true);
}
}
@override
Widget build(BuildContext context) {
return BaseBottomSheet(
title: "Add Note",
onCancel: () => Get.back(),
onSubmit: handleSubmit,
isSubmitting: isSubmitting,
child: TextField(
controller: textController,
maxLines: null,
minLines: 5,
decoration: InputDecoration(
hintText: "Enter your note here...",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
contentPadding: const EdgeInsets.all(12),
),
),
);
}
}