mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-20 08:48:43 +02:00
add daemon info
This commit is contained in:
@@ -93,6 +93,23 @@ Future<http.Response> getInfo() async {
|
||||
return rpc('get_info');
|
||||
}
|
||||
|
||||
|
||||
Future<String> getInfoString() async {
|
||||
var response = await getInfo();
|
||||
|
||||
if (response == null) return '';
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
return '';
|
||||
} else {
|
||||
final _getInfo = json.decode(response.body)['result'];
|
||||
|
||||
JsonEncoder encoder = new JsonEncoder.withIndent(' ');
|
||||
String _prettyInfo = encoder.convert(_getInfo);
|
||||
return _prettyInfo;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> offline() async {
|
||||
var response = await getInfo();
|
||||
|
||||
|
||||
@@ -197,6 +197,7 @@ class SyncedState extends HookedState {
|
||||
Stream<String> processOutput;
|
||||
bool synced = true;
|
||||
bool connected = true;
|
||||
String daemonInfo = 'daemonInfo';
|
||||
|
||||
SyncedState(f, s, this.stdout, this.processOutput) : super (f, s);
|
||||
|
||||
@@ -223,6 +224,7 @@ class SyncedState extends HookedState {
|
||||
// print('synced loop');
|
||||
height = await rpc.height();
|
||||
connected = await daemon.isConnected();
|
||||
daemonInfo = await rpc.getInfoString();
|
||||
syncState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,37 @@ Widget summary(SyncedState state) {
|
||||
Widget helloPage(SyncedState state) {
|
||||
return Container
|
||||
(
|
||||
child: Text('HelloPage'),
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
color: config.backgroundColor,
|
||||
child: Align
|
||||
(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Column
|
||||
(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>
|
||||
[
|
||||
Expanded
|
||||
(
|
||||
flex: 1,
|
||||
child: SingleChildScrollView
|
||||
(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Text
|
||||
(
|
||||
state.daemonInfo,
|
||||
style: TextStyle
|
||||
(
|
||||
fontFamily: 'RobotoMono',
|
||||
fontSize: 11,
|
||||
color: config.textColor,
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,8 +132,8 @@ Widget pageView (SyncedState state, PageController controller) {
|
||||
controller: controller,
|
||||
children:
|
||||
[
|
||||
summary(state),
|
||||
helloPage(state),
|
||||
summary(state),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user