Last active
December 16, 2019 08:23
-
-
Save phanirithvij/3d6a66e5d72b06a5d81293346841a2bf to your computer and use it in GitHub Desktop.
A pageview example
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(MaterialApp( | |
home: Scaffold( | |
body: PageviewDemo(), | |
))); | |
} | |
class PageviewDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Stack( | |
children: <Widget>[ | |
Container( | |
color: Colors.blue[200].withOpacity(0.3), | |
child: GestureDetector( | |
onTap: () => print("A tap on the logo"), | |
child: Center( | |
child: FlutterLogo( | |
size: 100, | |
colors: Colors.amber, | |
), | |
), | |
), | |
), | |
// IgnorePointer( | |
GestureDetector( | |
// Comment these five lines (28-32) and uncomment the IgnorePointer then tap on the logo | |
// The IgnorePointer prevents scrolling which is not intended | |
behavior: HitTestBehavior.translucent, | |
onTap: () => print("A Tap on the page view"), | |
child: PageView( | |
controller: PageController(viewportFraction: 0.8), | |
children: <Widget>[ | |
Container( | |
color: Colors.grey[200].withOpacity(0.7), | |
), | |
Container( | |
color: Colors.red[200].withOpacity(0.7), | |
), | |
Container( | |
color: Colors.yellow[200].withOpacity(0.7), | |
), | |
], | |
), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment