This commit is contained in:
Hamza-Ayed
2024-09-20 20:03:54 +03:00
parent b09e0da403
commit 519f4b651c
20 changed files with 935 additions and 831 deletions

View File

@@ -1,13 +1,9 @@
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';
import 'package:flutter/cupertino.dart';
class HelpCaptain extends StatelessWidget {
HelpCaptain({super.key});
@@ -15,152 +11,159 @@ class HelpCaptain extends StatelessWidget {
@override
Widget build(BuildContext context) {
Get.put(HelpController());
return MyScafolld(
title: 'Helping Page'.tr,
body: [
Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: Text('Helping Page'.tr),
leading: CupertinoButton(
padding: EdgeInsets.zero,
child: Icon(CupertinoIcons.back),
onPressed: () => Navigator.pop(context),
),
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0),
child: Container(
padding: const EdgeInsets.all(16.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
border: Border.all(
color: CupertinoColors.systemGrey2,
),
),
child: Text(
'If you need any help or have question this is right site to do that and your welcome'
'If you need any help or have questions, this is the right place to do that. You are welcome!'
.tr,
style: AppStyle.title,
style: CupertinoTheme.of(context).textTheme.textStyle,
textAlign: TextAlign.center,
),
),
),
),
Card(
Card(
elevation: 3,
color: AppColor.secondaryColor,
color: CupertinoColors.systemGrey6,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(16.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;
},
key: helpController.formKey,
child: Column(
children: [
CupertinoTextField(
controller: helpController.helpQuestionController,
placeholder: 'Enter your Question here'.tr,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: CupertinoColors.systemGrey,
),
),
const SizedBox(height: 20),
helpController.isLoading
? const MyCircularProgressIndicator()
: MyElevatedButton(
onPressed: () {
if (helpController.formKey.currentState!
.validate()) {
helpController.addHelpQuestion();
padding: const EdgeInsets.all(16),
clearButtonMode: OverlayVisibilityMode.editing,
),
const SizedBox(height: 20),
helpController.isLoading
? const CupertinoActivityIndicator()
: CupertinoButton.filled(
onPressed: () {
if (helpController.formKey.currentState!
.validate()) {
helpController.addHelpQuestion();
// Clear the feedback form
helpController.formKey.currentState!
.reset();
}
},
title: 'Submit Question'.tr,
),
],
)),
// Clear the feedback form
helpController.formKey.currentState!
.reset();
}
},
child: Text('Submit Question'.tr),
),
],
),
),
),
)),
GetBuilder<HelpController>(
builder: (helpController) => Padding(
padding: const EdgeInsets.all(10),
child: Container(
height: Get.height * .45,
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 helpController
.helpQuestionDate['message'].length ==
0
? SizedBox()
: 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: () {
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,
),
),
],
),
),
),
),
const SizedBox(height: 20),
Expanded(
child: GetBuilder<HelpController>(
builder: (helpController) => Padding(
padding: const EdgeInsets.all(10),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: CupertinoColors.systemGrey2,
),
borderRadius: BorderRadius.circular(12.0),
),
child: ListView.builder(
itemCount: helpController.helpQuestionDate['message'] !=
null
? helpController.helpQuestionDate['message'].length
: 0,
itemBuilder: (BuildContext context, int index) {
var list =
helpController.helpQuestionDate['message'][index];
return Padding(
padding: const EdgeInsets.all(3),
child: Container(
padding: const EdgeInsets.symmetric(
vertical: 12, horizontal: 16),
decoration: BoxDecoration(
border: Border.all(
color: CupertinoColors.activeGreen,
width: 2,
),
borderRadius: BorderRadius.circular(12),
),
child: GestureDetector(
onTap: () {
helpController.getIndex(
list['id'], list['helpQuestion']);
helpController
.getHelpRepley(list['id'].toString());
Get.to(() => const HelpDetailsReplayPage());
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
list['helpQuestion'],
style: CupertinoTheme.of(context)
.textTheme
.textStyle,
overflow: TextOverflow.ellipsis,
),
),
);
},
),
Text(
list['datecreated'],
style: CupertinoTheme.of(context)
.textTheme
.tabLabelTextStyle,
),
],
),
),
),
);
},
),
)),
],
),
),
),
),
],
),
),
],
isleading: true,
),
);
}
}