|
@@ -1,13 +1,9 @@
|
|
-import 'dart:io' show Platform;
|
|
|
|
-
|
|
|
|
import 'package:app_flowy/startup/startup.dart';
|
|
import 'package:app_flowy/startup/startup.dart';
|
|
-import 'package:app_flowy/workspace/application/home/home_bloc.dart';
|
|
|
|
import 'package:app_flowy/plugins/blank/blank.dart';
|
|
import 'package:app_flowy/plugins/blank/blank.dart';
|
|
import 'package:app_flowy/workspace/presentation/home/toast.dart';
|
|
import 'package:app_flowy/workspace/presentation/home/toast.dart';
|
|
import 'package:flowy_infra/theme.dart';
|
|
import 'package:flowy_infra/theme.dart';
|
|
import 'package:flowy_sdk/log.dart';
|
|
import 'package:flowy_sdk/log.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
-import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:time/time.dart';
|
|
import 'package:time/time.dart';
|
|
import 'package:app_flowy/startup/plugin/plugin.dart';
|
|
import 'package:app_flowy/startup/plugin/plugin.dart';
|
|
@@ -17,11 +13,14 @@ import 'package:app_flowy/core/frameless_window.dart';
|
|
import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
import 'package:flowy_infra_ui/style_widget/extension.dart';
|
|
import 'package:flowy_infra_ui/style_widget/extension.dart';
|
|
import 'package:flowy_infra/notifier.dart';
|
|
import 'package:flowy_infra/notifier.dart';
|
|
|
|
+import 'home_layout.dart';
|
|
|
|
|
|
typedef NavigationCallback = void Function(String id);
|
|
typedef NavigationCallback = void Function(String id);
|
|
|
|
|
|
class HomeStack extends StatelessWidget {
|
|
class HomeStack extends StatelessWidget {
|
|
- const HomeStack({Key? key}) : super(key: key);
|
|
|
|
|
|
+ const HomeStack({Key? key, required this.layout}) : super(key: key);
|
|
|
|
+
|
|
|
|
+ final HomeLayout layout;
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -30,7 +29,7 @@ class HomeStack extends StatelessWidget {
|
|
return Column(
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
children: [
|
|
- getIt<HomeStackManager>().stackTopBar(),
|
|
|
|
|
|
+ getIt<HomeStackManager>().stackTopBar(layout: layout),
|
|
Expanded(
|
|
Expanded(
|
|
child: Container(
|
|
child: Container(
|
|
color: theme.surface,
|
|
color: theme.surface,
|
|
@@ -143,7 +142,7 @@ class HomeStackManager {
|
|
|
|
|
|
void setStackWithId(String id) {}
|
|
void setStackWithId(String id) {}
|
|
|
|
|
|
- Widget stackTopBar() {
|
|
|
|
|
|
+ Widget stackTopBar({required HomeLayout layout}) {
|
|
return MultiProvider(
|
|
return MultiProvider(
|
|
providers: [
|
|
providers: [
|
|
ChangeNotifierProvider.value(value: _notifier),
|
|
ChangeNotifierProvider.value(value: _notifier),
|
|
@@ -151,7 +150,7 @@ class HomeStackManager {
|
|
child: Selector<HomeStackNotifier, Widget>(
|
|
child: Selector<HomeStackNotifier, Widget>(
|
|
selector: (context, notifier) => notifier.titleWidget,
|
|
selector: (context, notifier) => notifier.titleWidget,
|
|
builder: (context, widget, child) {
|
|
builder: (context, widget, child) {
|
|
- return const MoveWindowDetector(child: HomeTopBar());
|
|
|
|
|
|
+ return MoveWindowDetector(child: HomeTopBar(layout: layout));
|
|
},
|
|
},
|
|
),
|
|
),
|
|
);
|
|
);
|
|
@@ -181,7 +180,9 @@ class HomeStackManager {
|
|
}
|
|
}
|
|
|
|
|
|
class HomeTopBar extends StatelessWidget {
|
|
class HomeTopBar extends StatelessWidget {
|
|
- const HomeTopBar({Key? key}) : super(key: key);
|
|
|
|
|
|
+ const HomeTopBar({Key? key, required this.layout}) : super(key: key);
|
|
|
|
+
|
|
|
|
+ final HomeLayout layout;
|
|
|
|
|
|
@override
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -192,15 +193,7 @@ class HomeTopBar extends StatelessWidget {
|
|
child: Row(
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
children: [
|
|
- BlocBuilder<HomeBloc, HomeState>(
|
|
|
|
- buildWhen: ((previous, current) =>
|
|
|
|
- previous.isMenuCollapsed != current.isMenuCollapsed),
|
|
|
|
- builder: (context, state) {
|
|
|
|
- if (state.isMenuCollapsed && Platform.isMacOS) {
|
|
|
|
- return const HSpace(80);
|
|
|
|
- }
|
|
|
|
- return const HSpace(0);
|
|
|
|
- }),
|
|
|
|
|
|
+ HSpace(layout.menuSpacing),
|
|
const FlowyNavigation(),
|
|
const FlowyNavigation(),
|
|
const HSpace(16),
|
|
const HSpace(16),
|
|
ChangeNotifierProvider.value(
|
|
ChangeNotifierProvider.value(
|