Skip to content

Commit

Permalink
fixed issue on report issue edit text.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Jun 24, 2024
1 parent 1a0406b commit f71e14f
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 133 deletions.
6 changes: 0 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190309154008-847fc94819f9/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 h1:twflg0XRTjwKpxb/jFExr4HGq6on2dEOmnL6FV+fgPw=
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
Expand Down Expand Up @@ -611,7 +610,6 @@ github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGu
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kataras/golog v0.1.9 h1:vLvSDpP7kihFGKFAvBSofYo7qZNULYSHOH2D7rPTKJk=
Expand Down Expand Up @@ -686,8 +684,6 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk=
github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
Expand Down Expand Up @@ -869,10 +865,8 @@ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA=
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac h1:wbW+Bybf9pXxnCFAOWZTqkRjAc7rAIwo2e1ArUhiHxg=
github.com/smartystreets/assertions v0.0.0-20190215210624-980c5ac6f3ac/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff h1:86HlEv0yBCry9syNuylzqznKXDK11p6D0DT596yNMys=
github.com/smartystreets/goconvey v0.0.0-20190306220146-200a235640ff/go.mod h1:KSQcGKpxUMHk3nbYzs/tIBAM2iDooCn0BmttHOJEbLs=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b/go.mod h1:P5HUIBuIWKbyjl083/loAegFkfbFNx5i2qEP4CNbm7E=
Expand Down
247 changes: 120 additions & 127 deletions lib/account/report_issue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ReportIssue extends StatefulWidget {
class _ReportIssueState extends State<ReportIssue> {
final emailFieldKey = GlobalKey<FormState>();
late final emailController = CustomTextEditingController(
text: sessionModel.userEmail.value,
formKey: emailFieldKey,
validator: (value) {
if (value == null || value.isEmpty) {
Expand All @@ -26,6 +27,7 @@ class _ReportIssueState extends State<ReportIssue> {
: 'please_enter_a_valid_email_address'.i18n;
},
);

final issueFieldKey = GlobalKey<FormState>();
late final issueController = CustomTextEditingController(
formKey: issueFieldKey,
Expand All @@ -48,145 +50,136 @@ class _ReportIssueState extends State<ReportIssue> {
return null;
});



@override
Widget build(BuildContext context) {
return sessionModel.emailAddress((
BuildContext context,
String emailAddress,
Widget? child,
) {
return BaseScreen(
title: 'report_an_issue'.i18n,
resizeToAvoidBottomInset: false,
body: Padding(
padding: const EdgeInsetsDirectional.only(
start: 20,
end: 20,
),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// * Email field
Container(
margin: const EdgeInsetsDirectional.only(
top: 24,
bottom: 8,
),
child: Form(
key: emailFieldKey,
child: CTextField(
initialValue: emailAddress,
controller: emailController,
autovalidateMode: AutovalidateMode.disabled,
label: 'email'.i18n,
onChanged: (value) {
setState(() {});
},
keyboardType: TextInputType.emailAddress,
prefixIcon: const CAssetImage(path: ImagePaths.email),
),
),
return BaseScreen(
title: 'report_an_issue'.i18n,
resizeToAvoidBottomInset: false,
body: Padding(
padding: const EdgeInsetsDirectional.only(
start: 20,
end: 20,
),
child: Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// * Email field
Container(
margin: const EdgeInsetsDirectional.only(
top: 24,
bottom: 8,
),
Container(
margin: const EdgeInsetsDirectional.only(
top: 8,
bottom: 8,
),
child: Form(
key: issueFieldKey,
child: DropdownButtonFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: grey3,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 2,
color: blue4,
),
),
prefixIcon: Transform.scale(
scale: 0.4,
child:
const CAssetImage(path: ImagePaths.alert))),
hint: CText('select_an_issue'.i18n, style: tsBody1),
value: issueController.text != ''
? issueController.text
: null,
icon: const CAssetImage(path: ImagePaths.arrow_down),
//iconSize: iconSize,
elevation: 16,
onChanged: (String? newValue) {
setState(() {
issueController.text = newValue!;
});
},
padding: isDesktop()
? const EdgeInsetsDirectional.only(
top: 8,
bottom: 8,
)
: const EdgeInsetsDirectional.all(0),
items: <String>[
'cannot_access_blocked_sites'.i18n,
'cannot_complete_purchase'.i18n,
'cannot_sign_in'.i18n,
'discover_not_working'.i18n,
'spinner_loads_endlessly'.i18n,
'slow'.i18n,
'cannot_link_devices'.i18n,
'application_crashes'.i18n,
'other'.i18n
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: CText(value, style: tsBody1),
);
}).toList(),
))),
const SizedBox(height: 8),
Form(
key: descFieldKey,
child: Form(
key: emailFieldKey,
child: CTextField(
tooltipMessage: 'report_description'.i18n,
controller: descController,
contentPadding: isDesktop()
? const EdgeInsetsDirectional.all(16.0)
: const EdgeInsetsDirectional.all(8.0),
hintText: 'issue_description'.i18n,
floatingLabelBehavior: FloatingLabelBehavior.always,
controller: emailController,
autovalidateMode: AutovalidateMode.disabled,
maxLines: 8,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.done,
label: 'email'.i18n,
onChanged: (value) {
setState(() {});
},
keyboardType: TextInputType.emailAddress,
prefixIcon: const CAssetImage(path: ImagePaths.email),
),
),
const Spacer(),
Tooltip(
message: isDesktop() ? '' : AppKeys.sendReport,
child: Button(
width: 200,
disabled: isButtonDisabled(),
text: 'send_report'.i18n,
onPressed: onSendReportTap,
)),
const SizedBox(
height: 56.0,
),
Container(
margin: const EdgeInsetsDirectional.only(
top: 8,
bottom: 8,
),
child: Form(
key: issueFieldKey,
child: DropdownButtonFormField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: grey3,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 2,
color: blue4,
),
),
prefixIcon: Transform.scale(
scale: 0.4,
child:
const CAssetImage(path: ImagePaths.alert))),
hint: CText('select_an_issue'.i18n, style: tsBody1),
value: issueController.text != ''
? issueController.text
: null,
icon: const CAssetImage(path: ImagePaths.arrow_down),
//iconSize: iconSize,
elevation: 16,
onChanged: (String? newValue) {
setState(() {
issueController.text = newValue!;
});
},
padding: isDesktop()
? const EdgeInsetsDirectional.only(
top: 8,
bottom: 8,
)
: const EdgeInsetsDirectional.all(0),
items: <String>[
'cannot_access_blocked_sites'.i18n,
'cannot_complete_purchase'.i18n,
'cannot_sign_in'.i18n,
'discover_not_working'.i18n,
'spinner_loads_endlessly'.i18n,
'slow'.i18n,
'cannot_link_devices'.i18n,
'application_crashes'.i18n,
'other'.i18n
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: CText(value, style: tsBody1),
);
}).toList(),
))),
const SizedBox(height: 8),
Form(
key: descFieldKey,
child: CTextField(
tooltipMessage: 'report_description'.i18n,
controller: descController,
contentPadding: isDesktop()
? const EdgeInsetsDirectional.all(16.0)
: const EdgeInsetsDirectional.all(8.0),
hintText: 'issue_description'.i18n,
floatingLabelBehavior: FloatingLabelBehavior.always,
autovalidateMode: AutovalidateMode.disabled,
maxLines: 8,
keyboardType: TextInputType.multiline,
textInputAction: TextInputAction.done,
onChanged: (value) {
setState(() {});
},
),
],
),
),
const Spacer(),
Tooltip(
message: isDesktop() ? '' : AppKeys.sendReport,
child: Button(
width: 200,
disabled: isButtonDisabled(),
text: 'send_report'.i18n,
onPressed: onSendReportTap,
)),
const SizedBox(
height: 56.0,
),
],
),
);
});
),
);
}

bool isButtonDisabled() {
Expand Down

0 comments on commit f71e14f

Please sign in to comment.