Skip to content

Commit

Permalink
Implemented onDragUpdate, Release 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkko committed Jun 30, 2022
1 parent ea19183 commit 41d34e4
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 101 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.3
- Implemented [onDragUpdate](https://github.com/Tkko/Flutter_dismissible_page/issues/15)


## 0.7.2
- rootNavigator [PR](https://github.com/Tkko/Flutter_dismissible_page/pull/13)

Expand Down
23 changes: 8 additions & 15 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:lint/analysis_options.yaml
include: package:very_good_analysis/analysis_options.yaml

analyzer:
strong-mode:
Expand All @@ -14,17 +14,10 @@ analyzer:

linter:
rules:
- always_declare_return_types
- camel_case_types
- empty_constructor_bodies
- annotate_overrides
- avoid_init_to_null
- constant_identifier_names
- one_member_abstracts
- slash_for_doc_comments
- unnecessary_brace_in_string_interps
- cancel_subscriptions
- close_sinks
- unnecessary_const
- unnecessary_new
- prefer_single_quotes
lines_longer_than_80_chars: false
sort_pub_dependencies: false
sort_constructors_first: false
public_member_api_docs: false
library_private_types_in_public_api: false
no_default_cases: false
omit_local_variable_types: false
2 changes: 1 addition & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
11 changes: 7 additions & 4 deletions example/lib/pages/dismissible_page_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class _DismissiblePageDemoState extends State<DismissiblePageDemo> {
runSpacing: 10,
children: pageModel.contacts.entries.map((item) {
return ActionChip(
onPressed: () => launch(item.value),
onPressed: () => launchUrl(Uri.parse(item.value)),
label: Text(item.key, style: GoogleFonts.poppins()),
);
}).toList(),
Expand All @@ -75,12 +75,14 @@ class _DismissiblePageDemoState extends State<DismissiblePageDemo> {
Title('Bool Parameters'),
Wrap(spacing: 10, runSpacing: 10, children: [
AppChip(
onSelected: () => setState(() => pageModel.isFullScreen = !pageModel.isFullScreen),
onSelected: () => setState(
() => pageModel.isFullScreen = !pageModel.isFullScreen),
isSelected: pageModel.isFullScreen,
title: 'isFullscreen',
),
AppChip(
onSelected: () => setState(() => pageModel.disabled = !pageModel.disabled),
onSelected: () =>
setState(() => pageModel.disabled = !pageModel.disabled),
isSelected: pageModel.disabled,
title: 'disabled',
),
Expand All @@ -97,7 +99,8 @@ class _DismissiblePageDemoState extends State<DismissiblePageDemo> {
setState(() => pageModel.direction = item);
},
isSelected: item == pageModel.direction,
title: '$item'.replaceAll('DismissiblePageDismissDirection.', ''),
title: '$item'
.replaceAll('DismissiblePageDismissDirection.', ''),
);
}).toList(),
),
Expand Down
1 change: 1 addition & 0 deletions example/lib/pages/stories_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class _StoriesWrapperState extends State<StoriesWrapper>
startingOpacity: widget.pageModel.startingOpacity,
behavior: widget.pageModel.behavior,
reverseDuration: widget.pageModel.reverseDuration,
onDragUpdate: (d) => print(d.offset.dy),
child: CubicPageView(
controller: pageCtrl,
children: stories.map((story) {
Expand Down
28 changes: 14 additions & 14 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
crypto:
dependency: transitive
description:
Expand All @@ -56,14 +56,14 @@ packages:
path: ".."
relative: true
source: path
version: "0.7.2"
version: "0.7.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0"
ffi:
dependency: transitive
description:
Expand Down Expand Up @@ -99,7 +99,7 @@ packages:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
version: "3.0.1"
http:
dependency: transitive
description:
Expand All @@ -120,7 +120,7 @@ packages:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
version: "0.6.4"
matcher:
dependency: transitive
description:
Expand All @@ -134,7 +134,7 @@ packages:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
version: "0.1.4"
meta:
dependency: transitive
description:
Expand All @@ -148,7 +148,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.1"
path_provider:
dependency: transitive
description:
Expand Down Expand Up @@ -230,7 +230,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.8.2"
stack_trace:
dependency: transitive
description:
Expand Down Expand Up @@ -265,7 +265,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.8"
version: "0.4.9"
typed_data:
dependency: transitive
description:
Expand All @@ -279,7 +279,7 @@ packages:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.20"
version: "6.1.4"
url_launcher_android:
dependency: transitive
description:
Expand Down Expand Up @@ -314,7 +314,7 @@ packages:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
version: "2.1.0"
url_launcher_web:
dependency: transitive
description:
Expand All @@ -335,7 +335,7 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.1.2"
win32:
dependency: transitive
description:
Expand All @@ -351,5 +351,5 @@ packages:
source: hosted
version: "0.2.0+1"
sdks:
dart: ">=2.15.0 <3.0.0"
flutter: ">=2.8.0"
dart: ">=2.17.0-0 <3.0.0"
flutter: ">=2.10.0-0"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ dependencies:
path: ../
# git:
# url: https://github.com/Tkko/Flutter_dismissible_page
url_launcher:
google_fonts:
url_launcher: ^6.1.4
google_fonts: ^3.0.1


dev_dependencies:
Expand Down
8 changes: 8 additions & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
)

set(PLUGIN_BUNDLED_LIBRARIES)

foreach(plugin ${FLUTTER_PLUGIN_LIST})
Expand All @@ -14,3 +17,8 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)

foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
6 changes: 5 additions & 1 deletion lib/src/dismissible_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ part of 'dismissible_page.dart';

const _transitionDuration = Duration(milliseconds: 250);

/// BuildContext Helper methods
extension DismissibleContextExt on BuildContext {
Future pushTransparentRoute(
/// Navigates to desired page with transparent transition background
Future<T?> pushTransparentRoute<T>(
Widget page, {
final Color backgroundColor = Colors.black38,
final Duration transitionDuration = _transitionDuration,
Expand All @@ -20,7 +22,9 @@ extension DismissibleContextExt on BuildContext {
);
}

/// GlobalKey Helper methods
extension GlobalKeyExtension on GlobalKey {
///
Rect? get globalPaintBounds {
final renderObject = currentContext?.findRenderObject();
final translation = renderObject?.getTransformTo(null).getTranslation();
Expand Down
2 changes: 2 additions & 0 deletions lib/src/dismissible_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ part 'dismissible_page_drag_update_details.dart';

const double _kDismissThreshold = 0.15;

/// Creates page that is dismissed by swipe gestures, with Hero style animations
class DismissiblePage extends StatelessWidget {
///
const DismissiblePage({
required this.child,
required this.onDismissed,
Expand Down
17 changes: 9 additions & 8 deletions lib/src/dismissible_page_dismiss_direction.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
part of 'dismissible_page.dart';

///
enum DismissiblePageDismissDirection {
/// The [DismissiblePageDirection] can be dismissed by dragging either up or down.
/// Can be dismissed by dragging either up or down.
vertical,

/// The [DismissiblePageDirection] can be dismissed by dragging either left or right.
/// Can be dismissed by dragging either left or right.
horizontal,

/// The [DismissiblePageDirection] can be dismissed by dragging in the reverse of the
/// Can be dismissed by dragging in the reverse of the
/// reading direction (e.g., from right to left in left-to-right languages).
endToStart,

/// The [DismissiblePageDirection] can be dismissed by dragging in the reading direction
/// Can be dismissed by dragging in the reading direction
/// (e.g., from left to right in left-to-right languages).
startToEnd,

/// The [DismissiblePageDirection] can be dismissed by dragging up only.
/// Can be dismissed by dragging up only.
up,

/// The [DismissiblePageDirection] can be dismissed by dragging down only.
/// Can be dismissed by dragging down only.
down,

/// The [DismissiblePageDirection] can be dismissed by dragging any direction.
/// Can be dismissed by dragging any direction.
multi,

/// The [DismissiblePageDirection] cannot be dismissed by dragging.
/// Cannot be dismissed by dragging.
none
}
9 changes: 7 additions & 2 deletions lib/src/dismissible_page_drag_update_details.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
part of 'dismissible_page.dart';

/// Details outputted by [DismissiblePage.onDragUpdate] method
@immutable
class DismissiblePageDragUpdateDetails {
final double overallDragValue;
final double radius;
final double opacity;
final double scale;
final Offset offset;

DismissiblePageDragUpdateDetails({
///
const DismissiblePageDragUpdateDetails({
this.offset = Offset.zero,
this.overallDragValue = 0.0,
this.scale = 1.0,
Expand All @@ -18,7 +21,9 @@ class DismissiblePageDragUpdateDetails {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is DismissiblePageDragUpdateDetails && runtimeType == other.runtimeType && offset == other.offset;
other is DismissiblePageDragUpdateDetails &&
runtimeType == other.runtimeType &&
offset == other.offset;

@override
int get hashCode => offset.hashCode;
Expand Down
5 changes: 3 additions & 2 deletions lib/src/multi_axis_dismissible_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ class _MultiAxisDismissiblePageState extends State<MultiAxisDismissiblePage>
_dragNotifier = ValueNotifier(initialDetails);
_moveController =
AnimationController(duration: widget.reverseDuration, vsync: this);
_moveController.addStatusListener(statusListener);
_moveController.addListener(animationListener);
_moveController
..addStatusListener(statusListener)
..addListener(animationListener);
_recognizer = widget.createRecognizer(_startDrag);
_dragNotifier.addListener(_dragListener);
}
Expand Down
Loading

0 comments on commit 41d34e4

Please sign in to comment.