Skip to content

Commit 0975890

Browse files
authored
cs/Run valve isolation trace sample - update message (#410)
* update the message * update spaceline
1 parent c2a0170 commit 0975890

File tree

1 file changed

+101
-99
lines changed

1 file changed

+101
-99
lines changed

lib/samples/run_valve_isolation_trace/run_valve_isolation_trace.dart

Lines changed: 101 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,13 @@ class _RunValveIsolationTraceState extends State<RunValveIsolationTrace>
7777
// The selected category for filter barriers.
7878
UtilityCategory? _selectedCategory;
7979

80-
/// Set to include/exclude isolated features in the trace.
80+
// Set to include/exclude isolated features in the trace.
8181
var _isIncludeIsolatedFeatures = true;
8282

83+
// The Message to display on the banner.
84+
final String _message =
85+
'Tap on the map to add filter barriers, or run the trace directly without filter barriers.';
86+
8387
@override
8488
void initState() {
8589
super.initState();
@@ -106,32 +110,32 @@ class _RunValveIsolationTraceState extends State<RunValveIsolationTrace>
106110
@override
107111
Widget build(BuildContext context) {
108112
return Scaffold(
109-
body: Stack(
110-
children: [
111-
Column(
112-
children: [
113-
Expanded(
114-
// Add a map view to the widget tree and set a controller.
115-
child: ArcGISMapView(
116-
controllerProvider: () => _mapViewController,
117-
onMapViewReady: _onMapViewReady,
118-
onTap: _onTap,
113+
body: SafeArea(
114+
left: false,
115+
right: false,
116+
child: Stack(
117+
children: [
118+
Column(
119+
children: [
120+
Expanded(
121+
// Add a map view to the widget tree and set a controller.
122+
child: ArcGISMapView(
123+
controllerProvider: () => _mapViewController,
124+
onMapViewReady: _onMapViewReady,
125+
onTap: _onTap,
126+
),
119127
),
120-
),
121-
// Add the settings widget below the map view.
122-
_settingWidget(context),
123-
],
124-
),
125-
// Add a loading indicator while the map and utility network are loading.
126-
LoadingIndicator(
127-
visible: _loading,
128-
text: _loading ? _statusMessage : '',
129-
),
130-
// Display a banner with instructions at the top.
131-
SafeArea(
132-
left: false,
133-
right: false,
134-
child: IgnorePointer(
128+
// Add the settings widget below the map view.
129+
_settingWidget(context),
130+
],
131+
),
132+
// Add a loading indicator while the map and utility network are loading.
133+
LoadingIndicator(
134+
visible: _loading,
135+
text: _loading ? _statusMessage : '',
136+
),
137+
// Display a banner with instructions at the top.
138+
IgnorePointer(
135139
child: Container(
136140
padding: const EdgeInsets.all(5),
137141
color: Colors.white.withValues(alpha: 0.7),
@@ -150,85 +154,83 @@ class _RunValveIsolationTraceState extends State<RunValveIsolationTrace>
150154
),
151155
),
152156
),
153-
),
154-
],
157+
],
158+
),
155159
),
156160
);
157161
}
158162

159163
// Configurations for utility network tracing.
160164
Widget _settingWidget(BuildContext context) {
161-
return SafeArea(
162-
child: Padding(
163-
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
164-
child: Column(
165-
crossAxisAlignment: CrossAxisAlignment.start,
166-
spacing: 4,
167-
children: [
168-
const Text('Choose Category for Filter Barriers:'),
169-
Row(
170-
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
171-
spacing: 4,
172-
children: [
173-
// The dropdown for categories.
174-
Expanded(
175-
child: DropdownButton(
176-
isExpanded: true,
177-
value: _selectedCategory,
178-
hint: const Text('Select category'),
179-
items: _categories.map((category) {
180-
return DropdownMenuItem(
181-
value: category,
182-
child: Text(
183-
category.name,
184-
style: Theme.of(context).textTheme.bodyMedium,
185-
),
186-
);
187-
}).toList(),
188-
onChanged: (value) {
189-
setState(() {
190-
_selectedCategory = value;
191-
});
192-
},
193-
),
194-
),
195-
// The button to start tracing.
196-
ElevatedButton(
197-
onPressed: _traceEnabled ? _onTrace : null,
198-
child: const Text('Trace'),
199-
),
200-
// The button to reset the trace.
201-
ElevatedButton(
202-
onPressed: _resetEnabled ? _clear : null,
203-
child: const Text('Reset'),
204-
),
205-
],
206-
),
207-
// The Switch for including isolated features.
208-
Row(
209-
spacing: 4,
210-
children: [
211-
Text(
212-
'Include isolated features',
213-
style: TextStyle(
214-
color: (_selectedCategory == null)
215-
? Colors.grey
216-
: Theme.of(context).textTheme.bodyMedium?.color,
217-
),
165+
return Padding(
166+
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
167+
child: Column(
168+
crossAxisAlignment: CrossAxisAlignment.start,
169+
spacing: 4,
170+
children: [
171+
const Text('Choose Category for Filter Barriers:'),
172+
Row(
173+
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
174+
spacing: 4,
175+
children: [
176+
// The dropdown for categories.
177+
Expanded(
178+
child: DropdownButton(
179+
isExpanded: true,
180+
value: _selectedCategory,
181+
hint: const Text('Select category'),
182+
items: _categories.map((category) {
183+
return DropdownMenuItem(
184+
value: category,
185+
child: Text(
186+
category.name,
187+
style: Theme.of(context).textTheme.bodyMedium,
188+
),
189+
);
190+
}).toList(),
191+
onChanged: (value) {
192+
setState(() {
193+
_selectedCategory = value;
194+
});
195+
},
218196
),
219-
Switch(
220-
value: _isIncludeIsolatedFeatures,
221-
onChanged: (v) =>
222-
setState(() => _isIncludeIsolatedFeatures = v),
197+
),
198+
// The button to start tracing.
199+
ElevatedButton(
200+
onPressed: _traceEnabled ? _onTrace : null,
201+
child: const Text('Trace'),
202+
),
203+
// The button to reset the trace.
204+
ElevatedButton(
205+
onPressed: _resetEnabled ? _clear : null,
206+
child: const Text('Reset'),
207+
),
208+
],
209+
),
210+
// The Switch for including isolated features.
211+
Row(
212+
spacing: 4,
213+
children: [
214+
Text(
215+
'Include isolated features',
216+
style: TextStyle(
217+
color: (_selectedCategory == null)
218+
? Colors.grey
219+
: Theme.of(context).textTheme.bodyMedium?.color,
223220
),
224-
if (_isIncludeIsolatedFeatures)
225-
const Text('On')
226-
else
227-
const Text('Off'),
228-
],
229-
),
230-
],
231-
),
221+
),
222+
Switch(
223+
value: _isIncludeIsolatedFeatures,
224+
onChanged: (v) =>
225+
setState(() => _isIncludeIsolatedFeatures = v),
226+
),
227+
if (_isIncludeIsolatedFeatures)
228+
const Text('On')
229+
else
230+
const Text('Off'),
231+
],
232+
),
233+
],
232234
),
233235
);
234236
}
@@ -309,8 +311,7 @@ class _RunValveIsolationTraceState extends State<RunValveIsolationTrace>
309311
_loadCategories();
310312

311313
setState(() {
312-
_statusMessage =
313-
'Tap on the map to add filter barriers, or run the trace directly without filter barriers.';
314+
_statusMessage = _message;
314315
_traceEnabled = true;
315316
});
316317
}
@@ -427,6 +428,7 @@ class _RunValveIsolationTraceState extends State<RunValveIsolationTrace>
427428
);
428429

429430
setState(() {
431+
_statusMessage = _message;
430432
_resetEnabled = true;
431433
});
432434
}

0 commit comments

Comments
 (0)