mirror of
https://github.com/wownero/cyberwow.git
synced 2026-12-03 13:43:59 +01:00
persist page view index
This commit is contained in:
@@ -73,9 +73,6 @@ class _CyberWOW_PageState extends State<CyberWOW_Page> with WidgetsBindingObserv
|
||||
|
||||
AppState _state;
|
||||
AppLifecycleState _notification = AppLifecycleState.resumed;
|
||||
final syncedPageController = PageController(
|
||||
initialPage: 1,
|
||||
);
|
||||
|
||||
bool _exiting = false;
|
||||
|
||||
@@ -213,7 +210,7 @@ class _CyberWOW_PageState extends State<CyberWOW_Page> with WidgetsBindingObserv
|
||||
(s) => widget.buildBlank(context, s),
|
||||
(s) => widget.buildLoading(context, s),
|
||||
(s) => widget.buildSyncing(context, s),
|
||||
(s) => widget.buildSynced(context, s, syncedPageController),
|
||||
(s) => widget.buildSynced(context, s),
|
||||
(s) => widget.buildReSyncing(context, s),
|
||||
(s) => widget.buildExiting(context, s),
|
||||
),
|
||||
|
||||
+21
-7
@@ -215,7 +215,10 @@ class SyncingState extends HookedState {
|
||||
// processInput.add('exit');
|
||||
|
||||
final _height = await rpc.height();
|
||||
SyncedState _next = SyncedState(setState, getNotification, isExiting, stdout, processInput, processOutput);
|
||||
SyncedState _next = SyncedState
|
||||
(
|
||||
setState, getNotification, isExiting, stdout, processInput, processOutput, 1,
|
||||
);
|
||||
_next.height = _height;
|
||||
return moveState(_next);
|
||||
}
|
||||
@@ -232,17 +235,26 @@ class SyncedState extends HookedState {
|
||||
String syncInfo = 'syncInfo';
|
||||
List<dynamic> getConnections = [];
|
||||
List<dynamic> getTransactionPool = [];
|
||||
int pageIndex;
|
||||
|
||||
FocusNode focusNode = FocusNode();
|
||||
TextEditingController textController = TextEditingController();
|
||||
final FocusNode focusNode = FocusNode();
|
||||
final TextEditingController textController = TextEditingController();
|
||||
PageController pageController;
|
||||
|
||||
SyncedState(f1, f2, f3, this.stdout, this.processInput, this.processOutput) : super (f1, f2, f3);
|
||||
SyncedState(f1, f2, f3, this.stdout, this.processInput, this.processOutput, this.pageIndex)
|
||||
: super (f1, f2, f3) {
|
||||
pageController = PageController( initialPage: pageIndex );
|
||||
}
|
||||
|
||||
void appendInput(String line) {
|
||||
stdout.addLast('> ' + line + '\n');
|
||||
processInput.add(line);
|
||||
}
|
||||
|
||||
void onPageChanged(int value) {
|
||||
this.pageIndex = value;
|
||||
}
|
||||
|
||||
Future<HookedState> next() async {
|
||||
log.fine("Synced next");
|
||||
|
||||
@@ -300,7 +312,7 @@ class SyncedState extends HookedState {
|
||||
|
||||
ReSyncingState _next = ReSyncingState
|
||||
(
|
||||
setState, getNotification, isExiting, stdout, processInput, processOutput
|
||||
setState, getNotification, isExiting, stdout, processInput, processOutput, pageIndex
|
||||
);
|
||||
return moveState(_next);
|
||||
}
|
||||
@@ -312,8 +324,10 @@ class ReSyncingState extends HookedState {
|
||||
StreamSink<String> processInput;
|
||||
Stream<String> processOutput;
|
||||
bool synced = false;
|
||||
final int pageIndex;
|
||||
|
||||
ReSyncingState(f1, f2, f3, this.stdout, this.processInput, this.processOutput) : super (f1, f2, f3);
|
||||
ReSyncingState(f1, f2, f3, this.stdout, this.processInput, this.processOutput, this.pageIndex)
|
||||
: super (f1, f2, f3);
|
||||
|
||||
void append(String msg) {
|
||||
stdout.addLast(msg);
|
||||
@@ -364,7 +378,7 @@ class ReSyncingState extends HookedState {
|
||||
log.fine('resync: await exit');
|
||||
SyncedState _next = SyncedState
|
||||
(
|
||||
setState, getNotification, isExiting, stdout, processInput, processOutput
|
||||
setState, getNotification, isExiting, stdout, processInput, processOutput, pageIndex
|
||||
);
|
||||
_next.height = await rpc.height();
|
||||
return moveState(_next);
|
||||
|
||||
@@ -225,24 +225,25 @@ Widget terminalView(BuildContext context, String title, SyncedState state) {
|
||||
|
||||
Widget terminal(BuildContext context, SyncedState state) => terminalView(context, 'terminal', state);
|
||||
|
||||
Widget pageView (BuildContext context, SyncedState state, PageController controller) {
|
||||
Widget pageView (BuildContext context, SyncedState state) {
|
||||
return PageView (
|
||||
controller: controller,
|
||||
controller: state.pageController,
|
||||
onPageChanged: state.onPageChanged,
|
||||
children:
|
||||
[
|
||||
terminal(context, state),
|
||||
summary(context, state),
|
||||
getTransactionPool(context, state),
|
||||
getInfo(context, state),
|
||||
getConnections(context, state),
|
||||
getInfo(context, state),
|
||||
// syncInfo(state),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildSynced(BuildContext context, SyncedState state, PageController controller) {
|
||||
Widget buildSynced(BuildContext context, SyncedState state) {
|
||||
return Scaffold
|
||||
(
|
||||
body: pageView(context, state, controller)
|
||||
body: pageView(context, state)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user