mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: auto scroll on installer
This commit is contained in:
parent
95739244fa
commit
092d645726
@ -5,14 +5,10 @@ import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
|||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
class InstallerView extends StatelessWidget {
|
class InstallerView extends StatelessWidget {
|
||||||
InstallerView({Key? key}) : super(key: key);
|
const InstallerView({Key? key}) : super(key: key);
|
||||||
final ScrollController _controller = ScrollController();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback(
|
|
||||||
(_) => _controller.jumpTo(_controller.position.maxScrollExtent),
|
|
||||||
);
|
|
||||||
return ViewModelBuilder<InstallerViewModel>.reactive(
|
return ViewModelBuilder<InstallerViewModel>.reactive(
|
||||||
onModelReady: (model) => model.initialize(context),
|
onModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => InstallerViewModel(),
|
viewModelBuilder: () => InstallerViewModel(),
|
||||||
@ -36,7 +32,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
controller: _controller,
|
controller: model.scrollController,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@ -78,7 +74,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: SelectableText(
|
child: Text(
|
||||||
model.logs,
|
model.logs,
|
||||||
style: GoogleFonts.jetBrainsMono(
|
style: GoogleFonts.jetBrainsMono(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
|
@ -13,6 +13,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
class InstallerViewModel extends BaseViewModel {
|
class InstallerViewModel extends BaseViewModel {
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
final PatchedApplication? _app = locator<PatcherViewModel>().selectedApp;
|
final PatchedApplication? _app = locator<PatcherViewModel>().selectedApp;
|
||||||
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
||||||
@ -83,6 +84,13 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
logs += '\n';
|
logs += '\n';
|
||||||
}
|
}
|
||||||
logs += message;
|
logs += message;
|
||||||
|
Future.delayed(const Duration(milliseconds: 500)).then((value) {
|
||||||
|
scrollController.animateTo(
|
||||||
|
scrollController.position.maxScrollExtent,
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
curve: Curves.fastOutSlowIn,
|
||||||
|
);
|
||||||
|
});
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user