NEW: moved Link class to be with main Linkify class for type saftey, code completion, all good
This commit is contained in:
parent
40330ad1af
commit
46d21c5244
|
@ -1,3 +1,8 @@
|
|||
## 1.2.0
|
||||
|
||||
- Improved with J3G skillz
|
||||
- Merged updates from other branches, improves regex
|
||||
|
||||
## 1.1.5
|
||||
|
||||
- Enforce lint rules
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle;
|
|||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:linkify_text/src/enum.dart';
|
||||
import 'package:linkify_text/src/model/link.dart';
|
||||
import 'package:linkify_text/src/utils/regex.dart';
|
||||
|
||||
/// Linkify [text] containing urls, emails or hashtag
|
||||
|
@ -414,3 +413,18 @@ TextSpan _linkify({
|
|||
|
||||
return TextSpan(children: spans);
|
||||
}
|
||||
|
||||
/// Model class for Link data
|
||||
class Link {
|
||||
late final String? _value;
|
||||
late final LinkType? _type;
|
||||
String? get value => _value;
|
||||
LinkType? get type => _type;
|
||||
|
||||
/// construct link from matched regExp
|
||||
Link.fromMatch(RegExpMatch match) {
|
||||
final String _match = match.input.substring(match.start, match.end);
|
||||
_type = getMatchedType(_match);
|
||||
_value = _match;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
import 'package:linkify_text/src/enum.dart';
|
||||
import 'package:linkify_text/src/utils/regex.dart';
|
||||
|
||||
class Link {
|
||||
late final String? _value;
|
||||
late final LinkType? _type;
|
||||
String? get value => _value;
|
||||
LinkType? get type => _type;
|
||||
|
||||
/// construct link from matched regExp
|
||||
Link.fromMatch(RegExpMatch match) {
|
||||
final String _match = match.input.substring(match.start, match.end);
|
||||
_type = getMatchedType(_match);
|
||||
_value = _match;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue