-
-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from vrtdev/feature/268-inner-links
Support inner links
- Loading branch information
Showing
11 changed files
with
114 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:flutter_html/src/styled_element.dart'; | ||
|
||
class AnchorKey extends GlobalKey { | ||
final Key parentKey; | ||
final String id; | ||
|
||
const AnchorKey._(this.parentKey, this.id) : super.constructor(); | ||
|
||
static AnchorKey? of(Key? parentKey, StyledElement? id) { | ||
return forId(parentKey, id?.elementId); | ||
} | ||
|
||
static AnchorKey? forId(Key? parentKey, String? id) { | ||
if (parentKey == null || id == null || id.isEmpty || id == "[[No ID]]") { | ||
return null; | ||
} | ||
return AnchorKey._(parentKey, id); | ||
} | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is AnchorKey && runtimeType == other.runtimeType && parentKey == other.parentKey && id == other.id; | ||
|
||
@override | ||
int get hashCode => parentKey.hashCode ^ id.hashCode; | ||
|
||
@override | ||
String toString() { | ||
return 'AnchorKey{parentKey: $parentKey, id: #$id}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.