Skip to content

Commit

Permalink
Auto scroll the console to end position
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Sep 5, 2024
1 parent 794ca05 commit 7d580f4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
1 change: 1 addition & 0 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
### GUI

- 修改了 Frpc 下载的处理逻辑
- 打开终端默认自动滚动到底部

### CLI

Expand Down
1 change: 1 addition & 0 deletions nyalcf_core/lib/network/dio/other/sign_other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class OtherSign {
);

Map<String, dynamic> resJson = resData.data;
Logger.debug(resJson);
// final String msg = resJson['message'];
if (resJson['status'] == 200) {
// int getTraffic =
Expand Down
12 changes: 9 additions & 3 deletions nyalcf_gui/nyalcf_ui/lib/views/panel/console.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'package:nyalcf_core_extend/utils/widget/after_layout.dart';
import 'package:nyalcf_ui/controllers/console_controller.dart';
import 'package:nyalcf_ui/controllers/frpc_controller.dart';
import 'package:nyalcf_ui/controllers/user_controller.dart';
Expand Down Expand Up @@ -98,9 +99,14 @@ class PanelConsole extends StatelessWidget {
child: Container(
margin: const EdgeInsets.all(10.0),
child: Obx(
() => ListView(
controller: scrollController,
children: _cCtr.processOut,
() => AfterLayout(
callback: (RenderAfterLayout ral) =>
scrollController.jumpTo(scrollController
.position.maxScrollExtent),
child: ListView(
controller: scrollController,
children: _cCtr.processOut,
),
),
),
),
Expand Down
17 changes: 11 additions & 6 deletions nyalcf_gui/nyalcf_ui/lib/views/panel/console_full.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'package:nyalcf_core_extend/utils/widget/after_layout.dart';
import 'package:nyalcf_ui/controllers/console_controller.dart';
import 'package:nyalcf_ui/controllers/user_controller.dart';
import 'package:nyalcf_inject_extend/nyalcf_inject_extend.dart';
Expand Down Expand Up @@ -55,12 +56,16 @@ class PanelConsoleFull extends StatelessWidget {
color: Colors.grey.shade900,
child: Obx(() => SizedBox(
height: MediaQuery.of(context).size.height - 56,
child: ListView(
controller: scrollController,
padding: const EdgeInsets.all(10),
physics: const AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
children: _cCtr.processOut,
child: AfterLayout(
callback: (RenderAfterLayout ral) => scrollController
.jumpTo(scrollController.position.maxScrollExtent),
child: ListView(
controller: scrollController,
padding: const EdgeInsets.all(10),
physics: const AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
children: _cCtr.processOut,
),
),
)),
),
Expand Down
1 change: 1 addition & 0 deletions nyalcf_gui/nyalcf_ui/lib/views/panel/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class PanelHome extends StatelessWidget {
_uCtr.user.value, _uCtr.token.value);
if (checkSignRes.status) {
checkSignRes as SignResponse;
Logger.debug(checkSignRes.signed);
if (!checkSignRes.signed) {
final doSignRes = await OtherSign().doSign(
_uCtr.user.value, _uCtr.token.value);
Expand Down
11 changes: 8 additions & 3 deletions nyalcf_gui/nyalcf_ui/lib/views/tokenmode/panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'package:nyalcf_core_extend/utils/widget/after_layout.dart';
import 'package:nyalcf_ui/controllers/console_controller.dart';
import 'package:nyalcf_core_extend/storages/prefs/token_mode_prefs.dart';
import 'package:nyalcf_core/utils/frpc/path_provider.dart';
Expand Down Expand Up @@ -199,9 +200,13 @@ class _TokenModePanelState extends State {
height: MediaQuery.of(context).size.height - 270,
child: Container(
margin: const EdgeInsets.all(10.0),
child: ListView(
controller: scrollController,
children: _cCtr.processOut,
child: AfterLayout(
callback: (RenderAfterLayout ral) => scrollController
.jumpTo(scrollController.position.maxScrollExtent),
child: ListView(
controller: scrollController,
children: _cCtr.processOut,
),
),
),
),
Expand Down

0 comments on commit 7d580f4

Please sign in to comment.