@@ -5,18 +5,16 @@ import 'dart:typed_data';
55import 'package:device_client/model/app_data.dart' ;
66import 'package:device_client/model/tc_interface.dart' ;
77import '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;
910import 'package:flutter/material.dart' ;
1011import 'package:http/http.dart' as http;
1112import 'package:http_parser/http_parser.dart' ;
1213import 'package:provider/provider.dart' ;
1314import 'package:version/version.dart' ;
1415
1516class 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 ),
0 commit comments