import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/controller/home/profile/feed_back_controller.dart';
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:SEFER/views/widgets/mycircular.dart';

import '../../widgets/elevated_btn.dart';

class FeedBackPage extends StatelessWidget {
  FeedBackPage({super.key});
  FeedBackController feedBackController = Get.put(FeedBackController());
  @override
  Widget build(BuildContext context) {
    return MyScafolld(
      title: 'Feed Back'.tr,
      body: [
        Padding(
          padding: const EdgeInsets.all(26),
          child: Form(
            key: feedBackController.formKey,
            child: Column(
              children: [
                TextFormField(
                  controller: feedBackController.feedbackController,
                  decoration: InputDecoration(
                    border: const OutlineInputBorder(),
                    hintText: 'Enter your feedback here'.tr,
                    labelText: 'Feedback',
                  ),
                  validator: (value) {
                    if (value == null || value.isEmpty) {
                      return 'Please enter your feedback.';
                    }
                    return null;
                  },
                ),
                const SizedBox(height: 20),
                feedBackController.isLoading
                    ? const MyCircularProgressIndicator()
                    : MyElevatedButton(
                        onPressed: () {
                          if (feedBackController.formKey.currentState!
                              .validate()) {
                            feedBackController.addFeedBack();

                            // Clear the feedback form
                            feedBackController.formKey.currentState!.reset();
                          }
                        },
                        title: 'Submit '.tr,
                      ),
              ],
            ),
          ),
        ),
      ],
      isleading: true,
    );
  }
}
