mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +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,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -29,21 +29,20 @@ class PressableCard extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: borderRadius,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: borderRadius,
|
||||
child: child,
|
||||
),
|
||||
decoration: BoxDecoration(borderRadius: borderRadius),
|
||||
child: ClipRRect(borderRadius: borderRadius, child: child),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VeggieCard extends StatelessWidget {
|
||||
const VeggieCard(this.veggie, this.isInSeason, this.isPreferredCategory,
|
||||
{super.key});
|
||||
const VeggieCard(
|
||||
this.veggie,
|
||||
this.isInSeason,
|
||||
this.isPreferredCategory, {
|
||||
super.key,
|
||||
});
|
||||
|
||||
/// Veggie to be displayed by the card.
|
||||
final Veggie veggie;
|
||||
@@ -64,10 +63,7 @@ class VeggieCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.cardTitleText(themeData),
|
||||
),
|
||||
Text(veggie.name, style: Styles.cardTitleText(themeData)),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
veggie.shortDescription,
|
||||
@@ -99,9 +95,7 @@ class VeggieCard extends StatelessWidget {
|
||||
fit: BoxFit.cover,
|
||||
colorFilter:
|
||||
isInSeason ? null : Styles.desaturatedColorFilter,
|
||||
image: AssetImage(
|
||||
veggie.imageAssetPath,
|
||||
),
|
||||
image: AssetImage(veggie.imageAssetPath),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -32,10 +32,7 @@ class ZoomClipAssetImage extends StatelessWidget {
|
||||
child: OverflowBox(
|
||||
maxHeight: height! * zoom,
|
||||
maxWidth: width! * zoom,
|
||||
child: Image.asset(
|
||||
imageAsset,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
child: Image.asset(imageAsset, fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -96,10 +93,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
veggie.name,
|
||||
style: Styles.headlineName(themeData),
|
||||
),
|
||||
Text(veggie.name, style: Styles.headlineName(themeData)),
|
||||
..._buildSeasonDots(veggie.seasons),
|
||||
],
|
||||
),
|
||||
@@ -109,7 +103,7 @@ class VeggieHeadline extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -40,6 +40,5 @@ class VeggieSeasonsPageRoute<T> extends PageRoute<T> {
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
_page.child;
|
||||
) => _page.child;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user