Skip to content

Commit 7e17c34

Browse files
author
James Foster
committed
Formatting, lint, and library version issues.
1 parent 29e3e40 commit 7e17c34

33 files changed

Lines changed: 354 additions & 480 deletions

extras/device_client/lib/components/app_drawer.dart

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import 'package:device_client/model/version.dart';
77
import 'package:flutter/material.dart';
88

99
class AppDrawer extends StatelessWidget {
10-
const AppDrawer({
11-
required this.context,
12-
super.key,
13-
});
10+
const AppDrawer({required this.context, super.key});
1411

1512
final BuildContext context;
1613

@@ -29,9 +26,7 @@ class AppDrawer extends StatelessWidget {
2926
content: const Text(
3027
'Error connecting to Tank Controller. This is likely due to an incorrect IP address.',
3128
),
32-
actions: [
33-
okButton,
34-
],
29+
actions: [okButton],
3530
);
3631

3732
// show the dialog
@@ -123,11 +118,7 @@ class AppDrawer extends StatelessWidget {
123118
Widget drawerHeader(BuildContext context) {
124119
return ColoredBox(
125120
color: Colors.blue,
126-
child: DrawerHeader(
127-
child: Image.asset(
128-
'lib/assets/oap.png',
129-
),
130-
),
121+
child: DrawerHeader(child: Image.asset('lib/assets/oap.png')),
131122
);
132123
}
133124

@@ -148,17 +139,16 @@ class AppDrawer extends StatelessWidget {
148139
Future<void> updateDisplay() async {
149140
final appData = AppData.instance();
150141
final tcInterface = TcInterface.instance();
151-
final String value =
152-
await tcInterface.get(appData.currentTank.ip, 'display');
142+
final String value = await tcInterface.get(
143+
appData.currentTank.ip,
144+
'display',
145+
);
153146
appData.display = value; // setter notifies listeners of change
154147
}
155148

156149
Widget tile(Tank selected) {
157150
return ListTile(
158-
title: Text(
159-
selected.name,
160-
style: const TextStyle(color: Colors.white),
161-
),
151+
title: Text(selected.name, style: const TextStyle(color: Colors.white)),
162152
onTap: () {
163153
AppData.instance().currentTank = selected;
164154
unawaited(updateDisplay());

extras/device_client/lib/components/display.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import 'package:google_fonts/google_fonts.dart';
66
import 'package:provider/provider.dart';
77

88
class Display extends StatelessWidget {
9-
const Display({
10-
required BuildContext context,
11-
super.key,
12-
});
9+
const Display({required BuildContext context, super.key});
1310

1411
@override
1512
Widget build(BuildContext context) {

extras/device_client/lib/components/keypad.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import 'package:device_client/model/tc_interface.dart';
55
import 'package:flutter/material.dart';
66

77
class Keypad extends StatelessWidget {
8-
const Keypad({
9-
required this.context,
10-
super.key,
11-
});
8+
const Keypad({required this.context, super.key});
129

1310
final BuildContext context;
1411

extras/device_client/lib/components/nav_bar.dart

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,17 @@ import 'package:device_client/model/app_data.dart';
44
import 'package:flutter/material.dart';
55

66
class NavBar extends StatelessWidget {
7-
const NavBar({
8-
required this.context,
9-
super.key,
10-
});
7+
const NavBar({required this.context, super.key});
118

129
final BuildContext context;
1310

1411
final items = const <BottomNavigationBarItem>[
15-
BottomNavigationBarItem(
16-
icon: Icon(Icons.apps),
17-
label: 'Keypad',
18-
),
12+
BottomNavigationBarItem(icon: Icon(Icons.apps), label: 'Keypad'),
1913
BottomNavigationBarItem(
2014
icon: Icon(Icons.event_note_outlined),
2115
label: 'Current Data',
2216
),
23-
BottomNavigationBarItem(
24-
icon: Icon(Icons.folder),
25-
label: 'Files',
26-
),
17+
BottomNavigationBarItem(icon: Icon(Icons.folder), label: 'Files'),
2718
// BottomNavigationBarItem(
2819
// icon: Icon(Icons.bar_chart_rounded),
2920
// label: 'Graphs',

extras/device_client/lib/model/tank.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
class Tank {
22
Tank(this.name, this.ip);
33

4-
Tank.fromJson(Map json)
5-
: name = json['name'],
6-
ip = json['ip'];
4+
Tank.fromJson(Map json) : name = json['name'], ip = json['ip'];
75
String name;
86
String ip;
97

10-
Map toJson() => {
11-
'name': name,
12-
'ip': ip,
13-
};
8+
Map toJson() => {'name': name, 'ip': ip};
149

1510
@override
1611
bool operator ==(Object other) => hashCode == other.hashCode;

extras/device_client/lib/view/current_data_page.dart

Lines changed: 32 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,16 @@ import 'dart:typed_data';
55
import 'package:device_client/model/app_data.dart';
66
import 'package:device_client/model/tc_interface.dart';
77
import 'package:device_client/view/mock_html.dart'
8-
if (dart.library.html) 'dart:html' as html;
8+
if (dart.library.html) 'dart:html'
9+
as html;
910
import 'package:flutter/material.dart';
1011
import 'package:http/http.dart' as http;
1112
import 'package:http_parser/http_parser.dart';
1213
import 'package:provider/provider.dart';
1314
import 'package:version/version.dart';
1415

1516
class CurrentData extends StatelessWidget {
16-
const CurrentData({
17-
required this.context,
18-
super.key,
19-
});
17+
const CurrentData({required this.context, super.key});
2018

2119
final BuildContext context;
2220

@@ -42,13 +40,10 @@ class CurrentData extends StatelessWidget {
4240

4341
Future<void> putNewValue(String newValue, AppData appData) async {
4442
await TcInterface.instance()
45-
.put(
46-
'${appData.currentData["IPAddress"]}',
47-
'data?$key=$newValue',
48-
)
43+
.put('${appData.currentData["IPAddress"]}', 'data?$key=$newValue')
4944
.then((value) {
50-
appData.currentData = json.decode(value);
51-
});
45+
appData.currentData = json.decode(value);
46+
});
5247
if (context.mounted) {
5348
Navigator.pop(context);
5449
}
@@ -75,24 +70,18 @@ class CurrentData extends StatelessWidget {
7570
DropdownButtonFormField<String>(
7671
initialValue: value,
7772
items: const <DropdownMenuItem<String>>[
78-
DropdownMenuItem(
79-
value: 'OFF',
80-
child: Text('OFF'),
81-
),
82-
DropdownMenuItem(
83-
value: 'ON',
84-
child: Text('ON'),
85-
),
73+
DropdownMenuItem(value: 'OFF', child: Text('OFF')),
74+
DropdownMenuItem(value: 'ON', child: Text('ON')),
8675
],
8776
onChanged: (String? newValue) async {
8877
await TcInterface.instance()
8978
.put(
90-
'${appData.currentData["IPAddress"]}',
91-
'data?$key=$newValue',
92-
)
79+
'${appData.currentData["IPAddress"]}',
80+
'data?$key=$newValue',
81+
)
9382
.then((value) {
94-
appData.currentData = json.decode(value);
95-
});
83+
appData.currentData = json.decode(value);
84+
});
9685
if (context.mounted) {
9786
Navigator.pop(context);
9887
}
@@ -102,24 +91,18 @@ class CurrentData extends StatelessWidget {
10291
DropdownButtonFormField<String>(
10392
initialValue: value,
10493
items: const <DropdownMenuItem<String>>[
105-
DropdownMenuItem(
106-
value: 'CHILL',
107-
child: Text('CHILL'),
108-
),
109-
DropdownMenuItem(
110-
value: 'HEAT',
111-
child: Text('HEAT'),
112-
),
94+
DropdownMenuItem(value: 'CHILL', child: Text('CHILL')),
95+
DropdownMenuItem(value: 'HEAT', child: Text('HEAT')),
11396
],
11497
onChanged: (String? newValue) async {
11598
await TcInterface.instance()
11699
.put(
117-
'${appData.currentData["IPAddress"]}',
118-
'data?$key=$newValue',
119-
)
100+
'${appData.currentData["IPAddress"]}',
101+
'data?$key=$newValue',
102+
)
120103
.then((value) {
121-
appData.currentData = json.decode(value);
122-
});
104+
appData.currentData = json.decode(value);
105+
});
123106
if (context.mounted) {
124107
Navigator.pop(context);
125108
}
@@ -131,21 +114,19 @@ class CurrentData extends StatelessWidget {
131114
onFieldSubmitted: (val) async {
132115
await TcInterface.instance()
133116
.put(
134-
'${appData.currentData["IPAddress"]}',
135-
'data?$key=$val',
136-
)
117+
'${appData.currentData["IPAddress"]}',
118+
'data?$key=$val',
119+
)
137120
.then((value) {
138-
appData.currentData = json.decode(value);
139-
});
121+
appData.currentData = json.decode(value);
122+
});
140123
if (context.mounted) {
141124
Navigator.pop(context);
142125
}
143126
},
144127
),
145128
const SizedBox(height: 20),
146-
const Text(
147-
'Press "Esc" to cancel, or "Enter" to submit',
148-
),
129+
const Text('Press "Esc" to cancel, or "Enter" to submit'),
149130
],
150131
),
151132
),
@@ -166,11 +147,7 @@ class CurrentData extends StatelessWidget {
166147
child: Form(
167148
child: Column(
168149
mainAxisSize: MainAxisSize.min,
169-
children: <Widget>[
170-
Text(
171-
messageString,
172-
),
173-
],
150+
children: <Widget>[Text(messageString)],
174151
),
175152
),
176153
),
@@ -180,8 +157,9 @@ class CurrentData extends StatelessWidget {
180157
}
181158

182159
Future<void> sendArbitraryPathString(String arbitraryPath, String ip) async {
183-
final Uint8List bytes =
184-
const Base64Decoder().convert(arbitraryPath.split(',').last);
160+
final Uint8List bytes = const Base64Decoder().convert(
161+
arbitraryPath.split(',').last,
162+
);
185163
if (bytes.length > 10000) {
186164
await showPopupDialog('File too large', 'Your file exceeds 10 KB.');
187165
throw UnsupportedError('File too large');
@@ -275,12 +253,8 @@ class CurrentData extends StatelessWidget {
275253
DataTable(
276254
headingRowHeight: 0,
277255
columns: const <DataColumn>[
278-
DataColumn(
279-
label: Text('Key'),
280-
),
281-
DataColumn(
282-
label: Text('Value'),
283-
),
256+
DataColumn(label: Text('Key')),
257+
DataColumn(label: Text('Value')),
284258
],
285259
rows: currentDataRows,
286260
),

extras/device_client/lib/view/files_page.dart

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import 'package:provider/provider.dart';
66
import 'package:url_launcher/url_launcher.dart';
77

88
class Files extends StatelessWidget {
9-
const Files({
10-
required this.context,
11-
super.key,
12-
});
9+
const Files({required this.context, super.key});
1310

1411
final BuildContext context;
1512

@@ -32,9 +29,7 @@ class Files extends StatelessWidget {
3229
final String loc = 'http://$ip/$file';
3330
unawaited(launchUrl(Uri.parse(loc)));
3431
},
35-
child: Text(
36-
fileName.toString(),
37-
),
32+
child: Text(fileName.toString()),
3833
),
3934
),
4035
DataCell(
@@ -48,9 +43,9 @@ class Files extends StatelessWidget {
4843
),
4944
);
5045
fileRows.sort(
51-
(a, b) => a.cells[0].child
52-
.toString()
53-
.compareTo(b.cells[0].child.toString()),
46+
(a, b) => a.cells[0].child.toString().compareTo(
47+
b.cells[0].child.toString(),
48+
),
5449
);
5550
return ListView(
5651
children: <Widget>[

extras/device_client/lib/view/graphs_page.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
class Graphs extends StatelessWidget {
4-
const Graphs({
5-
required this.context,
6-
super.key,
7-
});
4+
const Graphs({required this.context, super.key});
85

96
final BuildContext context;
107

extras/device_client/lib/view/home_page.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ class _MyHomePageState extends State<MyHomePage> {
2525
child: Column(
2626
children: <Widget>[
2727
Display(context: context),
28-
Flexible(
29-
child: Keypad(context: context),
30-
),
28+
Flexible(child: Keypad(context: context)),
3129
],
3230
),
3331
);
@@ -44,9 +42,7 @@ class _MyHomePageState extends State<MyHomePage> {
4442
builder: (context, appData, child) {
4543
return Scaffold(
4644
appBar: AppBar(
47-
title: Text(
48-
'${widget.title}: ${appData.currentTank.name}',
49-
),
45+
title: Text('${widget.title}: ${appData.currentTank.name}'),
5046
// actions: [
5147
// _tankMonitorRedirect(),
5248
// ],

extras/device_client/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,5 +838,5 @@ packages:
838838
source: hosted
839839
version: "3.1.3"
840840
sdks:
841-
dart: ">=3.10.3 <4.0.0"
841+
dart: ">=3.11.0 <4.0.0"
842842
flutter: ">=3.38.4"

0 commit comments

Comments
 (0)