Skip to content

Instantly share code, notes, and snippets.

@vi-k
Last active December 27, 2020 23:27
Show Gist options
  • Save vi-k/db187d1cae2d3a0b5c819afe8e2ae21b to your computer and use it in GitHub Desktop.
Save vi-k/db187d1cae2d3a0b5c819afe8e2ae21b to your computer and use it in GitHub Desktop.
Ripple-effect test
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final title = 'Ink';
return MaterialApp(
title: title,
theme: ThemeData(
//highlightColor: Colors.green.withOpacity(0.5),
splashColor: Colors.red.withOpacity(0.8),
),
home: Scaffold(
appBar: AppBar(
title: Text(title),
),
body: SingleChildScrollView(
child: Wrap(
children: [
Container(
height: 300,
width: 300,
child: Stack(
children: [
Center(
child: Ink(
child:
Image.network('https://picsum.photos/250?image=9'),
),
),
Positioned.fill(
child: InkWell(
onTap: () {
print('onTap');
},
),
),
],
),
),
Container(
height: 300,
width: 300,
child: Ink(
child: InkWell(
onTap: () {
print('onTap');
},
child: Center(
child: Image.network('https://picsum.photos/250?image=9'),
),
),
),
),
Container(
height: 300,
width: 300,
child: Stack(
children: [
Center(
child: Image.network('https://picsum.photos/250?image=9'),
),
Positioned.fill(
child: Material(
type: MaterialType.transparency,
child: InkWell(
onTap: () {
print('onTap');
},
),
),
),
],
),
),
Container(
height: 300,
width: 300,
child: Stack(
children: [
Center(
child: Image.network('https://picsum.photos/250?image=9'),
),
Positioned.fill(
child: MaterialButton(
onPressed: () {
print('onTap');
},
),
),
],
),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment