Skip to content

Commit

Permalink
Commit from GitHub Actions (Forui Presubmit)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Jul 18, 2024
1 parent cffa0cf commit e9f3179
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 42 deletions.
81 changes: 41 additions & 40 deletions forui/lib/src/foundation/tappable.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

import 'package:meta/meta.dart';

@internal
Expand Down Expand Up @@ -80,33 +81,33 @@ class _FTappableState extends State<FTappable> with SingleTickerProviderStateMix

@override
Widget build(BuildContext context) => Semantics(
enabled: widget.enabled,
label: widget.semanticLabel,
container: true,
button: true,
selected: widget.selected,
excludeSemantics: widget.excludeSemantics,
child: Focus(
autofocus: widget.autofocus,
focusNode: widget.focusNode,
onFocusChange: (focused) {
setState(() => _focused = focused);
widget.onFocusChange?.call(focused);
},
child: MouseRegion(
cursor: widget.enabled ? SystemMouseCursors.click : MouseCursor.defer,
onEnter: (_) => setState(() => _hovered = true),
onExit: (_) => setState(() => _hovered = false),
child: _child,
enabled: widget.enabled,
label: widget.semanticLabel,
container: true,
button: true,
selected: widget.selected,
excludeSemantics: widget.excludeSemantics,
child: Focus(
autofocus: widget.autofocus,
focusNode: widget.focusNode,
onFocusChange: (focused) {
setState(() => _focused = focused);
widget.onFocusChange?.call(focused);
},
child: MouseRegion(
cursor: widget.enabled ? SystemMouseCursors.click : MouseCursor.defer,
onEnter: (_) => setState(() => _hovered = true),
onExit: (_) => setState(() => _hovered = false),
child: _child,
),
),
),
);

);

Widget get _child => GestureDetector(
onTap: widget.onPress,
onLongPress: widget.onLongPress,
child: widget.builder(context, _focused || _hovered, widget.child),
);
onTap: widget.onPress,
onLongPress: widget.onLongPress,
child: widget.builder(context, _focused || _hovered, widget.child),
);
}

class _AnimatedTappable extends FTappable {
Expand All @@ -131,7 +132,7 @@ class _AnimatedTappable extends FTappable {
class _AnimatedTappableState extends _FTappableState {
late final AnimationController _controller;
late final Animation<double> _animation;

@override
void initState() {
super.initState();
Expand All @@ -143,22 +144,22 @@ class _AnimatedTappableState extends _FTappableState {
}
});
}

@override
Widget get _child => ScaleTransition(
scale: _animation,
child: GestureDetector(
onTap: widget.onPress == null
? null
: () {
widget.onPress!();
_controller.forward();
},
onLongPress: widget.onLongPress,
child: widget.builder(context, _focused || _hovered, widget.child),
),
);
scale: _animation,
child: GestureDetector(
onTap: widget.onPress == null
? null
: () {
widget.onPress!();
_controller.forward();
},
onLongPress: widget.onLongPress,
child: widget.builder(context, _focused || _hovered, widget.child),
),
);

@override
void dispose() {
_controller.dispose();
Expand Down
2 changes: 1 addition & 1 deletion forui/lib/src/widgets/button/button.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:forui/src/foundation/tappable.dart';

import 'package:meta/meta.dart';
import 'package:sugar/collection.dart';

import 'package:forui/forui.dart';
import 'package:forui/src/foundation/tappable.dart';

part 'button_content.dart';

Expand Down
2 changes: 1 addition & 1 deletion forui/lib/src/widgets/calendar/shared/header.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:forui/src/foundation/tappable.dart';

import 'package:intl/intl.dart';
import 'package:meta/meta.dart';
import 'package:sugar/sugar.dart';

import 'package:forui/forui.dart';
import 'package:forui/src/foundation/tappable.dart';

/// The current picker type.
enum FCalendarPickerType {
Expand Down

0 comments on commit e9f3179

Please sign in to comment.