Skip to content

Commit 1518e9d

Browse files
Move the progress indicator to only replace the title widget (#194)
1 parent d369a69 commit 1518e9d

File tree

1 file changed

+77
-73
lines changed

1 file changed

+77
-73
lines changed

lib/samples/query_related_features/query_related_features.dart

Lines changed: 77 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -62,85 +62,84 @@ class _QueryRelatedFeaturesState extends State<QueryRelatedFeatures>
6262
}
6363

6464
Widget buildLayerData(BuildContext context) {
65-
return _loadingFeatures
66-
? const CircularProgressIndicator()
67-
: Container(
68-
constraints: BoxConstraints(
69-
maxHeight: MediaQuery.sizeOf(context).height * 0.4,
70-
),
71-
padding: EdgeInsets.fromLTRB(
72-
20.0,
73-
5.0,
74-
20.0,
75-
max(
76-
20.0,
77-
View.of(context).viewPadding.bottom /
78-
View.of(context).devicePixelRatio,
79-
),
80-
),
81-
width: double.infinity,
82-
child: Column(
83-
children: [
84-
Row(
85-
children: [
86-
Expanded(
87-
child: Text(
65+
return Container(
66+
constraints: BoxConstraints(
67+
maxHeight: MediaQuery.sizeOf(context).height * 0.4,
68+
),
69+
padding: EdgeInsets.fromLTRB(
70+
20.0,
71+
5.0,
72+
20.0,
73+
max(
74+
20.0,
75+
View.of(context).viewPadding.bottom /
76+
View.of(context).devicePixelRatio,
77+
),
78+
),
79+
width: double.infinity,
80+
child: Column(
81+
children: [
82+
Row(
83+
children: [
84+
Expanded(
85+
child: _loadingFeatures
86+
? const Center(child: CircularProgressIndicator())
87+
: Text(
8888
_selectedParkName,
8989
style: Theme.of(context).textTheme.titleLarge,
9090
),
91+
),
92+
IconButton(
93+
alignment: Alignment.centerRight,
94+
icon: const Icon(Icons.close),
95+
onPressed: () => setState(() => _layerDataVisible = false),
96+
),
97+
],
98+
),
99+
const Divider(),
100+
Flexible(
101+
child: SingleChildScrollView(
102+
child: Column(
103+
mainAxisSize: MainAxisSize.min,
104+
children: [
105+
Text(
106+
'Alaska National Parks Preserves',
107+
style: Theme.of(context).textTheme.titleMedium,
108+
),
109+
const Divider(),
110+
// Display the list of feature preserves for the selected park.
111+
for (final preserve in _featurePreserves)
112+
ListTile(
113+
dense: true,
114+
contentPadding: EdgeInsets.zero,
115+
title: Text(
116+
preserve,
117+
style: Theme.of(context).textTheme.titleSmall,
118+
),
91119
),
92-
IconButton(
93-
alignment: Alignment.centerRight,
94-
icon: const Icon(Icons.close),
95-
onPressed: () =>
96-
setState(() => _layerDataVisible = false),
97-
),
98-
],
99-
),
100-
const Divider(),
101-
Flexible(
102-
child: SingleChildScrollView(
103-
child: Column(
104-
mainAxisSize: MainAxisSize.min,
105-
children: [
106-
Text(
107-
'Alaska National Parks Preserves',
108-
style: Theme.of(context).textTheme.titleMedium,
109-
),
110-
const Divider(),
111-
// Display the list of feature preserves for the selected park.
112-
for (final preserve in _featurePreserves)
113-
ListTile(
114-
dense: true,
115-
contentPadding: EdgeInsets.zero,
116-
title: Text(
117-
preserve,
118-
style: Theme.of(context).textTheme.titleSmall,
119-
),
120-
),
121-
const Divider(),
122-
Text(
123-
'Alaska National Parks Species',
124-
style: Theme.of(context).textTheme.titleMedium,
125-
),
126-
const Divider(),
127-
// Display the list of feature species for the selected park.
128-
for (final species in _featureSpecies)
129-
ListTile(
130-
dense: true,
131-
contentPadding: EdgeInsets.zero,
132-
title: Text(
133-
species,
134-
style: Theme.of(context).textTheme.titleSmall,
135-
),
136-
),
137-
],
138-
),
120+
const Divider(),
121+
Text(
122+
'Alaska National Parks Species',
123+
style: Theme.of(context).textTheme.titleMedium,
139124
),
140-
),
141-
],
125+
const Divider(),
126+
// Display the list of feature species for the selected park.
127+
for (final species in _featureSpecies)
128+
ListTile(
129+
dense: true,
130+
contentPadding: EdgeInsets.zero,
131+
title: Text(
132+
species,
133+
style: Theme.of(context).textTheme.titleSmall,
134+
),
135+
),
136+
],
137+
),
142138
),
143-
);
139+
),
140+
],
141+
),
142+
);
144143
}
145144

146145
void onMapViewReady() async {
@@ -212,6 +211,11 @@ class _QueryRelatedFeaturesState extends State<QueryRelatedFeatures>
212211

213212
// If there are features identified, show the bottom sheet to display the
214213
// attachment information for the selected feature.
214+
setState(() {
215+
_selectedParkName = '';
216+
_featurePreserves = [];
217+
_featureSpecies = [];
218+
});
215219
final features =
216220
identifyLayerResult.geoElements.whereType<Feature>().toList();
217221
if (features.isNotEmpty) {

0 commit comments

Comments
 (0)