mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: fixed controls space
This commit is contained in:
parent
7f249ebae2
commit
76c3e440e7
@ -15,6 +15,7 @@ class HomeLayout {
|
|||||||
late double editPanelWidth;
|
late double editPanelWidth;
|
||||||
late double homePageLOffset;
|
late double homePageLOffset;
|
||||||
late double homePageROffset;
|
late double homePageROffset;
|
||||||
|
late double menuSpacing;
|
||||||
late Duration animDuration;
|
late Duration animDuration;
|
||||||
|
|
||||||
HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint,
|
HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint,
|
||||||
@ -37,6 +38,7 @@ class HomeLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
homePageLOffset = showMenu ? menuWidth : 0.0;
|
homePageLOffset = showMenu ? menuWidth : 0.0;
|
||||||
|
menuSpacing = showMenu ? 0 : 80.0;
|
||||||
animDuration = .35.seconds;
|
animDuration = .35.seconds;
|
||||||
|
|
||||||
editPanelWidth = HomeSizes.editPanelWidth;
|
editPanelWidth = HomeSizes.editPanelWidth;
|
||||||
|
@ -87,7 +87,9 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
final layout = HomeLayout(context, constraints, state.forceCollapse);
|
final layout = HomeLayout(context, constraints, state.forceCollapse);
|
||||||
const homeStack = HomeStack();
|
final homeStack = HomeStack(
|
||||||
|
layout: layout,
|
||||||
|
);
|
||||||
final menu = _buildHomeMenu(
|
final menu = _buildHomeMenu(
|
||||||
layout: layout,
|
layout: layout,
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -17,11 +17,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 +33,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 +146,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 +154,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 +184,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 +197,7 @@ class HomeTopBar extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
BlocBuilder<HomeBloc, HomeState>(
|
HSpace(layout.menuSpacing),
|
||||||
buildWhen: ((previous, current) =>
|
|
||||||
previous.isMenuCollapsed != current.isMenuCollapsed),
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state.isMenuCollapsed && Platform.isMacOS) {
|
|
||||||
return const HSpace(80);
|
|
||||||
}
|
|
||||||
return const HSpace(0);
|
|
||||||
}),
|
|
||||||
const FlowyNavigation(),
|
const FlowyNavigation(),
|
||||||
const HSpace(16),
|
const HSpace(16),
|
||||||
ChangeNotifierProvider.value(
|
ChangeNotifierProvider.value(
|
||||||
|
Loading…
Reference in New Issue
Block a user