Skip to content

Commit 9b1c330

Browse files
committed
Fix linter warnings (no functional changes)
1 parent 435235f commit 9b1c330

File tree

3 files changed

+87
-93
lines changed

3 files changed

+87
-93
lines changed

lib/screens/home.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class HomeScreen extends StatelessWidget {
322322
child: ChangeNotifierProvider<BleScanner>.value(
323323
value: bleScanner,
324324
child: Consumer<BleScanner>(
325-
builder: (_, model, __) => ListView.builder(
325+
builder: (_, model, _) => ListView.builder(
326326
padding: const EdgeInsets.all(8),
327327
itemCount: bleScanner.devices.length,
328328
itemBuilder: (BuildContext context, int index) {
@@ -387,7 +387,7 @@ class NodesList extends StatelessWidget {
387387
return ChangeNotifierProvider<ConnectorModel>(
388388
create: (_) => _connector,
389389
child: Consumer<ConnectorModel>(
390-
builder: (_, model, __) {
390+
builder: (_, model, _) {
391391
return FutureBuilder<void>(
392392
future: model.updateNodes(),
393393
builder: (context, snapshot) {

lib/screens/node.dart

Lines changed: 84 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ class NodeScreen extends StatefulWidget {
1616
final String connectorName;
1717
final String nodeId;
1818

19-
const NodeScreen(
20-
{super.key, required this.connectorName, required this.nodeId});
19+
const NodeScreen({
20+
super.key,
21+
required this.connectorName,
22+
required this.nodeId,
23+
});
2124

2225
@override
2326
State<NodeScreen> createState() => NodeScreenState();
@@ -28,8 +31,9 @@ class NodeScreenState extends State<NodeScreen> {
2831

2932
@override
3033
Widget build(BuildContext context) {
31-
ConnectorModel? connector =
32-
Provider.of<AppModel>(context).connector(widget.connectorName);
34+
ConnectorModel? connector = Provider.of<AppModel>(
35+
context,
36+
).connector(widget.connectorName);
3337
NodeModel? node = connector?.nodes[widget.nodeId];
3438
if (connector != null && node != null) {
3539
return Scaffold(
@@ -38,12 +42,7 @@ class NodeScreenState extends State<NodeScreen> {
3842
mainAxisAlignment: MainAxisAlignment.center,
3943
crossAxisAlignment: CrossAxisAlignment.start,
4044
children: [
41-
Text(
42-
node.name,
43-
style: const TextStyle(
44-
fontSize: 18.0,
45-
),
46-
),
45+
Text(node.name, style: const TextStyle(fontSize: 18.0)),
4746
Text(
4847
node.id,
4948
style: const TextStyle(
@@ -56,9 +55,7 @@ class NodeScreenState extends State<NodeScreen> {
5655
),
5756
body: (_selectedIndex == 0)
5857
? FutureBuilder<void>(
59-
future: Future.wait([
60-
connector.pullNodeRoot(node.id),
61-
]),
58+
future: Future.wait([connector.pullNodeRoot(node.id)]),
6259
builder: (context, snapshot) {
6360
if (snapshot.connectionState == ConnectionState.done) {
6461
return NodeData(connector: connector, node: node);
@@ -88,9 +85,7 @@ class NodeScreenState extends State<NodeScreen> {
8885
);
8986
} else {
9087
return Scaffold(
91-
appBar: AppBar(
92-
title: Text(widget.nodeId),
93-
),
88+
appBar: AppBar(title: Text(widget.nodeId)),
9489
body: const Center(child: Text('Node not found')),
9590
);
9691
}
@@ -115,7 +110,7 @@ class LiveView extends StatelessWidget {
115110
child: ChangeNotifierProvider<NodeModel>.value(
116111
value: node,
117112
child: Consumer<NodeModel>(
118-
builder: (_, model, __) => LiveChart(node: node),
113+
builder: (_, model, _) => LiveChart(node: node),
119114
),
120115
),
121116
);
@@ -133,7 +128,7 @@ class NodeData extends StatelessWidget {
133128
return ChangeNotifierProvider<NodeModel>.value(
134129
value: node,
135130
child: Consumer<NodeModel>(
136-
builder: (_, model, __) => ListView(
131+
builder: (_, model, _) => ListView(
137132
shrinkWrap: true,
138133
padding: const EdgeInsets.all(8),
139134
children: _listDataObjects(
@@ -191,7 +186,7 @@ List<Widget> _listDataObjects(
191186
itemName: item,
192187
path: path.isEmpty ? item : '$path/$item',
193188
data: data[item],
194-
)
189+
),
195190
];
196191

197192
List<String> tags = [];
@@ -201,14 +196,16 @@ List<Widget> _listDataObjects(
201196
}
202197
}
203198
if (tags.isNotEmpty) {
204-
list.add(Padding(
205-
padding: const EdgeInsets.all(8),
206-
child: Wrap(
207-
spacing: 8,
208-
runSpacing: 8,
209-
children: tags.map((tag) => Chip(label: Text(tag))).toList(),
199+
list.add(
200+
Padding(
201+
padding: const EdgeInsets.all(8),
202+
child: Wrap(
203+
spacing: 8,
204+
runSpacing: 8,
205+
children: tags.map((tag) => Chip(label: Text(tag))).toList(),
206+
),
210207
),
211-
));
208+
);
212209
}
213210

214211
return list;
@@ -217,10 +214,7 @@ List<Widget> _listDataObjects(
217214
class DataRecords extends StatelessWidget {
218215
final String name;
219216

220-
const DataRecords({
221-
super.key,
222-
required this.name,
223-
});
217+
const DataRecords({super.key, required this.name});
224218

225219
@override
226220
Widget build(BuildContext context) {
@@ -233,9 +227,7 @@ class DataRecords extends StatelessWidget {
233227
padding: const EdgeInsets.all(10),
234228
child: Text(
235229
name,
236-
style: const TextStyle(
237-
fontWeight: FontWeight.bold,
238-
),
230+
style: const TextStyle(fontWeight: FontWeight.bold),
239231
),
240232
),
241233
children: const <Widget>[
@@ -284,7 +276,12 @@ class DataGroup extends StatelessWidget {
284276
icon: const Icon(Icons.notifications, color: primaryColor),
285277
onPressed: () async {
286278
await _reportingSetupDialog(
287-
context, connector, node, groupName, '_Reporting/$path/_');
279+
context,
280+
connector,
281+
node,
282+
groupName,
283+
'_Reporting/$path/_',
284+
);
288285
},
289286
),
290287
IconButton(
@@ -314,24 +311,16 @@ class DataGroup extends StatelessWidget {
314311
padding: const EdgeInsets.all(10),
315312
child: Text(
316313
thingsetSplitCamelCaseName(groupName),
317-
style: const TextStyle(
318-
fontWeight: FontWeight.bold,
319-
),
314+
style: const TextStyle(fontWeight: FontWeight.bold),
320315
),
321316
),
322317
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
323318
children: <Widget>[
324319
if (data != null)
325320
...ListTile.divideTiles(
326321
context: context,
327-
tiles: _listDataObjects(
328-
context,
329-
connector,
330-
node,
331-
path,
332-
data,
333-
),
334-
)
322+
tiles: _listDataObjects(context, connector, node, path, data),
323+
),
335324
],
336325
onExpansionChanged: (value) async {
337326
if (value == true) {
@@ -361,7 +350,10 @@ class DataItem extends StatelessWidget {
361350
});
362351

363352
Future<void> execRequest(
364-
BuildContext context, String descr, List<dynamic> values) async {
353+
BuildContext context,
354+
String descr,
355+
List<dynamic> values,
356+
) async {
365357
var resp = await connector.exec(node.id, path, values);
366358
String msg = 'Execution failed.';
367359
if (resp != null) {
@@ -380,26 +372,28 @@ class DataItem extends StatelessWidget {
380372
msg = 'Received response with error code: $code';
381373
}
382374
}
383-
// ignore: use_build_context_synchronously
384-
await showDialog<String>(
385-
context: context,
386-
builder: (BuildContext context) => AlertDialog(
387-
title: Text(descr),
388-
content: Text(msg),
389-
actions: <Widget>[
390-
TextButton(
391-
onPressed: () => Navigator.pop(context, 'OK'),
392-
child: const Text('OK'),
393-
),
394-
],
395-
),
396-
);
375+
if (context.mounted) {
376+
await showDialog<String>(
377+
context: context,
378+
builder: (BuildContext context) => AlertDialog(
379+
title: Text(descr),
380+
content: Text(msg),
381+
actions: <Widget>[
382+
TextButton(
383+
onPressed: () => Navigator.pop(context, 'OK'),
384+
child: const Text('OK'),
385+
),
386+
],
387+
),
388+
);
389+
}
397390
}
398391

399392
@override
400393
Widget build(BuildContext context) {
401-
var descr =
402-
thingsetSplitCamelCaseName(itemName.split('_').first.substring(1));
394+
var descr = thingsetSplitCamelCaseName(
395+
itemName.split('_').first.substring(1),
396+
);
403397
var unit = thingsetParseUnit(itemName);
404398

405399
if (itemName[0] == 'x') {
@@ -472,21 +466,27 @@ class Subset extends StatelessWidget {
472466

473467
@override
474468
Widget build(BuildContext context) {
475-
var descr =
476-
thingsetSplitCamelCaseName(subsetName.split('_').first.substring(1));
469+
var descr = thingsetSplitCamelCaseName(
470+
subsetName.split('_').first.substring(1),
471+
);
477472

478473
final subsetType = subsetName[0] == 'm'
479474
? 'Metrics'
480475
: subsetName[0] == 'e'
481-
? 'Events'
482-
: 'Attributes';
476+
? 'Events'
477+
: 'Attributes';
483478

484479
Widget? icon = (node.hasReportingSetup(path))
485480
? IconButton(
486481
icon: const Icon(Icons.notifications, color: primaryColor),
487482
onPressed: () async {
488483
await _reportingSetupDialog(
489-
context, connector, node, subsetName, '_Reporting/$path');
484+
context,
485+
connector,
486+
node,
487+
subsetName,
488+
'_Reporting/$path',
489+
);
490490
},
491491
)
492492
: null;
@@ -502,9 +502,7 @@ class Subset extends StatelessWidget {
502502
padding: const EdgeInsets.all(10),
503503
child: Text(
504504
'$descr $subsetType',
505-
style: const TextStyle(
506-
fontWeight: FontWeight.bold,
507-
),
505+
style: const TextStyle(fontWeight: FontWeight.bold),
508506
),
509507
),
510508
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
@@ -520,7 +518,7 @@ class Subset extends StatelessWidget {
520518
Chip(
521519
label: Text(item),
522520
//onDeleted: () => {}
523-
)
521+
),
524522
],
525523
),
526524
),
@@ -532,11 +530,12 @@ class Subset extends StatelessWidget {
532530
}
533531

534532
Future<void> _reportingSetupDialog(
535-
BuildContext context,
536-
ConnectorModel connector,
537-
NodeModel node,
538-
String groupName,
539-
String path) async {
533+
BuildContext context,
534+
ConnectorModel connector,
535+
NodeModel node,
536+
String groupName,
537+
String path,
538+
) async {
540539
await connector.pull(node.id, path);
541540
// ignore: use_build_context_synchronously
542541
if (!context.mounted) return;
@@ -548,13 +547,7 @@ Future<void> _reportingSetupDialog(
548547
title: const Text('Reporting Setup'),
549548
children: <Widget>[
550549
if (data != null)
551-
..._listDataObjects(
552-
context,
553-
connector,
554-
node,
555-
path,
556-
data,
557-
),
550+
..._listDataObjects(context, connector, node, path, data),
558551
Row(
559552
mainAxisAlignment: MainAxisAlignment.center,
560553
children: [
@@ -573,13 +566,14 @@ Future<void> _reportingSetupDialog(
573566
},
574567
),
575568
TextButton(
576-
style: TextButton.styleFrom(
577-
textStyle: Theme.of(context).textTheme.labelLarge,
578-
),
579-
child: const Text('Cancel'),
580-
onPressed: () {
581-
Navigator.of(context).pop();
582-
}),
569+
style: TextButton.styleFrom(
570+
textStyle: Theme.of(context).textTheme.labelLarge,
571+
),
572+
child: const Text('Cancel'),
573+
onPressed: () {
574+
Navigator.of(context).pop();
575+
},
576+
),
583577
],
584578
),
585579
],

lib/theme.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final ColorScheme darkSheme = ColorScheme.fromSeed(
2424
final theme = ThemeData(
2525
colorScheme: lightScheme,
2626
appBarTheme: const AppBarTheme(
27-
color: primaryColor,
27+
backgroundColor: primaryColor,
2828
shadowColor: secondaryColor,
2929
elevation: 5,
3030
foregroundColor: Colors.white),

0 commit comments

Comments
 (0)