mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-22 17:58:44 +02:00
add terminal page
This commit is contained in:
@@ -31,6 +31,7 @@ final _theme = ThemeData
|
||||
hintColor: Colors.yellow,
|
||||
primarySwatch: Colors.green,
|
||||
accentColor: Colors.green,
|
||||
cursorColor: Colors.green,
|
||||
|
||||
scaffoldBackgroundColor: Colors.black,
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ class _CyberWOW_PageState extends State<CyberWOW_Page> with WidgetsBindingObserv
|
||||
AppState _state;
|
||||
AppLifecycleState _notification = AppLifecycleState.resumed;
|
||||
final syncedPageController = PageController(
|
||||
initialPage: 0,
|
||||
initialPage: 1,
|
||||
);
|
||||
|
||||
bool _exiting = false;
|
||||
|
||||
@@ -233,7 +233,8 @@ class SyncedState extends HookedState {
|
||||
List<dynamic> getConnections = [];
|
||||
List<dynamic> getTransactionPool = [];
|
||||
|
||||
final terminalController = TextEditingController();
|
||||
FocusNode focusNode = FocusNode();
|
||||
TextEditingController textController = TextEditingController();
|
||||
|
||||
SyncedState(f1, f2, f3, this.stdout, this.processInput, this.processOutput) : super (f1, f2, f3);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'dart:collection';
|
||||
import '../state.dart';
|
||||
import '../config.dart' as config;
|
||||
import '../helper.dart';
|
||||
import '../logging.dart';
|
||||
|
||||
Widget summary(BuildContext context, SyncedState state) {
|
||||
return Container
|
||||
@@ -145,9 +146,42 @@ Widget getTransactionPool(BuildContext context, SyncedState state) => rpcView(co
|
||||
|
||||
|
||||
Widget terminalView(BuildContext context, String title, SyncedState state) {
|
||||
final input = TextFormField
|
||||
(
|
||||
controller: state.textController,
|
||||
textInputAction: TextInputAction.done,
|
||||
autofocus: true,
|
||||
autocorrect: false,
|
||||
focusNode: state.focusNode,
|
||||
decoration:
|
||||
InputDecoration
|
||||
(
|
||||
// border: UnderlineInputBorder // OutlineInputBorder
|
||||
// (
|
||||
// ),
|
||||
// hintText: 'WOW',
|
||||
enabledBorder: UnderlineInputBorder
|
||||
(
|
||||
borderSide: BorderSide
|
||||
(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
onFieldSubmitted: (v) {
|
||||
if (state.textController.text != '') {
|
||||
FocusScope.of(context).requestFocus(state.focusNode);
|
||||
log.finer('terminal input: ${state.textController.text}');
|
||||
state.appendInput(state.textController.text);
|
||||
state.textController.clear();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return Container
|
||||
(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
// padding: const EdgeInsets.all(10.0),
|
||||
child: Align
|
||||
(
|
||||
alignment: Alignment.topLeft,
|
||||
@@ -162,25 +196,12 @@ Widget terminalView(BuildContext context, String title, SyncedState state) {
|
||||
child: SingleChildScrollView
|
||||
(
|
||||
scrollDirection: Axis.vertical,
|
||||
reverse: true,
|
||||
child: Column
|
||||
(
|
||||
children: <Widget>
|
||||
[
|
||||
|
||||
Container(
|
||||
height: 0,
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
),
|
||||
Text
|
||||
(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.display1,
|
||||
),
|
||||
Container(
|
||||
height: 1,
|
||||
color: Theme.of(context).primaryColor,
|
||||
margin: const EdgeInsets.only(bottom: 20, top: 20),
|
||||
),
|
||||
Text
|
||||
(
|
||||
state.stdout.join(),
|
||||
@@ -190,26 +211,10 @@ Widget terminalView(BuildContext context, String title, SyncedState state) {
|
||||
)
|
||||
)
|
||||
),
|
||||
TextField
|
||||
Container
|
||||
(
|
||||
controller: state.terminalController,
|
||||
decoration: InputDecoration
|
||||
(
|
||||
border: OutlineInputBorder
|
||||
(
|
||||
borderSide: BorderSide
|
||||
(
|
||||
),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder
|
||||
(
|
||||
borderSide: BorderSide
|
||||
(
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
autofocus: true,
|
||||
margin: const EdgeInsets.all(10.0),
|
||||
child: input,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user