@@ -14,7 +14,7 @@ void main() {
1414}
1515
1616class App extends StatelessWidget {
17- const App ({Key ? key}) : super ( key: key );
17+ const App ({super . key} );
1818
1919 @override
2020 Widget build (BuildContext context) {
@@ -29,7 +29,7 @@ class App extends StatelessWidget {
2929}
3030
3131class HomePage extends StatefulWidget {
32- const HomePage ({Key ? key}) : super ( key: key );
32+ const HomePage ({super . key} );
3333
3434 @override
3535 _HomePageState createState () => _HomePageState ();
@@ -39,6 +39,7 @@ class _HomePageState extends State<HomePage> {
3939 AnalysisInfoInterface ? info;
4040 String ? cpuInfo;
4141 String ? memInfo;
42+ String ? btrInfo;
4243
4344 String getInfoData () {
4445 final raw = info? .toMap () ?? {};
@@ -142,6 +143,24 @@ class _HomePageState extends State<HomePage> {
142143 padding: const EdgeInsets .symmetric (horizontal: 16 ),
143144 child: SelectableText (memInfo ?? '-' ),
144145 ),
146+ Padding (
147+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
148+ child: ElevatedButton (
149+ onPressed: () async {
150+ final temperature = await BatteryInfoProvider ().temperature;
151+ final chargeLevel = await BatteryInfoProvider ().chargeLevel;
152+ btrInfo = 'Temp: $temperature \n '
153+ 'Level: $chargeLevel ' ;
154+ setState (() {});
155+ },
156+ child: const Text ('Get Battery Info' ),
157+ ),
158+ ),
159+ const SizedBox (height: 16 ),
160+ Padding (
161+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
162+ child: SelectableText (btrInfo ?? '-' ),
163+ ),
145164 const SizedBox (height: 24 ),
146165 ],
147166 ),
0 commit comments