diff --git a/lib/interfaces/add_widget.dart b/lib/interfaces/add_widget.dart index 5b5e043..1e63ad1 100644 --- a/lib/interfaces/add_widget.dart +++ b/lib/interfaces/add_widget.dart @@ -17,7 +17,7 @@ class _AddWidgetState extends State { @override Widget build(BuildContext context) { return AlertDialog( - title: const Text('Insert content'), + title: Text('Insert ${linkType == LinkType.code ? "code" : "link"}'), content: SingleChildScrollView( child: ListBody( children: [ diff --git a/lib/services/database_local.dart b/lib/services/database_local.dart index e12a138..334ebbd 100644 --- a/lib/services/database_local.dart +++ b/lib/services/database_local.dart @@ -62,12 +62,7 @@ class DatabaseLocal { Future> addLink(LMSContent lmsContent) async { try { - await db?.insert(kDBTable, { - 'title': lmsContent.title, - 'description': lmsContent.description, - 'content': lmsContent.content, - 'type': '${lmsContent.linkType}' - }); + await db?.insert(kDBTable, LMSContent.toJson(lmsContent)); } catch (e) { debugPrint("ERROR CREATING: $e"); return {"success": false, "message": "$e"}; @@ -87,7 +82,7 @@ class DatabaseLocal { } Future> readDB() async { - debugPrint('Read table $kDBTable'); + debugPrint('Reading table $kDBTable'); var body = await db?.query(kDBTable); debugPrint("BODY: $body"); return LMSContent.listFromJson(body: body);