git-touch-android-ios-app/lib/models/notification.dart

34 lines
721 B
Dart
Raw Permalink Normal View History

2022-09-17 14:35:45 +02:00
import 'package:flutter/widgets.dart';
2019-12-26 11:00:36 +01:00
import 'package:git_touch/models/github.dart';
import 'package:git_touch/utils/utils.dart';
2022-10-03 12:21:22 +02:00
import 'package:tuple/tuple.dart';
2019-12-26 11:00:36 +01:00
class NotificationGroup {
2022-09-21 18:28:21 +02:00
NotificationGroup(this.fullName);
2021-05-16 09:16:35 +02:00
String? fullName;
2019-12-26 11:00:36 +01:00
List<GithubNotificationItem> items = [];
2021-05-16 09:16:35 +02:00
Tuple2<String, String>? _repo;
2019-12-26 11:00:36 +01:00
String get owner {
2022-09-06 18:28:12 +02:00
_repo ??= parseRepositoryFullName(fullName!);
2021-05-16 09:16:35 +02:00
return _repo!.item1;
2019-12-26 11:00:36 +01:00
}
2019-09-03 05:56:25 +02:00
2019-12-26 11:00:36 +01:00
String get name {
2022-09-06 18:28:12 +02:00
_repo ??= parseRepositoryFullName(fullName!);
2021-05-16 09:16:35 +02:00
return _repo!.item2;
2019-09-03 05:56:25 +02:00
}
2019-12-26 11:00:36 +01:00
String get key => '_$hashCode';
2019-09-03 05:56:25 +02:00
}
2019-09-02 14:40:20 +02:00
class NotificationModel with ChangeNotifier {
int _count = 0;
int get count => _count;
setCount(int v) {
_count = v;
notifyListeners();
}
}