add adaptive_scaffold
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
class ServerConfig {
|
||||
final String? oauthButtonText;
|
||||
|
||||
const ServerConfig({this.oauthButtonText});
|
||||
|
||||
ServerConfig copyWith({String? oauthButtonText}) {
|
||||
return ServerConfig(
|
||||
oauthButtonText: oauthButtonText ?? this.oauthButtonText,
|
||||
);
|
||||
}
|
||||
|
||||
factory ServerConfig.fromDto(ServerConfigDto dto) => ServerConfig(
|
||||
oauthButtonText:
|
||||
dto.oauthButtonText.isEmpty ? null : dto.oauthButtonText,
|
||||
);
|
||||
|
||||
const ServerConfig.reset() : oauthButtonText = null;
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'ServerConfig(oauthButtonText: ${oauthButtonText ?? '<NULL>'})';
|
||||
|
||||
@override
|
||||
bool operator ==(covariant ServerConfig other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.oauthButtonText == oauthButtonText;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => oauthButtonText.hashCode;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
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.reset()
|
||||
: features = const ServerFeatures.reset(),
|
||||
config = const ServerConfig.reset();
|
||||
|
||||
@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,42 @@
|
||||
import 'package:openapi/openapi.dart';
|
||||
|
||||
class ServerFeatures {
|
||||
final bool hasPasswordLogin;
|
||||
final bool hasOAuthLogin;
|
||||
|
||||
const ServerFeatures({
|
||||
required this.hasPasswordLogin,
|
||||
required this.hasOAuthLogin,
|
||||
});
|
||||
|
||||
ServerFeatures copyWith({bool? hasPasswordLogin, bool? hasOAuthLogin}) {
|
||||
return ServerFeatures(
|
||||
hasPasswordLogin: hasPasswordLogin ?? this.hasPasswordLogin,
|
||||
hasOAuthLogin: hasOAuthLogin ?? this.hasOAuthLogin,
|
||||
);
|
||||
}
|
||||
|
||||
factory ServerFeatures.fromDto(ServerFeaturesDto dto) => ServerFeatures(
|
||||
hasPasswordLogin: dto.passwordLogin,
|
||||
hasOAuthLogin: dto.oauth,
|
||||
);
|
||||
|
||||
const ServerFeatures.reset()
|
||||
: hasPasswordLogin = true,
|
||||
hasOAuthLogin = false;
|
||||
|
||||
@override
|
||||
String toString() =>
|
||||
'ServerFeatures(hasPasswordLogin: $hasPasswordLogin, hasOAuthLogin: $hasOAuthLogin)';
|
||||
|
||||
@override
|
||||
bool operator ==(covariant ServerFeatures other) {
|
||||
if (identical(this, other)) return true;
|
||||
|
||||
return other.hasPasswordLogin == hasPasswordLogin &&
|
||||
other.hasOAuthLogin == hasOAuthLogin;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => hasPasswordLogin.hashCode ^ hasOAuthLogin.hashCode;
|
||||
}
|
||||
Reference in New Issue
Block a user