-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
967 additions
and
718 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,67 @@ | ||
import 'package:hive_flutter/hive_flutter.dart'; | ||
|
||
import '../internal/hive.dart'; | ||
|
||
part 'announcement.g.dart'; | ||
|
||
@HiveType(typeId: MyHive.mikanAnnouncement) | ||
class Announcement extends HiveObject { | ||
Announcement({ | ||
required this.date, | ||
required this.nodes, | ||
}); | ||
|
||
@HiveField(0) | ||
late String date; | ||
@HiveField(1) | ||
late List<AnnouncementNode> nodes; | ||
|
||
late final text = () { | ||
final sb = StringBuffer() | ||
..write('{') | ||
..write(date) | ||
..write('} '); | ||
for (final node in nodes) { | ||
sb.write(node.text); | ||
} | ||
return sb.toString(); | ||
}(); | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is Announcement && | ||
runtimeType == other.runtimeType && | ||
date == other.date; | ||
|
||
@override | ||
int get hashCode => date.hashCode; | ||
|
||
@override | ||
String toString() { | ||
return 'Announcement{date: $date, nodes: $nodes, text: $text}'; | ||
} | ||
} | ||
|
||
|
||
|
||
@HiveType(typeId: MyHive.mikanAnnouncementNode) | ||
class AnnouncementNode extends HiveObject { | ||
AnnouncementNode({ | ||
required this.text, | ||
this.type, | ||
this.place, | ||
}); | ||
|
||
@HiveField(0) | ||
late String text; | ||
@HiveField(1) | ||
String? type; | ||
@HiveField(2) | ||
String? place; | ||
|
||
@override | ||
String toString() { | ||
return 'AnnouncementNode{text: $text, type: $type, place: $place}'; | ||
} | ||
} |
Oops, something went wrong.