diff --git a/lib/components/created_and_updated_at_texts.dart b/lib/components/created_and_updated_at_texts.dart index aa7c6504a..835c35e91 100644 --- a/lib/components/created_and_updated_at_texts.dart +++ b/lib/components/created_and_updated_at_texts.dart @@ -3,18 +3,18 @@ import 'package:mem/components/date_and_time/date_and_time_view.dart'; import 'package:mem/core/date_and_time/date_and_time.dart'; import 'package:mem/core/mem.dart'; import 'package:mem/logger/log_service.dart'; -import 'package:mem/repositories/mem.dart'; +import 'package:mem/repositories/mem_entity.dart'; import 'package:mem/values/colors.dart'; class CreatedAndUpdatedAtTexts extends StatelessWidget { - final MemV1 _entity; + final Mem _entity; const CreatedAndUpdatedAtTexts(this._entity, {super.key}); @override Widget build(BuildContext context) => v( () { - if (_entity is SavedMemV1) { + if (_entity is SavedMemEntity) { return Wrap( direction: Axis.horizontal, children: [ diff --git a/lib/core/mem.dart b/lib/core/mem.dart index 14f4602b6..b4f056c5e 100644 --- a/lib/core/mem.dart +++ b/lib/core/mem.dart @@ -14,55 +14,7 @@ class Mem { Mem(this.name, this.doneAt, this.period); -// factory Mem.defaultNew() => Mem("", null, null); -// -// bool get isDone => doneAt != null; -// -// Iterable periodSchedules( -// TimeOfDay startOfDay, -// ) => -// v( -// () { -// final id = this is SavedMemV1 ? (this as SavedMemV1).id : null; -// -// return id == null -// ? throw Exception() // coverage:ignore-line -// : [ -// Schedule.of( -// id, -// period?.start?.isAllDay == true -// ? DateTime( -// period!.start!.year, -// period!.start!.month, -// period!.start!.day, -// startOfDay.hour, -// startOfDay.minute, -// ) -// : period?.start, -// NotificationType.startMem, -// ), -// Schedule.of( -// id, -// period?.end?.isAllDay == true -// ? DateTime( -// period!.end!.year, -// period!.end!.month, -// period!.end!.day, -// startOfDay.hour, -// startOfDay.minute, -// ) -// .add(const Duration(days: 1)) -// .subtract(const Duration(minutes: 1)) -// : period?.end, -// NotificationType.endMem, -// ), -// ]; -// }, -// { -// 'this': this, -// 'startOfDay': startOfDay, -// }, -// ); + static Mem fromV1(MemV1 v1) => Mem(v1.name, v1.doneAt, v1.period); } class MemV1 extends EntityV1 { diff --git a/lib/mems/detail/body.dart b/lib/mems/detail/body.dart index 8fec7d92e..78a7c2e8a 100644 --- a/lib/mems/detail/body.dart +++ b/lib/mems/detail/body.dart @@ -72,7 +72,11 @@ class _MemDetailBodyComponent extends StatelessWidget { ), Padding( padding: pageBottomPadding, - child: CreatedAndUpdatedAtTexts(_mem), + child: CreatedAndUpdatedAtTexts( + Mem.fromV1( + _mem, + ), + ), ), ], ),