Skip to content

Commit

Permalink
rename to OnTapEventProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli committed Dec 3, 2024
1 parent d4c8c39 commit 7498098
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class _GestureMixStateWidgetState extends State<GestureMixStateWidget> {

@override
Widget build(BuildContext context) {
return OnTapEventInherited(
return OnTapEventProvider(
_onTapEvent,
child: GestureDetector(
onTapDown: widget.onTap != null ? _onTapDown : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ enum OnTapEvent {
down;
}

class OnTapEventInherited extends InheritedWidget {
const OnTapEventInherited(this.event, {super.key, required super.child});
class OnTapEventProvider extends InheritedWidget {
const OnTapEventProvider(this.event, {super.key, required super.child});

static OnTapEventInherited? of(BuildContext context) {
static OnTapEventProvider? of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType();
}

final OnTapEvent? event;

@override
bool updateShouldNotify(OnTapEventInherited oldWidget) {
bool updateShouldNotify(OnTapEventProvider oldWidget) {
return event != oldWidget.event;
}
}
4 changes: 2 additions & 2 deletions packages/mix/lib/src/variants/widget_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OnTapEventVariant extends IVariant {
VariantAttribute call(Style Function(OnTapEvent) fn) {
return ContextVariantBuilder(
(BuildContext context) {
final event = OnTapEventInherited.of(context)?.event;
final event = OnTapEventProvider.of(context)?.event;
if (event == null) {
return const Style.empty();
}
Expand All @@ -28,7 +28,7 @@ class OnTapEventVariant extends IVariant {
@override
bool when(BuildContext context) {
return MixWidgetState.hasStateOf(context, MixWidgetState.pressed) &&
OnTapEventInherited.of(context) != null;
OnTapEventProvider.of(context) != null;
}

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../../helpers/context_finder.dart';
import '../../../helpers/testing_utils.dart';

extension _WidgetTesterX on WidgetTester {
OnTapEventInherited findPressEventWidget() {
OnTapEventProvider findPressEventWidget() {
return findWidgetOfType();
}
}
Expand Down

0 comments on commit 7498098

Please sign in to comment.