mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-08-03 01:00:14 +08:00
@@ -1,4 +1,6 @@
|
||||
part of 'package:PiliPlus/common/widgets/flutter/draggable_scrollable_sheet.dart';
|
||||
|
||||
import 'package:flutter/gestures.dart' show Drag;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DynDraggableScrollableSheet extends DraggableScrollableSheet {
|
||||
const DynDraggableScrollableSheet({
|
||||
@@ -20,34 +22,21 @@ class DynDraggableScrollableSheet extends DraggableScrollableSheet {
|
||||
_DynDraggableScrollableSheetState();
|
||||
}
|
||||
|
||||
class _DynDraggableScrollableSheetState extends _DraggableScrollableSheetState {
|
||||
class _DynDraggableScrollableSheetState extends DraggableScrollableSheetState {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_extent = _DraggableSheetExtent(
|
||||
minSize: widget.minChildSize,
|
||||
maxSize: widget.maxChildSize,
|
||||
snap: widget.snap,
|
||||
snapSizes: _impliedSnapSizes(),
|
||||
snapAnimationDuration: widget.snapAnimationDuration,
|
||||
initialSize: widget.initialChildSize,
|
||||
shouldCloseOnMinExtent: widget.shouldCloseOnMinExtent,
|
||||
);
|
||||
_scrollController = _DynDraggableScrollableSheetScrollController(
|
||||
extent: _extent,
|
||||
);
|
||||
widget.controller?._attach(_scrollController);
|
||||
void initScrollController() {
|
||||
scrollController = _DynDraggableScrollableSheetScrollController(extent: extent);
|
||||
}
|
||||
}
|
||||
|
||||
class _DynDraggableScrollableSheetScrollController
|
||||
extends _DraggableScrollableSheetScrollController {
|
||||
extends DraggableScrollableSheetScrollController {
|
||||
_DynDraggableScrollableSheetScrollController({
|
||||
required super.extent,
|
||||
});
|
||||
|
||||
@override
|
||||
_DraggableScrollableSheetScrollPosition createScrollPosition(
|
||||
DraggableScrollableSheetScrollPosition createScrollPosition(
|
||||
ScrollPhysics physics,
|
||||
ScrollContext context,
|
||||
ScrollPosition? oldPosition,
|
||||
@@ -62,7 +51,7 @@ class _DynDraggableScrollableSheetScrollController
|
||||
}
|
||||
|
||||
class _DynDraggableScrollableSheetScrollPosition
|
||||
extends _DraggableScrollableSheetScrollPosition {
|
||||
extends DraggableScrollableSheetScrollPosition {
|
||||
_DynDraggableScrollableSheetScrollPosition({
|
||||
required super.physics,
|
||||
required super.context,
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
part of 'package:PiliPlus/common/widgets/flutter/draggable_scrollable_sheet.dart';
|
||||
|
||||
class TopicDraggableScrollableSheet extends DraggableScrollableSheet {
|
||||
const TopicDraggableScrollableSheet({
|
||||
super.key,
|
||||
super.initialChildSize,
|
||||
super.minChildSize,
|
||||
super.maxChildSize,
|
||||
super.expand,
|
||||
super.snap,
|
||||
super.snapSizes,
|
||||
super.snapAnimationDuration,
|
||||
super.controller,
|
||||
super.shouldCloseOnMinExtent,
|
||||
required super.builder,
|
||||
this.initialScrollOffset = 0.0,
|
||||
});
|
||||
|
||||
final double initialScrollOffset;
|
||||
|
||||
@override
|
||||
State<DraggableScrollableSheet> createState() =>
|
||||
_TopicDraggableScrollableSheetState();
|
||||
}
|
||||
|
||||
class _TopicDraggableScrollableSheetState
|
||||
extends _DraggableScrollableSheetState {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_extent = _DraggableSheetExtent(
|
||||
minSize: widget.minChildSize,
|
||||
maxSize: widget.maxChildSize,
|
||||
snap: widget.snap,
|
||||
snapSizes: _impliedSnapSizes(),
|
||||
snapAnimationDuration: widget.snapAnimationDuration,
|
||||
initialSize: widget.initialChildSize,
|
||||
shouldCloseOnMinExtent: widget.shouldCloseOnMinExtent,
|
||||
);
|
||||
_scrollController = _TopicDraggableScrollableSheetScrollController(
|
||||
extent: _extent,
|
||||
initialScrollOffset:
|
||||
(widget as TopicDraggableScrollableSheet).initialScrollOffset,
|
||||
);
|
||||
widget.controller?._attach(_scrollController);
|
||||
}
|
||||
}
|
||||
|
||||
class _TopicDraggableScrollableSheetScrollController
|
||||
extends _DraggableScrollableSheetScrollController {
|
||||
_TopicDraggableScrollableSheetScrollController({
|
||||
required super.extent,
|
||||
this._initialScrollOffset = 0.0,
|
||||
});
|
||||
|
||||
@override
|
||||
double get initialScrollOffset => _initialScrollOffset;
|
||||
final double _initialScrollOffset;
|
||||
|
||||
@override
|
||||
_DraggableScrollableSheetScrollPosition createScrollPosition(
|
||||
ScrollPhysics physics,
|
||||
ScrollContext context,
|
||||
ScrollPosition? oldPosition,
|
||||
) {
|
||||
return _DraggableScrollableSheetScrollPosition(
|
||||
physics: physics.applyTo(const AlwaysScrollableScrollPhysics()),
|
||||
context: context,
|
||||
oldPosition: oldPosition,
|
||||
getExtent: () => extent,
|
||||
initialPixels: _initialScrollOffset,
|
||||
);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user