-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gui] show rudimentary instance info
- Loading branch information
1 parent
162ebd3
commit ce14db3
Showing
2 changed files
with
18 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,22 @@ | ||
import 'package:desktop_gui/grpc_client.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
void main() { | ||
runApp(const MaterialApp(home: MyHomePage())); | ||
runApp(const ProviderScope(child: MaterialApp(home: MyHomePage()))); | ||
} | ||
|
||
class MyHomePage extends StatefulWidget { | ||
class MyHomePage extends ConsumerWidget { | ||
const MyHomePage({super.key}); | ||
|
||
@override | ||
State<MyHomePage> createState() => _MyHomePageState(); | ||
} | ||
|
||
class _MyHomePageState extends State<MyHomePage> { | ||
int _counter = 0; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final infos = ref.watch(vmStatusesProvider); | ||
return Scaffold( | ||
body: Center(child: Text('$_counter')), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: () => setState(() => _counter++), | ||
), | ||
body: Row(children: [ | ||
for (final MapEntry(key: name, value: status) in infos.entries) | ||
Text('$name $status') | ||
]), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters