cpd/lib/database/habit.dart

29 lines
635 B
Dart
Raw Normal View History

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Habit {
final int id;
bool isComplete;
String title;
String? subtitle;
IconData icon;
Habit({
required this.id,
required this.isComplete,
required this.title,
this.subtitle,
required this.icon,
});
factory Habit.fromSqfliteDatabase(Map<String, dynamic> map) => Habit(
id: map['id']?.toInt() ?? 0,
isComplete: map['isComplete'] ?? false,
title: map['title'] ?? '',
subtitle: map['subtitle'] ?? '',
icon: IconData(int.parse(map['icon']), fontFamily: 'MaterialIcons'),
//icon: map['icon'] ?? '',
);
}