More documentation (#10606)

- How do you handle a tap on text?
- Why is AnimatedOpacity expensive?
- Why would you use a gesture arena team?
...and other minor fixes
This commit is contained in:
Ian Hickson
2017-06-12 16:53:01 -07:00
committed by GitHub
parent 9ac16680d2
commit a9f1cb8c0a
9 changed files with 178 additions and 29 deletions

View File

@@ -11,6 +11,20 @@ import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class LinkTextSpan extends TextSpan {
// Beware!
//
// This class is only safe because the TapGestureRecognizer is not
// given a deadline and therefore never allocates any resources.
//
// In any other situation -- setting a deadline, using any of the less trivial
// recognizers, etc -- you would have to manage the gesture recognizer's
// lifetime and call dispose() when the TextSpan was no longer being rendered.
//
// Since TextSpan itself is @immutable, this means that you would have to
// manage the recognizer from outside the TextSpan, e.g. in the State of a
// stateful widget that then hands the recognizer to the TextSpan.
LinkTextSpan({ TextStyle style, String url, String text }) : super(
style: style,
text: text ?? url,