Skip to content

Commit

Permalink
[gui] show rudimentary instance info
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-toterman committed Aug 2, 2023
1 parent f8dea3a commit 73905e9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
33 changes: 18 additions & 15 deletions src/client/desktop_gui/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
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;
Widget _buildInfosColumn(Iterable<VmInfo> infos) {
return Column(
children: infos
.map((info) => Text('${info.name} ${info.instanceStatus.status}'))
.toList(),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(child: Text('$_counter')),
floatingActionButton: FloatingActionButton(
onPressed: () => setState(() => _counter++),
),
);
Widget build(BuildContext context, WidgetRef ref) {
final body = ref.watch(vmInfosStreamProvider).when(
data: _buildInfosColumn,
error: (error, _) => Text('$error'),
loading: () => const Text('Loading...'),
);
return Scaffold(body: body);
}
}
16 changes: 8 additions & 8 deletions src/client/desktop_gui/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,26 +122,26 @@ packages:
dependency: "direct main"
description:
name: grpc
sha256: a73c16e4f6a4a819be892bb2c73cc1d0b00e36095f69b0738cc91a733e3d27ba
sha256: "4e9bff1ebb4ff370cf471b1ab85007b408ade867dcc34b551eee7ee7da573002"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.2.2"
http:
dependency: transitive
description:
name: http
sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2"
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
url: "https://pub.dev"
source: hosted
version: "0.13.6"
version: "1.1.0"
http2:
dependency: transitive
description:
name: http2
sha256: "3f1286baeae57e96f4bd156cb07ab39ad96cf0d1537eed80dbc65d00447b4e0e"
sha256: "38db0c4aa9f1cd238a5d2e86aa0cc7cc91c77e0c6c94ba64bbe85e4ff732a952"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.2.0"
http_parser:
dependency: transitive
description:
Expand Down Expand Up @@ -202,10 +202,10 @@ packages:
dependency: transitive
description:
name: protobuf
sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08"
sha256: "4034a02b7e231e7e60bff30a8ac13a7347abfdac0798595fae0b90a3f0afe759"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "3.0.0"
riverpod:
dependency: transitive
description:
Expand Down

0 comments on commit 73905e9

Please sign in to comment.