Last active
August 19, 2024 16:18
-
-
Save alefwd/387136cf37f685a2b73b07356e3a8926 to your computer and use it in GitHub Desktop.
Splash effect blocked by inner layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Padding( | |
padding: EdgeInsets.all(20), | |
child: SizedBox( | |
width: 280, | |
child: Column( | |
children: [ | |
PokeCard( | |
child: ChunkCard(), | |
), | |
ChunkCard(), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} | |
class PokeCard extends StatelessWidget { | |
const PokeCard({required this.child, super.key}); | |
static final _corner = BorderRadius.circular(20); | |
final Widget child; | |
@override | |
Widget build(BuildContext context) { | |
return Card( | |
elevation: 0, | |
color: Colors.yellow, | |
surfaceTintColor: Colors.white, | |
clipBehavior: Clip.antiAlias, | |
shape: RoundedRectangleBorder( | |
borderRadius: _corner, | |
), | |
child: InkWell( | |
onTap: () => debugPrint('Poke tapped'), | |
borderRadius: _corner, | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Image.network( | |
'https://miro.medium.com/v2/resize:fit:1400/format:webp/1*lt8tmPdknVSpx2tcL8HizQ.png', | |
height: 150, | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 10, top: 10), | |
child: Text('Free welcome gift!'), | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 10, bottom: 10), | |
child: Text('Activate to enjoy'), | |
), | |
child, | |
], | |
), | |
), | |
); | |
} | |
} | |
class ChunkCard extends StatelessWidget { | |
const ChunkCard(); | |
static final _corner = BorderRadius.circular(20); | |
@override | |
Widget build(BuildContext context) { | |
return Card( | |
margin: EdgeInsets.zero, | |
color: Colors.orange, | |
surfaceTintColor: Colors.white, | |
elevation: 0, | |
shape: RoundedRectangleBorder( | |
borderRadius: _corner, | |
), | |
child: InkWell( | |
onTap: () => debugPrint('Chunk tapped'), | |
borderRadius: _corner, | |
child: Padding( | |
padding: const EdgeInsets.fromLTRB(20, 24, 20, 24), | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: [ | |
Text('10 minutes'), | |
Text('€12.34'), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment