269 lines
11 KiB
Dart
269 lines
11 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:regroup/Common/CommonButton.dart';
|
|
import 'package:regroup/Common/CommonDropDown.dart';
|
|
import 'package:regroup/Common/base_manager.dart';
|
|
import 'package:regroup/Main_Screens/ProfileTab/view_model/profilePostmethod.dart';
|
|
import 'package:regroup/Utils/Common/CommonAppbar.dart';
|
|
import 'package:regroup/Utils/Common/CommonDropdown.dart';
|
|
import 'package:regroup/Utils/Common/CustomNextButton.dart';
|
|
import 'package:regroup/Utils/Common/CustomTextformfield.dart';
|
|
|
|
import 'package:regroup/Utils/Common/sized_box.dart';
|
|
import 'package:regroup/Utils/dialogs.dart';
|
|
import 'package:regroup/Utils/texts.dart';
|
|
import 'package:remove_emoji_input_formatter/remove_emoji_input_formatter.dart';
|
|
|
|
class ReportABug extends StatefulWidget {
|
|
const ReportABug({super.key});
|
|
|
|
@override
|
|
State<ReportABug> createState() => _ReportABugState();
|
|
}
|
|
|
|
class _ReportABugState extends State<ReportABug> {
|
|
final GlobalKey<FormState> _formkey = GlobalKey<FormState>();
|
|
TextEditingController deviceoscontroller = TextEditingController();
|
|
TextEditingController versionoscontroller = TextEditingController();
|
|
TextEditingController emailcontroller = TextEditingController();
|
|
TextEditingController querycontroller = TextEditingController();
|
|
|
|
String _selectedreasontocontact = '';
|
|
|
|
void _onItemSelected(String value) {
|
|
setState(() {
|
|
_selectedreasontocontact = value;
|
|
});
|
|
}
|
|
|
|
Uploadata() async {
|
|
utils.loader();
|
|
Map<String, dynamic> updata = {
|
|
"device": deviceoscontroller.text,
|
|
"version": versionoscontroller.text,
|
|
"email": emailcontroller.text,
|
|
"reason_to_contact": _selectedreasontocontact,
|
|
"query": querycontroller.text,
|
|
};
|
|
final data = await Profilepostmethod().postReportandbug(updata);
|
|
if (data.status == ResponseStatus.SUCCESS) {
|
|
Get.back();
|
|
Get.back();
|
|
print("report done");
|
|
return utils.showToast(data.message);
|
|
} else {
|
|
Get.back();
|
|
print("report not done");
|
|
return utils.showToast(data.message);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
|
child: Scaffold(
|
|
// key: _scaffoldKey1,
|
|
resizeToAvoidBottomInset: false,
|
|
backgroundColor: const Color(0xFF222935),
|
|
extendBody: true,
|
|
appBar: const CommonAppbar(
|
|
titleTxt: "Report a bug",
|
|
),
|
|
body: Stack(children: [
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage("assets/images/png/Ellipse 1496.png"),
|
|
fit: BoxFit.fill)),
|
|
),
|
|
SingleChildScrollView(
|
|
physics: const ScrollPhysics(),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
child: Form(
|
|
key: _formkey,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
sizedBoxHeight(20.h),
|
|
Row(
|
|
children: [
|
|
text16400white("Device OS"),
|
|
sizedBoxWidth(8.w),
|
|
Image.asset(
|
|
"assets/images/png/octicon_question-24.png",
|
|
height: 16.h,
|
|
width: 16.w,
|
|
)
|
|
],
|
|
),
|
|
sizedBoxHeight(15.h),
|
|
CustomTextFormField(
|
|
leadingIcon: SizedBox(
|
|
height: 25.h,
|
|
width: 15.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/VectorDevice.png",
|
|
height: 25.h,
|
|
width: 15.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
validator: (value) {
|
|
if (value!.isEmpty) {
|
|
return 'Enter your device os';
|
|
}
|
|
return null;
|
|
},
|
|
inputFormatters: [
|
|
// LengthLimitingTextInputFormatter(20),
|
|
RemoveEmojiInputFormatter(),
|
|
FilteringTextInputFormatter.allow(
|
|
RegExp('[a-zA-Z ]'))
|
|
],
|
|
hintText: "Enter decice os",
|
|
textEditingController: deviceoscontroller,
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
Row(
|
|
children: [
|
|
text16400white("OS version"),
|
|
sizedBoxWidth(8.w),
|
|
Image.asset(
|
|
"assets/images/png/octicon_question-24.png",
|
|
height: 16.h,
|
|
width: 16.w,
|
|
)
|
|
],
|
|
),
|
|
sizedBoxHeight(15.h),
|
|
CustomTextFormField(
|
|
leadingIcon: SizedBox(
|
|
height: 23.h,
|
|
width: 23.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/setting2.png",
|
|
height: 23.h,
|
|
width: 23.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
validator: (value) {
|
|
if (value!.isEmpty) {
|
|
return 'Enter your os version';
|
|
}
|
|
return null;
|
|
},
|
|
inputFormatters: [
|
|
// LengthLimitingTextInputFormatter(20),
|
|
RemoveEmojiInputFormatter(),
|
|
],
|
|
hintText: "Enter os verison",
|
|
textEditingController: versionoscontroller,
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
text16400white("Email address"),
|
|
sizedBoxHeight(15.h),
|
|
CustomTextFormField(
|
|
leadingIcon: SizedBox(
|
|
height: 17.h,
|
|
width: 24.w,
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/images/png/Frame 12.png",
|
|
height: 17.h,
|
|
width: 22.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
validator: (value) {
|
|
if (value!.isEmpty) {
|
|
return 'Enter your e-mail address';
|
|
}
|
|
if (!RegExp(
|
|
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
|
|
.hasMatch(value)) {
|
|
return 'Enter a valid e-mail address';
|
|
}
|
|
return null;
|
|
},
|
|
inputFormatters: [
|
|
LengthLimitingTextInputFormatter(50),
|
|
RemoveEmojiInputFormatter()
|
|
],
|
|
textEditingController: emailcontroller,
|
|
hintText: "Enter email address",
|
|
),
|
|
sizedBoxHeight(10.h),
|
|
text16400white("Reason to contact"),
|
|
sizedBoxHeight(15.h),
|
|
CustomDropDownRadio(
|
|
header: "",
|
|
title: "",
|
|
listData: [
|
|
"Messaging",
|
|
"Crashes",
|
|
"Constant logout",
|
|
"Unable to view post"
|
|
],
|
|
onItemSelected: _onItemSelected,
|
|
leadingImage: Image.asset(
|
|
"assets/images/png/codicon_bug.png",
|
|
height: 23.h,
|
|
width: 23.w,
|
|
),
|
|
showOtherOption: true,
|
|
),
|
|
sizedBoxHeight(20.h),
|
|
text16400white("Query"),
|
|
sizedBoxHeight(15.h),
|
|
CustomTextFormField2(
|
|
maxlines: 3,
|
|
hintText: "Enter query",
|
|
validator: (value) {
|
|
if (value!.isEmpty) {
|
|
return 'Enter your full name ';
|
|
}
|
|
return null;
|
|
},
|
|
inputFormatters: [
|
|
// LengthLimitingTextInputFormatter(20),
|
|
RemoveEmojiInputFormatter(),
|
|
FilteringTextInputFormatter.allow(
|
|
RegExp('[a-zA-Z ]'))
|
|
],
|
|
textEditingController: querycontroller,
|
|
),
|
|
sizedBoxHeight(20.h),
|
|
CustomButton(
|
|
onPressed: () {
|
|
if (deviceoscontroller.text.isBlank! &&
|
|
versionoscontroller.text.isBlank! &&
|
|
querycontroller.text.isBlank! &&
|
|
emailcontroller.text.isBlank! &&
|
|
_selectedreasontocontact.isEmpty) {
|
|
utils.showToast("Please fill all fields");
|
|
} else {
|
|
Uploadata();
|
|
}
|
|
},
|
|
text: "Send")
|
|
]),
|
|
),
|
|
),
|
|
)
|
|
])),
|
|
);
|
|
}
|
|
}
|