Skip to content

Commit

Permalink
refactor: updated feeback widget
Browse files Browse the repository at this point in the history
  • Loading branch information
squidrye committed Oct 10, 2023
1 parent b83f29a commit 9ffcf43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:appflowy/workspace/presentation/home/home_draggables.dart';
import 'package:appflowy/workspace/presentation/widgets/draggable_item/draggable_item.dart';
import 'package:appflowy_backend/log.dart';
import 'package:flutter/material.dart';

class DraggablePaneItem extends StatefulWidget {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:appflowy/workspace/presentation/home/home_stack.dart';
import 'package:appflowy/workspace/presentation/home/panes/draggable_pane_item.dart';
import 'package:appflowy/workspace/presentation/home/panes/draggable_pane_target.dart';
import 'package:appflowy/workspace/presentation/home/tabs/tabs_manager.dart';
import 'package:flowy_infra_ui/style_widget/container.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:styled_widget/styled_widget.dart';
Expand Down Expand Up @@ -68,7 +69,7 @@ class _FlowyPaneState extends State<FlowyPane> {
paneContext: widget.paneContext,
pane: CrossDraggablesEntity(draggable: widget.node),
feedback: (context) =>
widget.node.tabs.currentPageManager.title(),
_buildPaneDraggableFeedback(context),
child: Column(
children: [
Padding(
Expand Down Expand Up @@ -117,11 +118,21 @@ class _FlowyPaneState extends State<FlowyPane> {
);
}

Widget _buildPaneDraggableFeedback(BuildContext context) {
return FlowyContainer(
Theme.of(context).colorScheme.onSecondaryContainer,
child: widget.node.tabs.currentPageManager.title(),
).padding(all: 4);
}

bool _proportionalScroll(ScrollNotification notification) {
if (notification is ScrollEndNotification &&
notification.metrics.axis == Axis.vertical) {
final scrollPercentage =
notification.metrics.pixels / notification.metrics.maxScrollExtent;
final axis = notification.metrics.axis;

if (notification is ScrollEndNotification && axis == Axis.vertical) {
final pixelsMoved = notification.metrics.pixels;
final extent = notification.metrics.maxScrollExtent;

final scrollPercentage = pixelsMoved / extent;

final outerScrollExtent = scrollPercentage * widget.size.height;

Expand Down

0 comments on commit 9ffcf43

Please sign in to comment.