feat: appbar

This commit is contained in:
shenlong-tanwen
2024-10-27 23:43:58 +05:30
parent 5385d43c8c
commit 8450c8cc4f
40 changed files with 1150 additions and 211 deletions
@@ -0,0 +1,56 @@
class ServerDiskInfo {
final int diskAvailableInBytes;
final int diskSizeInBytes;
final int diskUseInBytes;
final double diskUsagePercentage;
const ServerDiskInfo({
required this.diskAvailableInBytes,
required this.diskSizeInBytes,
required this.diskUseInBytes,
required this.diskUsagePercentage,
});
const ServerDiskInfo.initial()
: diskSizeInBytes = -1,
diskUseInBytes = -1,
diskAvailableInBytes = -1,
diskUsagePercentage = -1;
ServerDiskInfo copyWith({
int? diskAvailableInBytes,
int? diskSizeInBytes,
int? diskUseInBytes,
double? diskUsagePercentage,
}) {
return ServerDiskInfo(
diskAvailableInBytes: diskAvailableInBytes ?? this.diskAvailableInBytes,
diskSizeInBytes: diskSizeInBytes ?? this.diskSizeInBytes,
diskUseInBytes: diskUseInBytes ?? this.diskUseInBytes,
diskUsagePercentage: diskUsagePercentage ?? this.diskUsagePercentage,
);
}
@override
String toString() {
return 'ServerDiskInfo(diskAvailableInBytes: $diskAvailableInBytes, diskSizeInBytes: $diskSizeInBytes, diskUseInBytes: $diskUseInBytes, diskUsagePercentage: $diskUsagePercentage)';
}
@override
bool operator ==(covariant ServerDiskInfo other) {
if (identical(this, other)) return true;
return other.diskAvailableInBytes == diskAvailableInBytes &&
other.diskSizeInBytes == diskSizeInBytes &&
other.diskUseInBytes == diskUseInBytes &&
other.diskUsagePercentage == diskUsagePercentage;
}
@override
int get hashCode {
return diskAvailableInBytes.hashCode ^
diskSizeInBytes.hashCode ^
diskUseInBytes.hashCode ^
diskUsagePercentage.hashCode;
}
}
@@ -1,37 +0,0 @@
import 'package:immich_mobile/domain/models/server-info/server_config.model.dart';
import 'package:immich_mobile/domain/models/server-info/server_features.model.dart';
class ServerFeatureConfig {
final ServerFeatures features;
final ServerConfig config;
const ServerFeatureConfig({required this.features, required this.config});
ServerFeatureConfig copyWith({
ServerFeatures? features,
ServerConfig? config,
}) {
return ServerFeatureConfig(
features: features ?? this.features,
config: config ?? this.config,
);
}
const ServerFeatureConfig.initial()
: features = const ServerFeatures.initial(),
config = const ServerConfig.initial();
@override
String toString() =>
'ServerFeatureConfig(features: $features, config: $config)';
@override
bool operator ==(covariant ServerFeatureConfig other) {
if (identical(this, other)) return true;
return other.features == features && other.config == config;
}
@override
int get hashCode => features.hashCode ^ config.hashCode;
}
@@ -0,0 +1,56 @@
import 'package:immich_mobile/domain/models/server-info/server_config.model.dart';
import 'package:immich_mobile/domain/models/server-info/server_disk_info.model.dart';
import 'package:immich_mobile/domain/models/server-info/server_features.model.dart';
import 'package:immich_mobile/domain/models/server-info/server_version.model.dart';
class ServerInfo {
final ServerFeatures features;
final ServerConfig config;
final ServerDiskInfo disk;
final ServerVersion version;
const ServerInfo({
required this.features,
required this.config,
required this.disk,
required this.version,
});
ServerInfo copyWith({
ServerFeatures? features,
ServerConfig? config,
ServerDiskInfo? disk,
ServerVersion? version,
}) {
return ServerInfo(
features: features ?? this.features,
config: config ?? this.config,
disk: disk ?? this.disk,
version: version ?? this.version,
);
}
const ServerInfo.initial()
: features = const ServerFeatures.initial(),
config = const ServerConfig.initial(),
disk = const ServerDiskInfo.initial(),
version = const ServerVersion.initial();
@override
String toString() =>
'ServerInfo(features: $features, config: $config, disk: $disk, version: $version)';
@override
bool operator ==(covariant ServerInfo other) {
if (identical(this, other)) return true;
return other.features == features &&
other.config == config &&
other.disk == disk &&
other.version == version;
}
@override
int get hashCode =>
features.hashCode ^ config.hashCode ^ disk.hashCode ^ version.hashCode;
}
@@ -0,0 +1,38 @@
class ServerVersion {
final int major;
final int minor;
final int patch;
const ServerVersion({
required this.major,
required this.minor,
required this.patch,
});
ServerVersion copyWith({int? major, int? minor, int? patch}) {
return ServerVersion(
major: major ?? this.major,
minor: minor ?? this.minor,
patch: patch ?? this.patch,
);
}
const ServerVersion.initial()
: major = 1,
minor = 1,
patch = 1;
@override
String toString() =>
'ServerVersion(major: $major, minor: $minor, patch: $patch)';
@override
bool operator ==(covariant ServerVersion other) {
if (identical(this, other)) return true;
return other.major == major && other.minor == minor && other.patch == patch;
}
@override
int get hashCode => major.hashCode ^ minor.hashCode ^ patch.hashCode;
}