From fd915ceb9a509b2caa3073c3c013f72f115a5568 Mon Sep 17 00:00:00 2001 From: zin- Date: Mon, 16 Sep 2024 15:39:45 +0900 Subject: [PATCH] wip drop: Mem v1 wip drop: EntityV1 --- .../created_and_updated_at_texts.dart | 6 +-- lib/core/mem.dart | 50 +------------------ lib/mems/detail/body.dart | 6 ++- 3 files changed, 9 insertions(+), 53 deletions(-) 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, + ), + ), ), ], ),