Skip to content

Commit e12db81

Browse files
committed
fix: replace unhandled throw with logger.e in FAQ screen launchUrl
_launchURL() in faq_screen.dart threw a raw string when canLaunchUrl returned false. This throw was never caught at the call site (onTap: () => _launchURL(faq.linkUrl!)), so it propagated up and crashed the app instead of failing gracefully. Replaced the throw with logger.e(), consistent with how launchUrl failures are already handled in about_us_screen.dart. Fixes #3384
1 parent 43d7eb6 commit e12db81

1 file changed

Lines changed: 22 additions & 38 deletions

File tree

lib/view/faq_screen.dart

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ class FAQScreen extends StatelessWidget {
3939
answer: appLocalizations.faqHowToConnectAnswer,
4040
),
4141
FAQItem(
42-
question: appLocalizations.faqReportBug,
43-
answer: appLocalizations.faqReportBugAnswer,
44-
linkText: appLocalizations.faqReportBugLinkText,
45-
linkUrl: appLocalizations.faqReportBugLinkUrl),
42+
question: appLocalizations.faqReportBug,
43+
answer: appLocalizations.faqReportBugAnswer,
44+
linkText: appLocalizations.faqReportBugLinkText,
45+
linkUrl: appLocalizations.faqReportBugLinkUrl,
46+
),
4647
FAQItem(
4748
question: appLocalizations.faqRecordData,
4849
answer: appLocalizations.faqRecordDataAnswer,
@@ -77,45 +78,30 @@ class FAQScreen extends StatelessWidget {
7778
collapsedShape: const Border(),
7879
title: Padding(
7980
padding: const EdgeInsets.only(bottom: 0),
80-
child: Row(children: [
81-
Text(
82-
appLocalizations.faqQ,
83-
style: TextStyle(
84-
color: primaryRed,
85-
),
86-
),
87-
const SizedBox(
88-
width: 10,
89-
),
90-
Flexible(
91-
child: Text(
92-
faq.question,
93-
style: TextStyle(
94-
color: primaryRed,
95-
),
81+
child: Row(
82+
children: [
83+
Text(appLocalizations.faqQ, style: TextStyle(color: primaryRed)),
84+
const SizedBox(width: 10),
85+
Flexible(
86+
child: Text(faq.question, style: TextStyle(color: primaryRed)),
9687
),
97-
),
98-
]),
88+
],
89+
),
9990
),
10091
childrenPadding: const EdgeInsets.fromLTRB(5, 0, 16, 16),
10192
expandedCrossAxisAlignment: CrossAxisAlignment.start,
10293
trailing: const SizedBox(),
10394
children: [
10495
Padding(
10596
padding: const EdgeInsets.only(top: 0),
106-
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
107-
Text(
108-
appLocalizations.faqA,
109-
),
110-
const SizedBox(
111-
width: 10,
112-
),
113-
Flexible(
114-
child: Text(
115-
faq.answer,
116-
),
117-
),
118-
]),
97+
child: Row(
98+
crossAxisAlignment: CrossAxisAlignment.start,
99+
children: [
100+
Text(appLocalizations.faqA),
101+
const SizedBox(width: 10),
102+
Flexible(child: Text(faq.answer)),
103+
],
104+
),
119105
),
120106
if (faq.linkText != null && faq.linkUrl != null)
121107
Padding(
@@ -124,9 +110,7 @@ class FAQScreen extends StatelessWidget {
124110
onTap: () => _launchURL(faq.linkUrl!),
125111
child: Row(
126112
children: [
127-
const SizedBox(
128-
width: 15,
129-
),
113+
const SizedBox(width: 15),
130114
Text(
131115
faq.linkText!,
132116
style: TextStyle(

0 commit comments

Comments
 (0)