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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user