Skip to content

Commit 74964c1

Browse files
committed
[job_detail_screen] Remove refresh indicator to reload job description
1 parent 25c3f0a commit 74964c1

File tree

1 file changed

+64
-69
lines changed

1 file changed

+64
-69
lines changed

lib/screens/job_detail_screen.dart

Lines changed: 64 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -251,85 +251,80 @@ class _DescriptionSectionState extends State<DescriptionSection>
251251
@override
252252
Widget build(BuildContext context) {
253253
super.build(context);
254-
return RefreshIndicator(
255-
onRefresh: () async {
256-
_getJob(context);
257-
},
258-
child: SingleChildScrollView(
259-
child: Column(
260-
children: [
261-
JobLeadSection(
262-
widget.job,
263-
initialIndex: getSources().indexWhere(
264-
(element) => element.title == widget.source.title),
254+
return SingleChildScrollView(
255+
child: Column(
256+
children: [
257+
JobLeadSection(
258+
widget.job,
259+
initialIndex: getSources()
260+
.indexWhere((element) => element.title == widget.source.title),
261+
),
262+
Card(
263+
shape: RoundedRectangleBorder(
264+
borderRadius: BorderRadius.circular(8.0),
265265
),
266-
Card(
267-
shape: RoundedRectangleBorder(
268-
borderRadius: BorderRadius.circular(8.0),
269-
),
270-
child: Padding(
271-
padding: const EdgeInsets.all(8.0),
272-
child: BlocProvider(
273-
create: (_) => JobDescriptionBloc()
274-
..add(
275-
FetchJobDescription(
276-
job: widget.job,
277-
source: widget.source,
278-
),
266+
child: Padding(
267+
padding: const EdgeInsets.all(8.0),
268+
child: BlocProvider(
269+
create: (_) => JobDescriptionBloc()
270+
..add(
271+
FetchJobDescription(
272+
job: widget.job,
273+
source: widget.source,
279274
),
280-
child: BlocConsumer<JobDescriptionBloc, JobDescriptionState>(
281-
listener: (context, jobDescriptionState) {},
282-
builder: (context, jobDescriptionState) {
283-
return switch (jobDescriptionState) {
284-
JobDescriptionLoaded(job: final job) => switch (
285-
job.description.isNotEmpty) {
286-
true => HtmlWidget(
287-
job.description,
288-
textStyle: const TextStyle(
289-
fontSize: 14.0,
290-
),
291-
onTapUrl: (url) async {
292-
url = url
293-
.replaceAll(RegExp('mailto:'), '')
294-
.trim();
295-
if (url.contains('@')) {
296-
final emailUri = Uri(
297-
scheme: 'mailto',
298-
path: url,
299-
query: _encodeQueryParameters(
300-
{
301-
'subject': widget.job.position,
302-
},
303-
),
304-
);
275+
),
276+
child: BlocConsumer<JobDescriptionBloc, JobDescriptionState>(
277+
listener: (context, jobDescriptionState) {},
278+
builder: (context, jobDescriptionState) {
279+
return switch (jobDescriptionState) {
280+
JobDescriptionLoaded(job: final job) => switch (
281+
job.description.isNotEmpty) {
282+
true => HtmlWidget(
283+
job.description,
284+
textStyle: const TextStyle(
285+
fontSize: 14.0,
286+
),
287+
onTapUrl: (url) async {
288+
url = url
289+
.replaceAll(RegExp('mailto:'), '')
290+
.trim();
291+
if (url.contains('@')) {
292+
final emailUri = Uri(
293+
scheme: 'mailto',
294+
path: url,
295+
query: _encodeQueryParameters(
296+
{
297+
'subject': widget.job.position,
298+
},
299+
),
300+
);
305301

306-
if (await canLaunchUrl(emailUri)) {
307-
await launchUrl(emailUri);
308-
}
302+
if (await canLaunchUrl(emailUri)) {
303+
await launchUrl(emailUri);
309304
}
305+
}
310306

311-
return true;
312-
},
313-
),
314-
_ => Container()
315-
},
316-
JobDescriptionError(error: final error) => Center(
317-
child: ErrorButton(
318-
errorMessage: error,
319-
onRetryPressed: () => _onRetryPressed(context),
307+
return true;
308+
},
320309
),
310+
_ => Container()
311+
},
312+
JobDescriptionError(error: final error) => Center(
313+
child: ErrorButton(
314+
errorMessage: error,
315+
onRetryPressed: () => _onRetryPressed(context),
321316
),
322-
_ => const Center(
323-
child: CircularProgressIndicator(),
324-
),
325-
};
326-
},
327-
),
317+
),
318+
_ => const Center(
319+
child: CircularProgressIndicator(),
320+
),
321+
};
322+
},
328323
),
329324
),
330325
),
331-
],
332-
),
326+
),
327+
],
333328
),
334329
);
335330
}

0 commit comments

Comments
 (0)