Rebuild Noo as a full Nextcloud client: auth, media, and Material You UI
Replaces the starter template with Login Flow v2 auth, WebDAV-backed Files/Photos/Activity tabs, a swipeable media viewer with PDF/text/video preview, Material You dynamic theming, a frosted-glass floating nav bar, and a rebranded app icon/identity (com.example -> family.nasa). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,12 +9,14 @@ class NextcloudItem {
|
||||
final NextcloudItemType type;
|
||||
final int size; // in bytes
|
||||
final DateTime lastModified;
|
||||
final DateTime dateCreated;
|
||||
final bool isFavorite;
|
||||
final String? mimeType;
|
||||
final String? etag;
|
||||
final String? previewUrl;
|
||||
final int? imageWidth;
|
||||
final int? imageHeight;
|
||||
final String? mountType;
|
||||
|
||||
const NextcloudItem({
|
||||
required this.id,
|
||||
@@ -23,16 +25,20 @@ class NextcloudItem {
|
||||
required this.type,
|
||||
required this.size,
|
||||
required this.lastModified,
|
||||
DateTime? dateCreated,
|
||||
this.isFavorite = false,
|
||||
this.mimeType,
|
||||
this.etag,
|
||||
this.previewUrl,
|
||||
this.imageWidth,
|
||||
this.imageHeight,
|
||||
});
|
||||
this.mountType,
|
||||
}) : dateCreated = dateCreated ?? lastModified;
|
||||
|
||||
bool get isFolder => type == NextcloudItemType.folder;
|
||||
bool get isMedia => type == NextcloudItemType.image || type == NextcloudItemType.video;
|
||||
bool get isMedia =>
|
||||
type == NextcloudItemType.image || type == NextcloudItemType.video;
|
||||
bool get isExternalStorage => mountType == 'external';
|
||||
|
||||
NextcloudItem copyWith({
|
||||
String? id,
|
||||
@@ -41,12 +47,14 @@ class NextcloudItem {
|
||||
NextcloudItemType? type,
|
||||
int? size,
|
||||
DateTime? lastModified,
|
||||
DateTime? dateCreated,
|
||||
bool? isFavorite,
|
||||
String? mimeType,
|
||||
String? etag,
|
||||
String? previewUrl,
|
||||
int? imageWidth,
|
||||
int? imageHeight,
|
||||
String? mountType,
|
||||
}) {
|
||||
return NextcloudItem(
|
||||
id: id ?? this.id,
|
||||
@@ -55,31 +63,58 @@ class NextcloudItem {
|
||||
type: type ?? this.type,
|
||||
size: size ?? this.size,
|
||||
lastModified: lastModified ?? this.lastModified,
|
||||
dateCreated: dateCreated ?? this.dateCreated,
|
||||
isFavorite: isFavorite ?? this.isFavorite,
|
||||
mimeType: mimeType ?? this.mimeType,
|
||||
etag: etag ?? this.etag,
|
||||
previewUrl: previewUrl ?? this.previewUrl,
|
||||
imageWidth: imageWidth ?? this.imageWidth,
|
||||
imageHeight: imageHeight ?? this.imageHeight,
|
||||
mountType: mountType ?? this.mountType,
|
||||
);
|
||||
}
|
||||
|
||||
static NextcloudItemType deduceType(String path, bool isCollection, String? mime) {
|
||||
static NextcloudItemType deduceType(
|
||||
String path,
|
||||
bool isCollection,
|
||||
String? mime,
|
||||
) {
|
||||
if (isCollection) return NextcloudItemType.folder;
|
||||
final lower = path.toLowerCase();
|
||||
if (mime?.startsWith('image/') == true || lower.endsWith('.jpg') || lower.endsWith('.jpeg') || lower.endsWith('.png') || lower.endsWith('.webp') || lower.endsWith('.gif') || lower.endsWith('.heic')) {
|
||||
if (mime?.startsWith('image/') == true ||
|
||||
lower.endsWith('.jpg') ||
|
||||
lower.endsWith('.jpeg') ||
|
||||
lower.endsWith('.png') ||
|
||||
lower.endsWith('.webp') ||
|
||||
lower.endsWith('.gif') ||
|
||||
lower.endsWith('.heic')) {
|
||||
return NextcloudItemType.image;
|
||||
}
|
||||
if (mime?.startsWith('video/') == true || lower.endsWith('.mp4') || lower.endsWith('.mov') || lower.endsWith('.mkv') || lower.endsWith('.webm')) {
|
||||
if (mime?.startsWith('video/') == true ||
|
||||
lower.endsWith('.mp4') ||
|
||||
lower.endsWith('.mov') ||
|
||||
lower.endsWith('.mkv') ||
|
||||
lower.endsWith('.webm')) {
|
||||
return NextcloudItemType.video;
|
||||
}
|
||||
if (mime?.startsWith('audio/') == true || lower.endsWith('.mp3') || lower.endsWith('.flac') || lower.endsWith('.wav') || lower.endsWith('.ogg')) {
|
||||
if (mime?.startsWith('audio/') == true ||
|
||||
lower.endsWith('.mp3') ||
|
||||
lower.endsWith('.flac') ||
|
||||
lower.endsWith('.wav') ||
|
||||
lower.endsWith('.ogg')) {
|
||||
return NextcloudItemType.audio;
|
||||
}
|
||||
if (lower.endsWith('.pdf') || lower.endsWith('.txt') || lower.endsWith('.md') || lower.endsWith('.docx') || lower.endsWith('.xlsx')) {
|
||||
if (lower.endsWith('.pdf') ||
|
||||
lower.endsWith('.txt') ||
|
||||
lower.endsWith('.md') ||
|
||||
lower.endsWith('.docx') ||
|
||||
lower.endsWith('.xlsx')) {
|
||||
return NextcloudItemType.document;
|
||||
}
|
||||
if (lower.endsWith('.zip') || lower.endsWith('.tar') || lower.endsWith('.gz') || lower.endsWith('.7z')) {
|
||||
if (lower.endsWith('.zip') ||
|
||||
lower.endsWith('.tar') ||
|
||||
lower.endsWith('.gz') ||
|
||||
lower.endsWith('.7z')) {
|
||||
return NextcloudItemType.archive;
|
||||
}
|
||||
return NextcloudItemType.file;
|
||||
|
||||
Reference in New Issue
Block a user