Skip to content

Commit

Permalink
refactor: added suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
squidrye committed Sep 14, 2023
1 parent 83447b0 commit c7760c2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:appflowy/workspace/application/panes/panes.dart';
import 'package:appflowy/workspace/application/panes/panes_cubit/panes_cubit.dart';
import 'package:appflowy/workspace/application/panes/size_controller.dart';
import 'package:appflowy/workspace/application/tabs/tabs.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
Expand All @@ -11,7 +10,6 @@ import 'package:nanoid/nanoid.dart';
enum Direction { front, back }

class PanesService {
PanesService();
PaneNode splitHandler(
PaneNode node,
String targetPaneId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ class Tabs extends ChangeNotifier {
/// And the current selected tab isn't the first (index 0)
/// as currentIndex cannot be -1
/// Then decrease currentIndex by 1
final newIndex = currentIndex > _pageManagers.length - 1 && currentIndex > 0
currentIndex = currentIndex > _pageManagers.length - 1 && currentIndex > 0
? currentIndex - 1
: currentIndex;

currentIndex = newIndex;
notifyListeners();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,14 @@ class HomeTopBar extends StatelessWidget {
),
BlocBuilder<PanesCubit, PanesState>(
builder: (context, state) {
return state.count > 1
? IconButton(
onPressed: () {
context.read<PanesCubit>().closePane(paneId);
},
icon: const Icon(Icons.close_sharp),
)
: const SizedBox.shrink();
if (state.count <= 0) {
return const SizedBox.shrink();
}

return IconButton(
onPressed: () => context.read<PanesCubit>().closePane(paneId),
icon: const Icon(Icons.close_sharp),
);
},
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ class HomeHotKeys extends StatelessWidget {

void _selectTab(BuildContext context, int change) {
final bloc = context.read<PanesCubit>();
// bloc.add(TabsEvent.selectTab(bloc.state.currentIndex + change));
context
.read<PanesCubit>()
.selectTab(index: bloc.state.activePane.tabs.currentIndex + change);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:appflowy/workspace/application/panes/size_controller.dart';
import 'package:appflowy/workspace/presentation/home/home_layout.dart';
import 'package:appflowy/workspace/presentation/home/home_stack.dart';
import 'package:appflowy/workspace/presentation/home/panes/panes_layout.dart';
import 'package:appflowy_backend/log.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
Expand All @@ -29,10 +28,6 @@ class FlowyPaneGroup extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (node.children.isEmpty) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
final renderBox = context.findRenderObject() as RenderBox;
Log.warn("Check render ${renderBox.paintBounds}");
});
return FlowyPane(
node: node,
delegate: delegate,
Expand Down

0 comments on commit c7760c2

Please sign in to comment.