-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[web] Introduce the Link widget #2813
Conversation
4e0d8a1 to
5635de1
Compare
| // TODO(mdebbar): how do we know if this is true or false? | ||
| final bool isUsingRouter = false; | ||
| // QUESTION: does this update the history entry on the engine side? | ||
| final MethodCall call = isUsingRouter | ||
| ? MethodCall('pushRouteInformation', <dynamic, dynamic>{ | ||
| 'location': routeName, | ||
| 'state': null, | ||
| }) | ||
| : MethodCall('pushRoute', routeName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chunhtai is there a way currently to tell if the app is in Router mode? Maybe inspect the widget hierarchy for a Router widget?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no standard API to check that. Since this is a separate package, i think just do a Router.of(context, nullOk: true) != null should be fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| @override | ||
| Future<void> clearFocus() async { | ||
| // Currently this does nothing on Flutter Web. | ||
| // TODO(het): Implement this. See https://github.com/flutter/flutter/issues/39496 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was copied from the similar implementation in the framework. Not sure what's the right thing to do here @hterkelsen.
harryterkelsen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. Unfortunate that we have to use PlatformViewLink here for a pretty simple use case. This highlights how much we need to flesh out/fix HtmlElementView.
In order to actually land this, you will need to split it up into 2 CLs: one which lands the changes in the _interface package (with CHANGELOG and pubspec version bump) and one which uses those changes in package:url_launcher.
| widget.link.isDisabled ? null : _followLink, | ||
| ), | ||
| Positioned.fill( | ||
| // child: _LinkHtmlView(uri: link.uri, target: link.target), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this line and add a TODO to use a PlatformView once hit testing is fixed and creation parameters supported
|
(Moved my review to the PRs above) |
This PR introduces the Link widget and provides an implementation for the web.
The design of this widget has been discussed in:
Issues: