1
0
mirror of https://github.com/flutter/samples.git synced 2026-10-11 21:52:52 +00:00

Flutter 3.29 beta (#2571)

This commit is contained in:
Eric Windmill
2025-02-12 18:08:01 -05:00
committed by GitHub
parent d62c784789
commit 719fd72c38
685 changed files with 76244 additions and 53721 deletions

View File

@@ -24,16 +24,15 @@ class Grid extends StatelessWidget {
return Scaffold(
body: GridView.builder(
itemCount: 40,
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
),
itemBuilder: (context, index) {
return (index >= 20)
? const SmallCard(
imageAssetName: 'assets/eat_cape_town_sm.jpg',
)
? const SmallCard(imageAssetName: 'assets/eat_cape_town_sm.jpg')
: const SmallCard(
imageAssetName: 'assets/eat_new_orleans_sm.jpg',
);
imageAssetName: 'assets/eat_new_orleans_sm.jpg',
);
},
),
);
@@ -46,14 +45,12 @@ Route _createRoute(BuildContext parentContext, String image) {
return _SecondPage(image);
},
transitionsBuilder: (context, animation, secondaryAnimation, child) {
var rectAnimation = _createTween(parentContext)
.chain(CurveTween(curve: Curves.ease))
.animate(animation);
var rectAnimation = _createTween(
parentContext,
).chain(CurveTween(curve: Curves.ease)).animate(animation);
return Stack(
children: [
PositionedTransition(rect: rectAnimation, child: child),
],
children: [PositionedTransition(rect: rectAnimation, child: child)],
);
},
);
@@ -65,10 +62,7 @@ Tween<RelativeRect> _createTween(BuildContext context) {
var rect = box.localToGlobal(Offset.zero) & box.size;
var relativeRect = RelativeRect.fromSize(rect, windowSize);
return RelativeRectTween(
begin: relativeRect,
end: RelativeRect.fill,
);
return RelativeRectTween(begin: relativeRect, end: RelativeRect.fill);
}
class SmallCard extends StatelessWidget {
@@ -84,10 +78,7 @@ class SmallCard extends StatelessWidget {
var nav = Navigator.of(context);
nav.push<void>(_createRoute(context, imageAssetName));
},
child: Image.asset(
imageAssetName,
fit: BoxFit.cover,
),
child: Image.asset(imageAssetName, fit: BoxFit.cover),
),
),
);
@@ -109,10 +100,7 @@ class _SecondPage extends StatelessWidget {
onTap: () => Navigator.of(context).pop(),
child: AspectRatio(
aspectRatio: 1,
child: Image.asset(
imageAssetName,
fit: BoxFit.cover,
),
child: Image.asset(imageAssetName, fit: BoxFit.cover),
),
),
),