* still in draft * feat(reading_assistance): whole message activity oriented * chore: fix .env file path * feat: animate selected toolbar into middle of screen * chore: initial work for message bubble size animation * refactor(reading_assistance): hooking up the choice interactions and polishing UI * chore: animate in content and buttons * formatting * position reading content relative to selected token * working on limiting choices * chore: fix positioning of toolbar animation * chore: simplify positioning logic * chore: animate in button height * getting there * rough draft with restricted activity number is complete --------- Co-authored-by: ggurdin <ggurdin@gmail.com>
47 lines
1.2 KiB
Dart
47 lines
1.2 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
class PangeaTokenText {
|
|
int offset;
|
|
String content;
|
|
int length;
|
|
|
|
PangeaTokenText({
|
|
required this.offset,
|
|
required this.content,
|
|
required this.length,
|
|
});
|
|
|
|
factory PangeaTokenText.fromJson(Map<String, dynamic> json) {
|
|
debugger(when: kDebugMode && json[_offsetKey] == null);
|
|
return PangeaTokenText(
|
|
offset: json[_offsetKey],
|
|
content: json[_contentKey],
|
|
length: json[_lengthKey] ?? (json[_contentKey] as String).length,
|
|
);
|
|
}
|
|
|
|
static const String _offsetKey = "offset";
|
|
static const String _contentKey = "content";
|
|
static const String _lengthKey = "length";
|
|
|
|
Map<String, dynamic> toJson() =>
|
|
{_offsetKey: offset, _contentKey: content, _lengthKey: length};
|
|
|
|
//override equals and hashcode
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (other is PangeaTokenText) {
|
|
return other.offset == offset &&
|
|
other.content == content &&
|
|
other.length == length;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => offset.hashCode ^ content.hashCode ^ length.hashCode;
|
|
|
|
String get uniqueKey => "$content-$offset-$length";
|
|
}
|