156 lines
6.8 KiB
Dart
156 lines
6.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:SEFER/constant/colors.dart';
|
|
import 'package:SEFER/constant/style.dart';
|
|
import 'package:SEFER/controller/home/captin/help/help_controller.dart';
|
|
import 'package:SEFER/views/home/Captin/home_captain/help_details_replay_page.dart';
|
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
|
|
|
import '../../../widgets/elevated_btn.dart';
|
|
import '../../../widgets/mycircular.dart';
|
|
|
|
class HelpCaptain extends StatelessWidget {
|
|
HelpCaptain({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(HelpController());
|
|
return MyScafolld(
|
|
title: 'Helping Page'.tr,
|
|
body: [
|
|
Column(
|
|
children: [
|
|
Card(
|
|
color: AppColor.yellowColor,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Text(
|
|
'If you need any help or have question this is right site to do that and your welcome'
|
|
.tr,
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
),
|
|
Card(
|
|
elevation: 3,
|
|
color: AppColor.secondaryColor,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: GetBuilder<HelpController>(
|
|
builder: (helpController) => Form(
|
|
key: helpController.formKey,
|
|
child: Column(
|
|
children: [
|
|
SizedBox(
|
|
width: Get.width * .8,
|
|
child: TextFormField(
|
|
controller:
|
|
helpController.helpQuestionController,
|
|
decoration: InputDecoration(
|
|
border: const OutlineInputBorder(),
|
|
hintText: 'Enter your Question here'.tr,
|
|
labelText: 'Question'.tr,
|
|
),
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Please enter your Question.'.tr;
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
helpController.isLoading
|
|
? const MyCircularProgressIndicator()
|
|
: MyElevatedButton(
|
|
onPressed: () {
|
|
if (helpController.formKey.currentState!
|
|
.validate()) {
|
|
helpController.addHelpQuestion();
|
|
|
|
// Clear the feedback form
|
|
helpController.formKey.currentState!
|
|
.reset();
|
|
}
|
|
},
|
|
title: 'Submit Question'.tr,
|
|
),
|
|
],
|
|
)),
|
|
),
|
|
)),
|
|
GetBuilder<HelpController>(
|
|
builder: (helpController) => Container(
|
|
height: 400,
|
|
decoration: AppStyle.boxDecoration,
|
|
child: ListView.builder(
|
|
itemCount: helpController.helpQuestionDate['message'] !=
|
|
null
|
|
? helpController.helpQuestionDate['message'].length
|
|
: 0,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
// if (helpController.helpQuestionDate['message'] ==
|
|
// null) {
|
|
// return const CircularProgressIndicator();
|
|
// }
|
|
var list =
|
|
helpController.helpQuestionDate['message'][index];
|
|
return Padding(
|
|
padding: const EdgeInsets.all(3),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: AppColor.greenColor,
|
|
width: 3,
|
|
),
|
|
borderRadius: BorderRadius.circular(11)),
|
|
// elevation: 3,
|
|
// color: AppColor.greenColor,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
print(list['id']);
|
|
helpController.getindex(
|
|
list['id'], list['helpQuestion']);
|
|
helpController
|
|
.getHelpRepley(list['id'].toString());
|
|
Get.to(
|
|
() => const HelpDetailsReplayPage(),
|
|
);
|
|
},
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(2),
|
|
child: Row(
|
|
mainAxisAlignment:
|
|
MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
SizedBox(
|
|
width: Get.width * .6,
|
|
child: Text(
|
|
list['helpQuestion'],
|
|
style: AppStyle.title,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: Get.width * .3,
|
|
child: Text(
|
|
list['datecreated'],
|
|
style: AppStyle.subtitle,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
)),
|
|
],
|
|
),
|
|
],
|
|
isleading: true,
|
|
);
|
|
}
|
|
}
|