mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #1161 from Poly-Pixel/trash-resize-fix
fix: only open the last opened view if plugin is blank
This commit is contained in:
commit
02fd2bc427
@ -144,11 +144,24 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
collapsedNotifier: getIt<HomeStackManager>().collapsedNotifier,
|
collapsedNotifier: getIt<HomeStackManager>().collapsedNotifier,
|
||||||
);
|
);
|
||||||
|
|
||||||
final latestView =
|
// Only open the last opened view if the [HomeStackManager] current opened
|
||||||
workspaceSetting.hasLatestView() ? workspaceSetting.latestView : null;
|
// plugin is blank and the last opened view is not null.
|
||||||
if (getIt<MenuSharedState>().latestOpenView == null) {
|
//
|
||||||
/// AppFlowy will open the view that the last time the user opened it. The _buildHomeMenu will get called when AppFlowy's screen resizes. So we only set the latestOpenView when it's null.
|
// All opened widgets that display on the home screen are in the form
|
||||||
getIt<MenuSharedState>().latestOpenView = latestView;
|
// of plugins. There is a list of built-in plugins defined in the
|
||||||
|
// [PluginType] enum, including board, grid and trash.
|
||||||
|
|
||||||
|
if (getIt<HomeStackManager>().plugin.ty == PluginType.blank) {
|
||||||
|
// Open the last opened view.
|
||||||
|
if (workspaceSetting.hasLatestView()) {
|
||||||
|
final view = workspaceSetting.latestView;
|
||||||
|
final plugin = makePlugin(
|
||||||
|
pluginType: view.pluginType,
|
||||||
|
data: view,
|
||||||
|
);
|
||||||
|
getIt<HomeStackManager>().setPlugin(plugin);
|
||||||
|
getIt<MenuSharedState>().latestOpenView = view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
|
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
|
||||||
|
@ -144,6 +144,7 @@ class HomeStackManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PublishNotifier<bool> get collapsedNotifier => _notifier.collapsedNotifier;
|
PublishNotifier<bool> get collapsedNotifier => _notifier.collapsedNotifier;
|
||||||
|
Plugin get plugin => _notifier.plugin;
|
||||||
|
|
||||||
void setPlugin(Plugin newPlugin) {
|
void setPlugin(Plugin newPlugin) {
|
||||||
_notifier.plugin = newPlugin;
|
_notifier.plugin = newPlugin;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user