Skip to content

Commit

Permalink
adds an exposed sheet contorller to the better feedback controller (#239
Browse files Browse the repository at this point in the history
)
  • Loading branch information
caseycrogers authored Sep 24, 2023
1 parent 80d5560 commit eb0dc79
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
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

0 comments on commit eb0dc79

Please sign in to comment.