Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds an exposed sheet contorller to the better feedback controller #239

Merged
merged 1 commit into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion feedback/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions feedback/lib/src/feedback_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class _DraggableFeedbackSheetState extends State<_DraggableFeedbackSheet> {
),
Expanded(
child: DraggableScrollableSheet(
controller: BetterFeedback.of(context).sheetController,
snap: true,
minChildSize: collapsedHeight,
initialChildSize: collapsedHeight,
Expand Down
11 changes: 9 additions & 2 deletions feedback/lib/src/feedback_controller.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:feedback/src/better_feedback.dart';
import 'package:feedback/feedback.dart';
import 'package:flutter/material.dart';

/// Controls the state of the feeback ui.
class FeedbackController extends ChangeNotifier {
bool _isVisible = false;

/// Wether the feedback ui is currently visible.
/// Whether the feedback ui is currently visible.
bool get isVisible => _isVisible;

/// This function is called when the user submits his feedback.
Expand All @@ -27,4 +27,11 @@ class FeedbackController extends ChangeNotifier {
_isVisible = false;
notifyListeners();
}

/// The draggable scrollable sheet controller used by better feedback.
///
/// The controller is only attached if [FeedbackThemeData.sheetIsDraggable] is
/// true and feedback is currently displayed.
final DraggableScrollableController sheetController =
DraggableScrollableController();
}
2 changes: 1 addition & 1 deletion feedback/lib/src/feedback_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class FeedbackWidgetState extends State<FeedbackWidget>
// rebuilding the feedback sheet mid-drag cancels the drag.
// TODO(caseycrogers): replace `sheetProgress` with a direct reference to
// `DraggableScrollableController` when the latter gets into production.
// See: https://github.com/flutter/flutter/pull/92440.
// See: https://github.com/flutter/flutter/pull/135366.
ValueNotifier<double> sheetProgress = ValueNotifier(0);

@visibleForTesting
Expand Down
Loading