mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -9,10 +9,7 @@ import '../styles.dart';
|
||||
|
||||
/// Partially overlays and then blurs its child's background.
|
||||
class FrostedBox extends StatelessWidget {
|
||||
const FrostedBox({
|
||||
this.child,
|
||||
super.key,
|
||||
});
|
||||
const FrostedBox({this.child, super.key});
|
||||
|
||||
final Widget? child;
|
||||
|
||||
@@ -21,9 +18,7 @@ class FrostedBox extends StatelessWidget {
|
||||
return BackdropFilter(
|
||||
filter: ui.ImageFilter.blur(sigmaX: 10, sigmaY: 10),
|
||||
child: DecoratedBox(
|
||||
decoration: const BoxDecoration(
|
||||
color: Styles.frostedBackground,
|
||||
),
|
||||
decoration: const BoxDecoration(color: Styles.frostedBackground),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
@@ -67,33 +62,35 @@ class _ColorChangingIconState
|
||||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_colorTween = visitor(
|
||||
_colorTween,
|
||||
widget.color,
|
||||
(dynamic value) => ColorTween(begin: value as Color?),
|
||||
) as ColorTween?;
|
||||
_colorTween =
|
||||
visitor(
|
||||
_colorTween,
|
||||
widget.color,
|
||||
(dynamic value) => ColorTween(begin: value as Color?),
|
||||
)
|
||||
as ColorTween?;
|
||||
}
|
||||
}
|
||||
|
||||
/// A close button that invokes a callback when pressed.
|
||||
class CloseButton extends _DetailPageButton {
|
||||
const CloseButton(VoidCallback onPressed, {super.key})
|
||||
: super(onPressed, CupertinoIcons.chevron_back);
|
||||
: super(onPressed, CupertinoIcons.chevron_back);
|
||||
}
|
||||
|
||||
/// A share button that invokes a callback when pressed.
|
||||
class ShareButton extends _DetailPageButton {
|
||||
const ShareButton(VoidCallback onPressed, {super.key})
|
||||
: super(onPressed, CupertinoIcons.share);
|
||||
: super(onPressed, CupertinoIcons.share);
|
||||
}
|
||||
|
||||
/// A favorite button that invokes a callback when pressed.
|
||||
class FavoriteButton extends _DetailPageButton {
|
||||
const FavoriteButton(VoidCallback onPressed, bool isFavorite, {super.key})
|
||||
: super(
|
||||
onPressed,
|
||||
isFavorite ? CupertinoIcons.heart_fill : CupertinoIcons.heart,
|
||||
);
|
||||
: super(
|
||||
onPressed,
|
||||
isFavorite ? CupertinoIcons.heart_fill : CupertinoIcons.heart,
|
||||
);
|
||||
}
|
||||
|
||||
class _DetailPageButton extends StatefulWidget {
|
||||
@@ -127,16 +124,15 @@ class _DetailPageButtonState extends State<_DetailPageButton> {
|
||||
child: Container(
|
||||
width: 30,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(15)),
|
||||
child: Center(
|
||||
child: ColorChangingIcon(
|
||||
widget.icon,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: tapInProgress
|
||||
? Styles.closeButtonPressed
|
||||
: Styles.closeButtonUnpressed,
|
||||
color:
|
||||
tapInProgress
|
||||
? Styles.closeButtonPressed
|
||||
: Styles.closeButtonUnpressed,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user