Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Support Example',
- home: MyHomePage(title: 'Support Example'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- PointerDownEvent lastPointerDownEvent;
- DragUpdateDetails lastDragUpdateDetails;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- // Here we take the value from the MyHomePage object that was created by
- // the App.build method, and use it to set our appbar title.
- title: Text(widget.title),
- ),
- body: Listener(
- onPointerDown: (PointerDownEvent event) {
- setState(() {
- this.lastPointerDownEvent = event;
- print('lastPointerDownEvent: ${lastPointerDownEvent}');
- });
- },
- child: GestureDetector(
- onPanUpdate: (DragUpdateDetails details) {
- setState(() {
- this.lastDragUpdateDetails = details;
- });
- },
- child: Column (
- children: <Widget>[
- Expanded(
- child: Container(
- child: Text('lastPointerDownEvent: ${lastPointerDownEvent} \n\n lastDragUpdateDetails: $lastDragUpdateDetails'),
- color: Colors.red[200],
- ),
- ),
- ],
- ),
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement