Remember the diff layout across reloads
One file at a time or all files stacked is saved in the app's preferences and restored when the app starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
@@ -7,6 +9,7 @@ import '../../../ui/navigation/chevron_pager.dart';
|
||||
import '../domain/file_change.dart';
|
||||
import 'diff_highlight.dart';
|
||||
import 'diff_keyboard.dart';
|
||||
import 'diff_layout_preference.dart';
|
||||
import 'diff_search_bar.dart';
|
||||
import 'diff_search_controller.dart';
|
||||
import 'file_diff_viewer.dart';
|
||||
@@ -14,8 +17,8 @@ import 'stacked_diff_view.dart';
|
||||
import '../windows/diff_windows.dart';
|
||||
|
||||
/// Whether diff pages show every file stacked (GitHub's Files changed) rather
|
||||
/// than one file at a time. Remembered for the rest of the session.
|
||||
final ValueNotifier<bool> diffShowsAllFiles = ValueNotifier(false);
|
||||
/// than one file at a time; saved across reloads.
|
||||
final DiffLayoutPreference diffShowsAllFiles = DiffLayoutPreference();
|
||||
|
||||
/// How far one up/down (`k`/`j`) press scrolls.
|
||||
const double diffScrollStep = 64;
|
||||
@@ -84,6 +87,7 @@ class _FileDiffPageState extends State<FileDiffPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
diffShowsAllFiles.addListener(_rebuild);
|
||||
unawaited(diffShowsAllFiles.restore());
|
||||
_search.addListener(_rebuild);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user