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:
@@ -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),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user