Showing
4 changed files
with
50 additions
and
10 deletions
| 1 | -TODO: Add your license here. | 1 | +BSD 3-Clause License |
| 2 | + | ||
| 3 | +Copyright (c) 2024, Dubhe | ||
| 4 | + | ||
| 5 | +Redistribution and use in source and binary forms, with or without | ||
| 6 | +modification, are permitted provided that the following conditions are met: | ||
| 7 | + | ||
| 8 | +1. Redistributions of source code must retain the above copyright notice, this | ||
| 9 | + list of conditions and the following disclaimer. | ||
| 10 | + | ||
| 11 | +2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 12 | + this list of conditions and the following disclaimer in the documentation | ||
| 13 | + and/or other materials provided with the distribution. | ||
| 14 | + | ||
| 15 | +3. Neither the name of the copyright holder nor the names of its | ||
| 16 | + contributors may be used to endorse or promote products derived from | ||
| 17 | + this software without specific prior written permission. | ||
| 18 | + | ||
| 19 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 20 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 21 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
| 22 | +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
| 23 | +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 24 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
| 25 | +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
| 26 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
| 27 | +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
| 28 | +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 1 | import 'package:auto_track/auto_track.dart'; | 1 | import 'package:auto_track/auto_track.dart'; |
| 2 | -import 'package:auto_track/auto_track/config/config.dart'; | ||
| 3 | -import 'package:auto_track/auto_track/index.dart'; | ||
| 4 | import 'package:auto_track_example/home.dart'; | 2 | import 'package:auto_track_example/home.dart'; |
| 5 | import 'package:auto_track_example/page_a.dart'; | 3 | import 'package:auto_track_example/page_a.dart'; |
| 6 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| @@ -26,12 +24,13 @@ class _MyAppState extends State<MyApp> { | @@ -26,12 +24,13 @@ class _MyAppState extends State<MyApp> { | ||
| 26 | AutoTrackPageConfig<PageA>( | 24 | AutoTrackPageConfig<PageA>( |
| 27 | pageID: 'page_a', | 25 | pageID: 'page_a', |
| 28 | ), | 26 | ), |
| 29 | - | ||
| 30 | ])) | 27 | ])) |
| 31 | .enable() | 28 | .enable() |
| 32 | .enablePageLeave() | 29 | .enablePageLeave() |
| 33 | .enablePageView() | 30 | .enablePageView() |
| 34 | .enableClick() | 31 | .enableClick() |
| 32 | + .enableDrag() | ||
| 33 | + .enableIgnoreNullKey() | ||
| 35 | .enableLog(); | 34 | .enableLog(); |
| 36 | 35 | ||
| 37 | super.initState(); | 36 | super.initState(); |
| @@ -5,11 +5,25 @@ class PageA extends StatelessWidget { | @@ -5,11 +5,25 @@ class PageA extends StatelessWidget { | ||
| 5 | 5 | ||
| 6 | @override | 6 | @override |
| 7 | Widget build(BuildContext context) { | 7 | Widget build(BuildContext context) { |
| 8 | - return GestureDetector( | ||
| 9 | - onTap: () { | ||
| 10 | - print("tap page a"); | ||
| 11 | - }, | ||
| 12 | - child: const Text('page a'), | 8 | + return Container( |
| 9 | + margin: const EdgeInsets.only(top: 200), | ||
| 10 | + child: Column( | ||
| 11 | + children: [ | ||
| 12 | + GestureDetector( | ||
| 13 | + onTap: () { | ||
| 14 | + print("tap page a null key"); | ||
| 15 | + }, | ||
| 16 | + child: const Text('null key'), | ||
| 17 | + ), | ||
| 18 | + GestureDetector( | ||
| 19 | + key: const Key('page-a-click'), | ||
| 20 | + onTap: () { | ||
| 21 | + print("tap page a"); | ||
| 22 | + }, | ||
| 23 | + child: const Text('have key'), | ||
| 24 | + ) | ||
| 25 | + ], | ||
| 26 | + ), | ||
| 13 | ); | 27 | ); |
| 14 | } | 28 | } |
| 15 | } | 29 | } |
-
Please register or login to post a comment