mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-29 12:16:55 +00:00
Linting
This commit is contained in:
parent
edce25ec55
commit
14acfdec6b
|
@ -22,7 +22,7 @@ linter:
|
|||
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
|
||||
# producing the lint.
|
||||
rules:
|
||||
# avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
avoid_print: false # Uncomment to disable the `avoid_print` rule
|
||||
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
|
||||
|
||||
# Additional information about this file can be found at
|
||||
|
|
|
@ -8,7 +8,7 @@ class SimpleBlocObserver extends BlocObserver {
|
|||
SimpleBlocObserver();
|
||||
|
||||
@override
|
||||
void onError(BlocBase cubit, Object error, StackTrace stackTrace) {
|
||||
void onError(BlocBase bloc, Object error, StackTrace stackTrace) {
|
||||
final navigator = getIt.get<NavigationService>().navigator!;
|
||||
|
||||
navigator.push(
|
||||
|
@ -19,6 +19,6 @@ class SimpleBlocObserver extends BlocObserver {
|
|||
),
|
||||
),
|
||||
);
|
||||
super.onError(cubit, error, stackTrace);
|
||||
super.onError(bloc, error, stackTrace);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class BrandColors {
|
|||
static const Color gray3 = Color(0xFFFAFAFA);
|
||||
static const Color gray4 = Color(0xFFDDDDDD);
|
||||
static const Color gray5 = Color(0xFFEDEEF1);
|
||||
static Color gray6 = Color(0xFF181818).withOpacity(0.7);
|
||||
static Color gray6 = const Color(0xFF181818).withOpacity(0.7);
|
||||
static const Color grey7 = Color(0xFFABABAB);
|
||||
|
||||
static const Color red1 = Color(0xFFFA0E0E);
|
||||
|
|
|
@ -9,7 +9,7 @@ final lightTheme = ThemeData(
|
|||
fontFamily: 'Inter',
|
||||
brightness: Brightness.light,
|
||||
scaffoldBackgroundColor: BrandColors.scaffoldBackground,
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
border: InputBorder.none,
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
|
@ -39,7 +39,7 @@ final lightTheme = ThemeData(
|
|||
color: BrandColors.red1,
|
||||
),
|
||||
),
|
||||
listTileTheme: ListTileThemeData(
|
||||
listTileTheme: const ListTileThemeData(
|
||||
minLeadingWidth: 24.0,
|
||||
),
|
||||
textTheme: TextTheme(
|
||||
|
@ -48,25 +48,25 @@ final lightTheme = ThemeData(
|
|||
headline3: headline3Style,
|
||||
headline4: headline4Style,
|
||||
bodyText1: body1Style,
|
||||
subtitle1: TextStyle(fontSize: 15, height: 1.6), // text input style
|
||||
subtitle1: const TextStyle(fontSize: 15, height: 1.6), // text input style
|
||||
),
|
||||
);
|
||||
|
||||
var darkTheme = lightTheme.copyWith(
|
||||
brightness: Brightness.dark,
|
||||
scaffoldBackgroundColor: Color(0xFF202120),
|
||||
iconTheme: IconThemeData(color: BrandColors.gray3),
|
||||
scaffoldBackgroundColor: const Color(0xFF202120),
|
||||
iconTheme: const IconThemeData(color: BrandColors.gray3),
|
||||
cardColor: BrandColors.gray1,
|
||||
dialogBackgroundColor: Color(0xFF202120),
|
||||
dialogBackgroundColor: const Color(0xFF202120),
|
||||
textTheme: TextTheme(
|
||||
headline1: headline1Style.copyWith(color: BrandColors.white),
|
||||
headline2: headline2Style.copyWith(color: BrandColors.white),
|
||||
headline3: headline3Style.copyWith(color: BrandColors.white),
|
||||
headline4: headline4Style.copyWith(color: BrandColors.white),
|
||||
bodyText1: body1Style.copyWith(color: BrandColors.white),
|
||||
subtitle1: TextStyle(fontSize: 15, height: 1.6), // text input style
|
||||
subtitle1: const TextStyle(fontSize: 15, height: 1.6), // text input style
|
||||
),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
inputDecorationTheme: const InputDecorationTheme(
|
||||
labelStyle: TextStyle(color: BrandColors.white),
|
||||
hintStyle: TextStyle(color: BrandColors.white),
|
||||
border: OutlineInputBorder(
|
||||
|
@ -82,6 +82,6 @@ var darkTheme = lightTheme.copyWith(
|
|||
),
|
||||
);
|
||||
|
||||
final paddingH15V30 = EdgeInsets.symmetric(horizontal: 15, vertical: 30);
|
||||
const paddingH15V30 = EdgeInsets.symmetric(horizontal: 15, vertical: 30);
|
||||
|
||||
final paddingH15V0 = EdgeInsets.symmetric(horizontal: 15);
|
||||
const paddingH15V0 = EdgeInsets.symmetric(horizontal: 15);
|
||||
|
|
|
@ -41,7 +41,7 @@ class HiveConfig {
|
|||
}
|
||||
|
||||
static Future<Uint8List> getEncryptedKey(String encKey) async {
|
||||
final secureStorage = FlutterSecureStorage();
|
||||
const secureStorage = FlutterSecureStorage();
|
||||
var hasEncryptionKey = await secureStorage.containsKey(key: encKey);
|
||||
if (!hasEncryptionKey) {
|
||||
var key = Hive.generateSecureKey();
|
||||
|
|
|
@ -11,9 +11,9 @@ class Localization extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return EasyLocalization(
|
||||
supportedLocales: [Locale('ru'), Locale('en')],
|
||||
supportedLocales: const [Locale('ru'), Locale('en')],
|
||||
path: 'assets/translations',
|
||||
fallbackLocale: Locale('en'),
|
||||
fallbackLocale: const Locale('en'),
|
||||
saveLocale: false,
|
||||
useOnlyLangCode: true,
|
||||
child: child!,
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:selfprivacy/utils/named_font_weight.dart';
|
|||
|
||||
import 'brand_colors.dart';
|
||||
|
||||
final defaultTextStyle = TextStyle(
|
||||
const defaultTextStyle = TextStyle(
|
||||
fontSize: 15,
|
||||
color: BrandColors.textColor1,
|
||||
);
|
||||
|
@ -51,7 +51,7 @@ final headline5Style = defaultTextStyle.copyWith(
|
|||
color: BrandColors.headlineColor.withOpacity(0.8),
|
||||
);
|
||||
|
||||
final body1Style = defaultTextStyle;
|
||||
const body1Style = defaultTextStyle;
|
||||
final body2Style = defaultTextStyle.copyWith(
|
||||
color: BrandColors.textColor2,
|
||||
);
|
||||
|
@ -69,7 +69,7 @@ final smallStyle = defaultTextStyle.copyWith(fontSize: 11, height: 1.45);
|
|||
|
||||
final linkStyle = defaultTextStyle.copyWith(color: BrandColors.blue);
|
||||
|
||||
final progressTextStyleLight = TextStyle(
|
||||
const progressTextStyleLight = TextStyle(
|
||||
fontSize: 11,
|
||||
color: BrandColors.textColor1,
|
||||
height: 1.7,
|
||||
|
|
|
@ -56,7 +56,7 @@ class ConsoleInterceptor extends InterceptorsWrapper {
|
|||
@override
|
||||
Future onRequest(
|
||||
RequestOptions options,
|
||||
RequestInterceptorHandler requestInterceptorHandler,
|
||||
RequestInterceptorHandler handler,
|
||||
) async {
|
||||
addMessage(
|
||||
Message(
|
||||
|
@ -64,13 +64,13 @@ class ConsoleInterceptor extends InterceptorsWrapper {
|
|||
'request-uri: ${options.uri}\nheaders: ${options.headers}\ndata: ${options.data}',
|
||||
),
|
||||
);
|
||||
return super.onRequest(options, requestInterceptorHandler);
|
||||
return super.onRequest(options, handler);
|
||||
}
|
||||
|
||||
@override
|
||||
Future onResponse(
|
||||
Response response,
|
||||
ResponseInterceptorHandler requestInterceptorHandler,
|
||||
ResponseInterceptorHandler handler,
|
||||
) async {
|
||||
addMessage(
|
||||
Message(
|
||||
|
@ -80,7 +80,7 @@ class ConsoleInterceptor extends InterceptorsWrapper {
|
|||
);
|
||||
return super.onResponse(
|
||||
response,
|
||||
requestInterceptorHandler,
|
||||
handler,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class BackblazeApplicationKey {
|
|||
class BackblazeApi extends ApiMap {
|
||||
BackblazeApi({this.hasLogger = false, this.isWithToken = true});
|
||||
|
||||
@override
|
||||
BaseOptions get options {
|
||||
var options = BaseOptions(baseUrl: rootAddress);
|
||||
if (isWithToken) {
|
||||
|
@ -97,9 +98,9 @@ class BackblazeApi extends ApiMap {
|
|||
'bucketType': 'allPrivate',
|
||||
'lifecycleRules': [
|
||||
{
|
||||
"daysFromHidingToDeleting": 30,
|
||||
"daysFromUploadingToHiding": null,
|
||||
"fileNamePrefix": ""
|
||||
'daysFromHidingToDeleting': 30,
|
||||
'daysFromUploadingToHiding': null,
|
||||
'fileNamePrefix': ''
|
||||
}
|
||||
],
|
||||
},
|
||||
|
|
|
@ -25,6 +25,7 @@ class CloudflareApi extends ApiMap {
|
|||
this.customToken,
|
||||
});
|
||||
|
||||
@override
|
||||
BaseOptions get options {
|
||||
var options = BaseOptions(baseUrl: rootAddress);
|
||||
if (isWithToken) {
|
||||
|
@ -164,7 +165,7 @@ class CloudflareApi extends ApiMap {
|
|||
await Future.wait(allCreateFutures);
|
||||
} on DioError catch (e) {
|
||||
print(e.message);
|
||||
throw e;
|
||||
rethrow;
|
||||
} finally {
|
||||
close(client);
|
||||
}
|
||||
|
|
|
@ -10,11 +10,14 @@ import 'package:selfprivacy/logic/models/hive/user.dart';
|
|||
import 'package:selfprivacy/utils/password_generator.dart';
|
||||
|
||||
class HetznerApi extends ApiMap {
|
||||
@override
|
||||
bool hasLogger;
|
||||
@override
|
||||
bool isWithToken;
|
||||
|
||||
HetznerApi({this.hasLogger = false, this.isWithToken = true});
|
||||
|
||||
@override
|
||||
BaseOptions get options {
|
||||
var options = BaseOptions(baseUrl: rootAddress);
|
||||
if (isWithToken) {
|
||||
|
@ -60,12 +63,12 @@ class HetznerApi extends ApiMap {
|
|||
Response dbCreateResponse = await client.post(
|
||||
'/volumes',
|
||||
data: {
|
||||
"size": 10,
|
||||
"name": StringGenerators.dbStorageName(),
|
||||
"labels": {"labelkey": "value"},
|
||||
"location": "fsn1",
|
||||
"automount": false,
|
||||
"format": "ext4"
|
||||
'size': 10,
|
||||
'name': StringGenerators.dbStorageName(),
|
||||
'labels': {'labelkey': 'value'},
|
||||
'location': 'fsn1',
|
||||
'automount': false,
|
||||
'format': 'ext4'
|
||||
},
|
||||
);
|
||||
var dbId = dbCreateResponse.data['volume']['id'];
|
||||
|
@ -93,7 +96,7 @@ class HetznerApi extends ApiMap {
|
|||
final base64Password =
|
||||
base64.encode(utf8.encode(rootUser.password ?? 'PASS'));
|
||||
|
||||
print("hostname: $hostname");
|
||||
print('hostname: $hostname');
|
||||
|
||||
/// add ssh key when you need it: e.g. "ssh_keys":["kherel"]
|
||||
/// check the branch name, it could be "development" or "master".
|
||||
|
@ -103,18 +106,18 @@ class HetznerApi extends ApiMap {
|
|||
print(userdataString);
|
||||
|
||||
final data = {
|
||||
"name": hostname,
|
||||
"server_type": "cx11",
|
||||
"start_after_create": false,
|
||||
"image": "ubuntu-20.04",
|
||||
"volumes": [dbId],
|
||||
"networks": [],
|
||||
"user_data": userdataString,
|
||||
"labels": {},
|
||||
"automount": true,
|
||||
"location": "fsn1"
|
||||
'name': hostname,
|
||||
'server_type': 'cx11',
|
||||
'start_after_create': false,
|
||||
'image': 'ubuntu-20.04',
|
||||
'volumes': [dbId],
|
||||
'networks': [],
|
||||
'user_data': userdataString,
|
||||
'labels': {},
|
||||
'automount': true,
|
||||
'location': 'fsn1'
|
||||
};
|
||||
print("Decoded data: $data");
|
||||
print('Decoded data: $data');
|
||||
|
||||
Response serverCreateResponse = await client.post(
|
||||
'/servers',
|
||||
|
@ -129,7 +132,7 @@ class HetznerApi extends ApiMap {
|
|||
createTime: DateTime.now(),
|
||||
volume: dataBase,
|
||||
apiToken: apiToken,
|
||||
provider: ServerProvider.Hetzner,
|
||||
provider: ServerProvider.hetzner,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -166,7 +169,7 @@ class HetznerApi extends ApiMap {
|
|||
for (var volumeId in volumes) {
|
||||
await client.post('/volumes/$volumeId/actions/detach');
|
||||
}
|
||||
await Future.delayed(Duration(seconds: 10));
|
||||
await Future.delayed(const Duration(seconds: 10));
|
||||
|
||||
for (var volumeId in volumes) {
|
||||
laterFutures.add(client.delete('/volumes/$volumeId'));
|
||||
|
@ -203,9 +206,9 @@ class HetznerApi extends ApiMap {
|
|||
var client = await getClient();
|
||||
|
||||
Map<String, dynamic> queryParameters = {
|
||||
"start": start.toUtc().toIso8601String(),
|
||||
"end": end.toUtc().toIso8601String(),
|
||||
"type": type
|
||||
'start': start.toUtc().toIso8601String(),
|
||||
'end': end.toUtc().toIso8601String(),
|
||||
'type': type
|
||||
};
|
||||
var res = await client.get(
|
||||
'/servers/${hetznerServer!.id}/metrics',
|
||||
|
@ -243,8 +246,8 @@ class HetznerApi extends ApiMap {
|
|||
await client.post(
|
||||
'/servers/${hetznerServer!.id}/actions/change_dns_ptr',
|
||||
data: {
|
||||
"ip": ip4,
|
||||
"dns_ptr": domainName,
|
||||
'ip': ip4,
|
||||
'dns_ptr': domainName,
|
||||
},
|
||||
);
|
||||
close(client);
|
||||
|
|
|
@ -44,6 +44,7 @@ class ServerApi extends ApiMap {
|
|||
this.overrideDomain,
|
||||
this.customToken});
|
||||
|
||||
@override
|
||||
BaseOptions get options {
|
||||
var options = BaseOptions();
|
||||
|
||||
|
@ -73,7 +74,7 @@ class ServerApi extends ApiMap {
|
|||
Response response;
|
||||
|
||||
var client = await getClient();
|
||||
String? apiVersion = null;
|
||||
String? apiVersion;
|
||||
|
||||
try {
|
||||
response = await client.get('/api/version');
|
||||
|
@ -82,8 +83,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return apiVersion;
|
||||
}
|
||||
return apiVersion;
|
||||
}
|
||||
|
||||
Future<bool> isHttpServerWorking() async {
|
||||
|
@ -98,8 +99,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<ApiResponse<User>> createUser(User user) async {
|
||||
|
@ -227,7 +228,7 @@ class ServerApi extends ApiMap {
|
|||
try {
|
||||
response = await client.put(
|
||||
'/services/ssh/key/send',
|
||||
data: {"public_key": ssh},
|
||||
data: {'public_key': ssh},
|
||||
);
|
||||
} on DioError catch (e) {
|
||||
print(e.message);
|
||||
|
@ -293,7 +294,7 @@ class ServerApi extends ApiMap {
|
|||
try {
|
||||
response = await client.delete(
|
||||
'/services/ssh/keys/${user.login}',
|
||||
data: {"public_key": sshKey},
|
||||
data: {'public_key': sshKey},
|
||||
);
|
||||
} on DioError catch (e) {
|
||||
print(e.message);
|
||||
|
@ -331,10 +332,11 @@ class ServerApi extends ApiMap {
|
|||
res = false;
|
||||
} finally {
|
||||
close(client);
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@override
|
||||
String get rootAddress =>
|
||||
throw UnimplementedError('not used in with implementation');
|
||||
|
||||
|
@ -351,8 +353,8 @@ class ServerApi extends ApiMap {
|
|||
res = false;
|
||||
} finally {
|
||||
close(client);
|
||||
return res;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<void> switchService(ServiceTypes type, bool needToTurnOn) async {
|
||||
|
@ -433,8 +435,8 @@ class ServerApi extends ApiMap {
|
|||
print(e);
|
||||
} finally {
|
||||
close(client);
|
||||
return backups;
|
||||
}
|
||||
return backups;
|
||||
}
|
||||
|
||||
Future<BackupStatus> getBackupStatus() async {
|
||||
|
@ -453,8 +455,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return status;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
Future<void> forceBackupListReload() async {
|
||||
|
@ -496,8 +498,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<bool> reboot() async {
|
||||
|
@ -514,8 +516,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<bool> upgrade() async {
|
||||
|
@ -532,13 +534,13 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<AutoUpgradeSettings> getAutoUpgradeSettings() async {
|
||||
Response response;
|
||||
AutoUpgradeSettings settings = AutoUpgradeSettings(
|
||||
AutoUpgradeSettings settings = const AutoUpgradeSettings(
|
||||
enable: false,
|
||||
allowReboot: false,
|
||||
);
|
||||
|
@ -553,8 +555,8 @@ class ServerApi extends ApiMap {
|
|||
print(e.message);
|
||||
} finally {
|
||||
close(client);
|
||||
return settings;
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
||||
Future<void> updateAutoUpgradeSettings(AutoUpgradeSettings settings) async {
|
||||
|
@ -616,7 +618,7 @@ class ServerApi extends ApiMap {
|
|||
}
|
||||
|
||||
if (response.statusCode != HttpStatus.ok) {
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
|
||||
final base64toString = utf8.fuse(base64);
|
||||
|
@ -639,7 +641,7 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: RecoveryKeyStatus(exists: false, valid: false));
|
||||
data: const RecoveryKeyStatus(exists: false, valid: false));
|
||||
} finally {
|
||||
close(client);
|
||||
}
|
||||
|
@ -677,7 +679,7 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
close(client);
|
||||
}
|
||||
|
@ -686,7 +688,7 @@ class ServerApi extends ApiMap {
|
|||
|
||||
return ApiResponse(
|
||||
statusCode: code,
|
||||
data: response.data != null ? response.data["token"] : '');
|
||||
data: response.data != null ? response.data['token'] : '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<String>> useRecoveryToken(DeviceToken token) async {
|
||||
|
@ -706,7 +708,7 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
@ -715,7 +717,7 @@ class ServerApi extends ApiMap {
|
|||
|
||||
return ApiResponse(
|
||||
statusCode: code,
|
||||
data: response.data != null ? response.data["token"] : '');
|
||||
data: response.data != null ? response.data['token'] : '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<String>> authorizeDevice(DeviceToken token) async {
|
||||
|
@ -735,16 +737,14 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
||||
final int code = response.statusCode ?? HttpStatus.internalServerError;
|
||||
|
||||
return ApiResponse(
|
||||
statusCode: code,
|
||||
data: response.data["token"] != null ? response.data["token"] : '');
|
||||
return ApiResponse(statusCode: code, data: response.data['token'] ?? '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<String>> createDeviceToken() async {
|
||||
|
@ -758,7 +758,7 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
@ -767,7 +767,7 @@ class ServerApi extends ApiMap {
|
|||
|
||||
return ApiResponse(
|
||||
statusCode: code,
|
||||
data: response.data != null ? response.data["token"] : '');
|
||||
data: response.data != null ? response.data['token'] : '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<String>> deleteDeviceToken() async {
|
||||
|
@ -781,15 +781,14 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
||||
final int code = response.statusCode ?? HttpStatus.internalServerError;
|
||||
|
||||
return ApiResponse(
|
||||
statusCode: code, data: response.data != null ? response.data : '');
|
||||
return ApiResponse(statusCode: code, data: response.data ?? '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<List<ApiToken>>> getApiTokens() async {
|
||||
|
@ -828,7 +827,7 @@ class ServerApi extends ApiMap {
|
|||
return ApiResponse(
|
||||
errorMessage: e.message,
|
||||
statusCode: e.response?.statusCode ?? HttpStatus.internalServerError,
|
||||
data: "");
|
||||
data: '');
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
|
@ -837,7 +836,7 @@ class ServerApi extends ApiMap {
|
|||
|
||||
return ApiResponse(
|
||||
statusCode: code,
|
||||
data: response.data != null ? response.data["token"] : '');
|
||||
data: response.data != null ? response.data['token'] : '');
|
||||
}
|
||||
|
||||
Future<ApiResponse<void>> deleteApiToken(String device) async {
|
||||
|
|
|
@ -131,5 +131,5 @@ extension ServiceTypesExt on ServiceTypes {
|
|||
}
|
||||
}
|
||||
|
||||
String get txt => this.toString().split('.')[1];
|
||||
String get txt => toString().split('.')[1];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'dart:async';
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:selfprivacy/config/hive_config.dart';
|
||||
|
|
|
@ -5,7 +5,6 @@ import 'package:selfprivacy/config/get_it_config.dart';
|
|||
import 'package:selfprivacy/logic/api_maps/backblaze.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/server.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart';
|
||||
import 'package:selfprivacy/logic/models/json/backup.dart';
|
||||
|
||||
|
@ -13,16 +12,18 @@ part 'backups_state.dart';
|
|||
|
||||
class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
||||
BackupsCubit(ServerInstallationCubit serverInstallationCubit)
|
||||
: super(serverInstallationCubit, BackupsState(preventActions: true));
|
||||
: super(
|
||||
serverInstallationCubit, const BackupsState(preventActions: true));
|
||||
|
||||
final api = ServerApi();
|
||||
final backblaze = BackblazeApi();
|
||||
|
||||
@override
|
||||
Future<void> load() async {
|
||||
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
||||
final bucket = getIt<ApiConfigModel>().backblazeBucket;
|
||||
if (bucket == null) {
|
||||
emit(BackupsState(
|
||||
emit(const BackupsState(
|
||||
isInitialized: false, preventActions: false, refreshing: false));
|
||||
} else {
|
||||
final status = await api.getBackupStatus();
|
||||
|
@ -30,7 +31,7 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
case BackupStatusEnum.noKey:
|
||||
case BackupStatusEnum.notInitialized:
|
||||
emit(BackupsState(
|
||||
backups: [],
|
||||
backups: const [],
|
||||
isInitialized: true,
|
||||
preventActions: false,
|
||||
progress: 0,
|
||||
|
@ -40,12 +41,12 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
break;
|
||||
case BackupStatusEnum.initializing:
|
||||
emit(BackupsState(
|
||||
backups: [],
|
||||
backups: const [],
|
||||
isInitialized: true,
|
||||
preventActions: false,
|
||||
progress: 0,
|
||||
status: status.status,
|
||||
refreshTimer: Duration(seconds: 10),
|
||||
refreshTimer: const Duration(seconds: 10),
|
||||
refreshing: false,
|
||||
));
|
||||
break;
|
||||
|
@ -72,12 +73,12 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
progress: status.progress,
|
||||
status: status.status,
|
||||
error: status.errorMessage ?? '',
|
||||
refreshTimer: Duration(seconds: 5),
|
||||
refreshTimer: const Duration(seconds: 5),
|
||||
refreshing: false,
|
||||
));
|
||||
break;
|
||||
default:
|
||||
emit(BackupsState());
|
||||
emit(const BackupsState());
|
||||
}
|
||||
Timer(state.refreshTimer, () => updateBackups(useTimer: true));
|
||||
}
|
||||
|
@ -126,11 +127,11 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
switch (status) {
|
||||
case BackupStatusEnum.backingUp:
|
||||
case BackupStatusEnum.restoring:
|
||||
return Duration(seconds: 5);
|
||||
return const Duration(seconds: 5);
|
||||
case BackupStatusEnum.initializing:
|
||||
return Duration(seconds: 10);
|
||||
return const Duration(seconds: 10);
|
||||
default:
|
||||
return Duration(seconds: 60);
|
||||
return const Duration(seconds: 60);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,8 +147,9 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
refreshTimer: refreshTimeFromState(status.status),
|
||||
refreshing: false,
|
||||
));
|
||||
if (useTimer)
|
||||
if (useTimer) {
|
||||
Timer(state.refreshTimer, () => updateBackups(useTimer: true));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> forceUpdateBackups() async {
|
||||
|
@ -173,6 +175,6 @@ class BackupsCubit extends ServerInstallationDependendCubit<BackupsState> {
|
|||
|
||||
@override
|
||||
void clear() async {
|
||||
emit(BackupsState());
|
||||
emit(const BackupsState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class BackupsState extends ServerInstallationDependendState {
|
|||
this.progress = 0.0,
|
||||
this.status = BackupStatusEnum.noKey,
|
||||
this.preventActions = true,
|
||||
this.error = "",
|
||||
this.error = '',
|
||||
this.refreshTimer = const Duration(seconds: 60),
|
||||
this.refreshing = true,
|
||||
});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:cubit_form/cubit_form.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
||||
import 'package:selfprivacy/logic/models/json/dns_records.dart';
|
||||
|
||||
|
@ -13,16 +12,17 @@ class DnsRecordsCubit
|
|||
extends ServerInstallationDependendCubit<DnsRecordsState> {
|
||||
DnsRecordsCubit(ServerInstallationCubit serverInstallationCubit)
|
||||
: super(serverInstallationCubit,
|
||||
DnsRecordsState(dnsState: DnsRecordsStatus.refreshing));
|
||||
const DnsRecordsState(dnsState: DnsRecordsStatus.refreshing));
|
||||
|
||||
final api = ServerApi();
|
||||
final cloudflare = CloudflareApi();
|
||||
|
||||
@override
|
||||
Future<void> load() async {
|
||||
emit(DnsRecordsState(
|
||||
dnsState: DnsRecordsStatus.refreshing,
|
||||
dnsRecords: _getDesiredDnsRecords(
|
||||
serverInstallationCubit.state.serverDomain?.domainName, "", "")));
|
||||
serverInstallationCubit.state.serverDomain?.domainName, '', '')));
|
||||
print('Loading DNS status');
|
||||
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
||||
final ServerDomain? domain = serverInstallationCubit.state.serverDomain;
|
||||
|
@ -75,7 +75,7 @@ class DnsRecordsCubit
|
|||
: DnsRecordsStatus.good,
|
||||
));
|
||||
} else {
|
||||
emit(DnsRecordsState());
|
||||
emit(const DnsRecordsState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class DnsRecordsCubit
|
|||
|
||||
@override
|
||||
Future<void> clear() async {
|
||||
emit(DnsRecordsState(dnsState: DnsRecordsStatus.error));
|
||||
emit(const DnsRecordsState(dnsState: DnsRecordsStatus.error));
|
||||
}
|
||||
|
||||
Future<void> refresh() async {
|
||||
|
@ -104,7 +104,7 @@ class DnsRecordsCubit
|
|||
await cloudflare.removeSimilarRecords(cloudFlareDomain: domain!);
|
||||
await cloudflare.createMultipleDnsRecords(
|
||||
cloudFlareDomain: domain, ip4: ipAddress);
|
||||
await cloudflare.setDkim(dkimPublicKey ?? "", domain);
|
||||
await cloudflare.setDkim(dkimPublicKey ?? '', domain);
|
||||
await load();
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class DnsRecordsState extends ServerInstallationDependendState {
|
|||
class DesiredDnsRecord {
|
||||
const DesiredDnsRecord({
|
||||
required this.name,
|
||||
this.type = "A",
|
||||
this.type = 'A',
|
||||
required this.content,
|
||||
this.description = '',
|
||||
this.category = DnsRecordsCategory.services,
|
||||
|
|
|
@ -16,7 +16,7 @@ class FieldCubitFactory {
|
|||
/// - Must not be a reserved root login
|
||||
/// - Must be unique
|
||||
FieldCubit<String> createUserLoginField() {
|
||||
final userAllowedRegExp = RegExp(r"^[a-z_][a-z0-9_]+$");
|
||||
final userAllowedRegExp = RegExp(r'^[a-z_][a-z0-9_]+$');
|
||||
const userMaxLength = 31;
|
||||
return FieldCubit(
|
||||
initalValue: '',
|
||||
|
@ -40,7 +40,7 @@ class FieldCubitFactory {
|
|||
/// - Must fail on the regural expression of invalid matches: [\n\r\s]+
|
||||
/// - Must not be empty
|
||||
FieldCubit<String> createUserPasswordField() {
|
||||
var passwordForbiddenRegExp = RegExp(r"[\n\r\s]+");
|
||||
var passwordForbiddenRegExp = RegExp(r'[\n\r\s]+');
|
||||
return FieldCubit(
|
||||
initalValue: '',
|
||||
validations: [
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart';
|
|||
|
||||
class CloudFlareFormCubit extends FormCubit {
|
||||
CloudFlareFormCubit(this.initializingCubit) {
|
||||
var regExp = RegExp(r"\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]");
|
||||
var regExp = RegExp(r'\s+|[!$%^&*()@+|~=`{}\[\]:<>?,.\/]');
|
||||
apiKey = FieldCubit(
|
||||
initalValue: '',
|
||||
validations: [
|
||||
|
@ -48,9 +48,4 @@ class CloudFlareFormCubit extends FormCubit {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
return super.close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class DomainSetupCubit extends Cubit<DomainSetupState> {
|
|||
var domain = ServerDomain(
|
||||
domainName: domainName,
|
||||
zoneId: zoneId,
|
||||
provider: DnsProvider.Cloudflare,
|
||||
provider: DnsProvider.cloudflare,
|
||||
);
|
||||
|
||||
serverInstallationCubit.setDomain(domain);
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:selfprivacy/logic/cubit/forms/validations/validations.dart';
|
|||
|
||||
class HetznerFormCubit extends FormCubit {
|
||||
HetznerFormCubit(this.serverInstallationCubit) {
|
||||
var regExp = RegExp(r"\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]");
|
||||
var regExp = RegExp(r'\s+|[-!$%^&*()@+|~=`{}\[\]:<>?,.\/]');
|
||||
apiKey = FieldCubit(
|
||||
initalValue: '',
|
||||
validations: [
|
||||
|
|
|
@ -34,7 +34,7 @@ class RecoveryDomainFormCubit extends FormCubit {
|
|||
|
||||
final bool domainValid = await api.getApiVersion() != null;
|
||||
if (!domainValid) {
|
||||
serverDomainField.setError("recovering.domain_recover_error".tr());
|
||||
serverDomainField.setError('recovering.domain_recover_error'.tr());
|
||||
}
|
||||
|
||||
return domainValid;
|
||||
|
|
|
@ -12,7 +12,7 @@ class SshFormCubit extends FormCubit {
|
|||
required this.user,
|
||||
}) {
|
||||
var keyRegExp = RegExp(
|
||||
r"^(ssh-rsa AAAAB3NzaC1yc2|ssh-ed25519 AAAAC3NzaC1lZDI1NTE5)[0-9A-Za-z+/]+[=]{0,3}( .*)?$");
|
||||
r'^(ssh-rsa AAAAB3NzaC1yc2|ssh-ed25519 AAAAC3NzaC1lZDI1NTE5)[0-9A-Za-z+/]+[=]{0,3}( .*)?$');
|
||||
|
||||
key = FieldCubit(
|
||||
initalValue: '',
|
||||
|
|
|
@ -8,7 +8,7 @@ abstract class LengthStringValidation extends ValidationModel<String> {
|
|||
@override
|
||||
String? check(String value) {
|
||||
var length = value.length;
|
||||
var errorMessage = this.errorMassage.replaceAll("[]", length.toString());
|
||||
var errorMessage = errorMassage.replaceAll('[]', length.toString());
|
||||
return test(value) ? errorMessage : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
||||
import 'package:selfprivacy/logic/models/hetzner_metrics.dart';
|
||||
|
@ -10,12 +10,13 @@ import 'hetzner_metrics_repository.dart';
|
|||
part 'hetzner_metrics_state.dart';
|
||||
|
||||
class HetznerMetricsCubit extends Cubit<HetznerMetricsState> {
|
||||
HetznerMetricsCubit() : super(HetznerMetricsLoading(Period.day));
|
||||
HetznerMetricsCubit() : super(const HetznerMetricsLoading(Period.day));
|
||||
|
||||
final repository = HetznerMetricsRepository();
|
||||
|
||||
Timer? timer;
|
||||
|
||||
@override
|
||||
close() {
|
||||
closeTimer();
|
||||
return super.close();
|
||||
|
|
|
@ -11,13 +11,13 @@ class HetznerMetricsRepository {
|
|||
|
||||
switch (period) {
|
||||
case Period.hour:
|
||||
start = end.subtract(Duration(hours: 1));
|
||||
start = end.subtract(const Duration(hours: 1));
|
||||
break;
|
||||
case Period.day:
|
||||
start = end.subtract(Duration(days: 1));
|
||||
start = end.subtract(const Duration(days: 1));
|
||||
break;
|
||||
case Period.month:
|
||||
start = end.subtract(Duration(days: 15));
|
||||
start = end.subtract(const Duration(days: 15));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -28,14 +28,14 @@ class HetznerMetricsRepository {
|
|||
api.getMetrics(start, end, 'network'),
|
||||
]);
|
||||
|
||||
var cpuMetricsData = results[0]["metrics"];
|
||||
var networkMetricsData = results[1]["metrics"];
|
||||
var cpuMetricsData = results[0]['metrics'];
|
||||
var networkMetricsData = results[1]['metrics'];
|
||||
|
||||
return HetznerMetricsLoaded(
|
||||
period: period,
|
||||
start: start,
|
||||
end: end,
|
||||
stepInSeconds: cpuMetricsData["step"],
|
||||
stepInSeconds: cpuMetricsData['step'],
|
||||
cpu: timeSeriesSerializer(cpuMetricsData, 'cpu'),
|
||||
ppsIn: timeSeriesSerializer(networkMetricsData, 'network.0.pps.in'),
|
||||
ppsOut: timeSeriesSerializer(networkMetricsData, 'network.0.pps.out'),
|
||||
|
@ -51,6 +51,6 @@ class HetznerMetricsRepository {
|
|||
|
||||
List<TimeSeriesData> timeSeriesSerializer(
|
||||
Map<String, dynamic> json, String type) {
|
||||
List list = json["time_series"][type]["values"];
|
||||
List list = json['time_series'][type]['values'];
|
||||
return list.map((el) => TimeSeriesData(el[0], double.parse(el[1]))).toList();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,8 @@ abstract class HetznerMetricsState extends Equatable {
|
|||
}
|
||||
|
||||
class HetznerMetricsLoading extends HetznerMetricsState {
|
||||
HetznerMetricsLoading(this.period);
|
||||
const HetznerMetricsLoading(this.period);
|
||||
@override
|
||||
final Period period;
|
||||
|
||||
@override
|
||||
|
@ -15,7 +16,7 @@ class HetznerMetricsLoading extends HetznerMetricsState {
|
|||
}
|
||||
|
||||
class HetznerMetricsLoaded extends HetznerMetricsState {
|
||||
HetznerMetricsLoaded({
|
||||
const HetznerMetricsLoaded({
|
||||
required this.period,
|
||||
required this.start,
|
||||
required this.end,
|
||||
|
@ -27,6 +28,7 @@ class HetznerMetricsLoaded extends HetznerMetricsState {
|
|||
required this.bandwidthOut,
|
||||
});
|
||||
|
||||
@override
|
||||
final Period period;
|
||||
final DateTime start;
|
||||
final DateTime end;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:selfprivacy/logic/models/provider.dart';
|
||||
import 'package:selfprivacy/logic/models/state_types.dart';
|
||||
|
|
|
@ -7,7 +7,7 @@ part 'recovery_key_state.dart';
|
|||
class RecoveryKeyCubit
|
||||
extends ServerInstallationDependendCubit<RecoveryKeyState> {
|
||||
RecoveryKeyCubit(ServerInstallationCubit serverInstallationCubit)
|
||||
: super(serverInstallationCubit, RecoveryKeyState.initial());
|
||||
: super(serverInstallationCubit, const RecoveryKeyState.initial());
|
||||
|
||||
final api = ServerApi();
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ enum LoadingStatus {
|
|||
error,
|
||||
}
|
||||
|
||||
|
||||
class RecoveryKeyState extends ServerInstallationDependendState {
|
||||
const RecoveryKeyState(this._status, this.loadingStatus);
|
||||
|
||||
RecoveryKeyState.initial()
|
||||
: this(RecoveryKeyStatus(exists: false, valid: false), LoadingStatus.refreshing);
|
||||
const RecoveryKeyState.initial()
|
||||
: this(const RecoveryKeyStatus(exists: false, valid: false),
|
||||
LoadingStatus.refreshing);
|
||||
|
||||
final RecoveryKeyStatus _status;
|
||||
final LoadingStatus loadingStatus;
|
||||
|
@ -30,7 +30,7 @@ class RecoveryKeyState extends ServerInstallationDependendState {
|
|||
LoadingStatus? loadingStatus,
|
||||
}) {
|
||||
return RecoveryKeyState(
|
||||
status ?? this._status,
|
||||
status ?? _status,
|
||||
loadingStatus ?? this.loadingStatus,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_repository.dart';
|
||||
|
|
|
@ -8,9 +8,9 @@ class ServerDetailsRepository {
|
|||
var hetznerAPi = HetznerApi();
|
||||
var selfprivacyServer = ServerApi();
|
||||
|
||||
Future<_ServerDetailsRepositoryDto> load() async {
|
||||
Future<ServerDetailsRepositoryDto> load() async {
|
||||
print('load');
|
||||
return _ServerDetailsRepositoryDto(
|
||||
return ServerDetailsRepositoryDto(
|
||||
autoUpgradeSettings: await selfprivacyServer.getAutoUpgradeSettings(),
|
||||
hetznerServerInfo: await hetznerAPi.getInfo(),
|
||||
serverTimezone: await selfprivacyServer.getServerTimezone(),
|
||||
|
@ -18,14 +18,14 @@ class ServerDetailsRepository {
|
|||
}
|
||||
}
|
||||
|
||||
class _ServerDetailsRepositoryDto {
|
||||
class ServerDetailsRepositoryDto {
|
||||
final HetznerServerInfo hetznerServerInfo;
|
||||
|
||||
final TimeZoneSettings serverTimezone;
|
||||
|
||||
final AutoUpgradeSettings autoUpgradeSettings;
|
||||
|
||||
_ServerDetailsRepositoryDto({
|
||||
ServerDetailsRepositoryDto({
|
||||
required this.hetznerServerInfo,
|
||||
required this.serverTimezone,
|
||||
required this.autoUpgradeSettings,
|
||||
|
|
|
@ -23,7 +23,7 @@ class Loaded extends ServerDetailsState {
|
|||
final AutoUpgradeSettings autoUpgradeSettings;
|
||||
final DateTime checkTime;
|
||||
|
||||
Loaded({
|
||||
const Loaded({
|
||||
required this.serverInfo,
|
||||
required this.serverTimezone,
|
||||
required this.autoUpgradeSettings,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
|
@ -17,7 +17,7 @@ export 'package:provider/provider.dart';
|
|||
part '../server_installation/server_installation_state.dart';
|
||||
|
||||
class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
||||
ServerInstallationCubit() : super(ServerInstallationEmpty());
|
||||
ServerInstallationCubit() : super(const ServerInstallationEmpty());
|
||||
|
||||
final repository = ServerInstallationRepository();
|
||||
|
||||
|
@ -54,7 +54,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
if (state is ServerInstallationRecovery) {
|
||||
emit((state as ServerInstallationRecovery).copyWith(
|
||||
hetznerKey: hetznerKey,
|
||||
currentStep: RecoveryStep.ServerSelection,
|
||||
currentStep: RecoveryStep.serverSelection,
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
@ -104,12 +104,12 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
}
|
||||
|
||||
void createServerAndSetDnsRecords() async {
|
||||
ServerInstallationNotFinished _stateCopy =
|
||||
ServerInstallationNotFinished stateCopy =
|
||||
state as ServerInstallationNotFinished;
|
||||
var onCancel = () => emit(
|
||||
onCancel() => emit(
|
||||
(state as ServerInstallationNotFinished).copyWith(isLoading: false));
|
||||
|
||||
var onSuccess = (ServerHostingDetails serverDetails) async {
|
||||
onSuccess(ServerHostingDetails serverDetails) async {
|
||||
await repository.createDnsRecords(
|
||||
serverDetails.ip4,
|
||||
state.serverDomain!,
|
||||
|
@ -120,8 +120,8 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
isLoading: false,
|
||||
serverDetails: serverDetails,
|
||||
));
|
||||
runDelayed(startServerIfDnsIsOkay, Duration(seconds: 30), null);
|
||||
};
|
||||
runDelayed(startServerIfDnsIsOkay, const Duration(seconds: 30), null);
|
||||
}
|
||||
|
||||
try {
|
||||
emit((state as ServerInstallationNotFinished).copyWith(isLoading: true));
|
||||
|
@ -134,7 +134,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
onSuccess: onSuccess,
|
||||
);
|
||||
} catch (e) {
|
||||
emit(_stateCopy);
|
||||
emit(stateCopy);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,8 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
serverDetails: server,
|
||||
),
|
||||
);
|
||||
runDelayed(resetServerIfServerIsOkay, Duration(seconds: 60), dataState);
|
||||
runDelayed(
|
||||
resetServerIfServerIsOkay, const Duration(seconds: 60), dataState);
|
||||
} else {
|
||||
emit(
|
||||
dataState.copyWith(
|
||||
|
@ -171,7 +172,8 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
dnsMatches: matches,
|
||||
),
|
||||
);
|
||||
runDelayed(startServerIfDnsIsOkay, Duration(seconds: 30), dataState);
|
||||
runDelayed(
|
||||
startServerIfDnsIsOkay, const Duration(seconds: 30), dataState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +185,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
var isServerWorking = await repository.isHttpServerWorking();
|
||||
|
||||
if (isServerWorking) {
|
||||
var pauseDuration = Duration(seconds: 30);
|
||||
var pauseDuration = const Duration(seconds: 30);
|
||||
emit(TimerState(
|
||||
dataState: dataState,
|
||||
timerStart: DateTime.now(),
|
||||
|
@ -202,10 +204,11 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
isLoading: false,
|
||||
),
|
||||
);
|
||||
runDelayed(finishCheckIfServerIsOkay, Duration(seconds: 60), dataState);
|
||||
runDelayed(
|
||||
finishCheckIfServerIsOkay, const Duration(seconds: 60), dataState);
|
||||
});
|
||||
} else {
|
||||
runDelayed(oneMoreReset, Duration(seconds: 60), dataState);
|
||||
runDelayed(oneMoreReset, const Duration(seconds: 60), dataState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,7 +222,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
var isServerWorking = await repository.isHttpServerWorking();
|
||||
|
||||
if (isServerWorking) {
|
||||
var pauseDuration = Duration(seconds: 30);
|
||||
var pauseDuration = const Duration(seconds: 30);
|
||||
emit(TimerState(
|
||||
dataState: dataState,
|
||||
timerStart: DateTime.now(),
|
||||
|
@ -238,10 +241,11 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
isLoading: false,
|
||||
),
|
||||
);
|
||||
runDelayed(oneMoreReset, Duration(seconds: 60), dataState);
|
||||
runDelayed(oneMoreReset, const Duration(seconds: 60), dataState);
|
||||
});
|
||||
} else {
|
||||
runDelayed(resetServerIfServerIsOkay, Duration(seconds: 60), dataState);
|
||||
runDelayed(
|
||||
resetServerIfServerIsOkay, const Duration(seconds: 60), dataState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -260,7 +264,8 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
|
||||
emit(dataState.finish());
|
||||
} else {
|
||||
runDelayed(finishCheckIfServerIsOkay, Duration(seconds: 60), dataState);
|
||||
runDelayed(
|
||||
finishCheckIfServerIsOkay, const Duration(seconds: 60), dataState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,7 +285,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
void submitDomainForAccessRecovery(String domain) async {
|
||||
var serverDomain = ServerDomain(
|
||||
domainName: domain,
|
||||
provider: DnsProvider.Unknown,
|
||||
provider: DnsProvider.unknown,
|
||||
zoneId: '',
|
||||
);
|
||||
final recoveryCapabilities =
|
||||
|
@ -291,12 +296,12 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
emit(ServerInstallationRecovery(
|
||||
serverDomain: serverDomain,
|
||||
recoveryCapabilities: recoveryCapabilities,
|
||||
currentStep: RecoveryStep.Selecting,
|
||||
currentStep: RecoveryStep.selecting,
|
||||
));
|
||||
}
|
||||
|
||||
void tryToRecover(String token, ServerRecoveryMethods method) async {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
final serverDomain = dataState.serverDomain;
|
||||
if (serverDomain == null) {
|
||||
return;
|
||||
|
@ -324,7 +329,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
await repository.saveServerDetails(serverDetails);
|
||||
emit(dataState.copyWith(
|
||||
serverDetails: serverDetails,
|
||||
currentStep: RecoveryStep.HetznerToken,
|
||||
currentStep: RecoveryStep.hetznerToken,
|
||||
));
|
||||
} on ServerAuthorizationException {
|
||||
getIt<NavigationService>()
|
||||
|
@ -338,23 +343,23 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
}
|
||||
|
||||
void revertRecoveryStep() {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
switch (dataState.currentStep) {
|
||||
case RecoveryStep.Selecting:
|
||||
case RecoveryStep.selecting:
|
||||
repository.deleteDomain();
|
||||
emit(ServerInstallationEmpty());
|
||||
emit(const ServerInstallationEmpty());
|
||||
break;
|
||||
case RecoveryStep.RecoveryKey:
|
||||
case RecoveryStep.NewDeviceKey:
|
||||
case RecoveryStep.OldToken:
|
||||
case RecoveryStep.recoveryKey:
|
||||
case RecoveryStep.newDeviceKey:
|
||||
case RecoveryStep.oldToken:
|
||||
emit(dataState.copyWith(
|
||||
currentStep: RecoveryStep.Selecting,
|
||||
currentStep: RecoveryStep.selecting,
|
||||
));
|
||||
break;
|
||||
case RecoveryStep.ServerSelection:
|
||||
case RecoveryStep.serverSelection:
|
||||
repository.deleteHetznerKey();
|
||||
emit(dataState.copyWith(
|
||||
currentStep: RecoveryStep.HetznerToken,
|
||||
currentStep: RecoveryStep.hetznerToken,
|
||||
));
|
||||
break;
|
||||
// We won't revert steps after client is authorized
|
||||
|
@ -364,21 +369,21 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
}
|
||||
|
||||
void selectRecoveryMethod(ServerRecoveryMethods method) {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
switch (method) {
|
||||
case ServerRecoveryMethods.newDeviceKey:
|
||||
emit(dataState.copyWith(
|
||||
currentStep: RecoveryStep.NewDeviceKey,
|
||||
currentStep: RecoveryStep.newDeviceKey,
|
||||
));
|
||||
break;
|
||||
case ServerRecoveryMethods.recoveryKey:
|
||||
emit(dataState.copyWith(
|
||||
currentStep: RecoveryStep.RecoveryKey,
|
||||
currentStep: RecoveryStep.recoveryKey,
|
||||
));
|
||||
break;
|
||||
case ServerRecoveryMethods.oldToken:
|
||||
emit(dataState.copyWith(
|
||||
currentStep: RecoveryStep.OldToken,
|
||||
currentStep: RecoveryStep.oldToken,
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
@ -386,7 +391,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
|
||||
Future<List<ServerBasicInfoWithValidators>>
|
||||
getServersOnHetznerAccount() async {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
final servers = await repository.getServersOnHetznerAccount();
|
||||
final validated = servers
|
||||
.map((server) => ServerBasicInfoWithValidators.fromServerBasicInfo(
|
||||
|
@ -399,7 +404,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
}
|
||||
|
||||
Future<void> setServerId(ServerBasicInfo server) async {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
final serverDomain = dataState.serverDomain;
|
||||
if (serverDomain == null) {
|
||||
return;
|
||||
|
@ -410,21 +415,21 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
createTime: server.created,
|
||||
volume: ServerVolume(
|
||||
id: server.volumeId,
|
||||
name: "recovered_volume",
|
||||
name: 'recovered_volume',
|
||||
),
|
||||
apiToken: dataState.serverDetails!.apiToken,
|
||||
provider: ServerProvider.Hetzner,
|
||||
provider: ServerProvider.hetzner,
|
||||
);
|
||||
await repository.saveDomain(serverDomain);
|
||||
await repository.saveServerDetails(serverDetails);
|
||||
emit(dataState.copyWith(
|
||||
serverDetails: serverDetails,
|
||||
currentStep: RecoveryStep.CloudflareToken,
|
||||
currentStep: RecoveryStep.cloudflareToken,
|
||||
));
|
||||
}
|
||||
|
||||
Future<void> setAndValidateCloudflareToken(String token) async {
|
||||
final dataState = this.state as ServerInstallationRecovery;
|
||||
final dataState = state as ServerInstallationRecovery;
|
||||
final serverDomain = dataState.serverDomain;
|
||||
if (serverDomain == null) {
|
||||
return;
|
||||
|
@ -438,17 +443,17 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
await repository.saveDomain(ServerDomain(
|
||||
domainName: serverDomain.domainName,
|
||||
zoneId: zoneId,
|
||||
provider: DnsProvider.Cloudflare,
|
||||
provider: DnsProvider.cloudflare,
|
||||
));
|
||||
await repository.saveCloudFlareKey(token);
|
||||
emit(dataState.copyWith(
|
||||
serverDomain: ServerDomain(
|
||||
domainName: serverDomain.domainName,
|
||||
zoneId: zoneId,
|
||||
provider: DnsProvider.Cloudflare,
|
||||
provider: DnsProvider.cloudflare,
|
||||
),
|
||||
cloudFlareKey: token,
|
||||
currentStep: RecoveryStep.BackblazeToken,
|
||||
currentStep: RecoveryStep.backblazeToken,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -474,7 +479,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
closeTimer();
|
||||
|
||||
repository.clearAppConfig();
|
||||
emit(ServerInstallationEmpty());
|
||||
emit(const ServerInstallationEmpty());
|
||||
}
|
||||
|
||||
Future<void> serverDelete() async {
|
||||
|
@ -499,6 +504,7 @@ class ServerInstallationCubit extends Cubit<ServerInstallationState> {
|
|||
));
|
||||
}
|
||||
|
||||
@override
|
||||
close() {
|
||||
closeTimer();
|
||||
return super.close();
|
||||
|
|
|
@ -62,7 +62,7 @@ class ServerInstallationRepository {
|
|||
);
|
||||
}
|
||||
|
||||
if (serverDomain != null && serverDomain.provider == DnsProvider.Unknown) {
|
||||
if (serverDomain != null && serverDomain.provider == DnsProvider.unknown) {
|
||||
return ServerInstallationRecovery(
|
||||
hetznerKey: hetznerToken,
|
||||
cloudFlareKey: cloudflareToken,
|
||||
|
@ -101,17 +101,17 @@ class ServerInstallationRepository {
|
|||
) {
|
||||
if (serverDetails != null) {
|
||||
if (hetznerToken != null) {
|
||||
if (serverDetails.provider != ServerProvider.Unknown) {
|
||||
if (serverDomain.provider != DnsProvider.Unknown) {
|
||||
return RecoveryStep.BackblazeToken;
|
||||
if (serverDetails.provider != ServerProvider.unknown) {
|
||||
if (serverDomain.provider != DnsProvider.unknown) {
|
||||
return RecoveryStep.backblazeToken;
|
||||
}
|
||||
return RecoveryStep.CloudflareToken;
|
||||
return RecoveryStep.cloudflareToken;
|
||||
}
|
||||
return RecoveryStep.ServerSelection;
|
||||
return RecoveryStep.serverSelection;
|
||||
}
|
||||
return RecoveryStep.HetznerToken;
|
||||
return RecoveryStep.hetznerToken;
|
||||
}
|
||||
return RecoveryStep.Selecting;
|
||||
return RecoveryStep.selecting;
|
||||
}
|
||||
|
||||
void clearAppConfig() {
|
||||
|
@ -271,7 +271,7 @@ class ServerInstallationRepository {
|
|||
var nav = getIt.get<NavigationService>();
|
||||
nav.showPopUpDialog(
|
||||
BrandAlert(
|
||||
title: e.response!.data["errors"][0]["code"] == 1038
|
||||
title: e.response!.data['errors'][0]['code'] == 1038
|
||||
? 'modals.10'.tr()
|
||||
: 'providers.domain.states.error'.tr(),
|
||||
contentText: 'modals.6'.tr(),
|
||||
|
@ -309,7 +309,7 @@ class ServerInstallationRepository {
|
|||
|
||||
var dkimRecordString = await api.getDkim();
|
||||
|
||||
await cloudflareApi.setDkim(dkimRecordString ?? "", cloudFlareDomain);
|
||||
await cloudflareApi.setDkim(dkimRecordString ?? '', cloudFlareDomain);
|
||||
}
|
||||
|
||||
Future<bool> isHttpServerWorking() async {
|
||||
|
@ -408,7 +408,7 @@ class ServerInstallationRepository {
|
|||
id: 0,
|
||||
name: '',
|
||||
),
|
||||
provider: ServerProvider.Unknown,
|
||||
provider: ServerProvider.unknown,
|
||||
id: 0,
|
||||
ip4: serverIp,
|
||||
startTime: null,
|
||||
|
@ -439,7 +439,7 @@ class ServerInstallationRepository {
|
|||
id: 0,
|
||||
name: '',
|
||||
),
|
||||
provider: ServerProvider.Unknown,
|
||||
provider: ServerProvider.unknown,
|
||||
id: 0,
|
||||
ip4: '',
|
||||
startTime: null,
|
||||
|
@ -472,7 +472,7 @@ class ServerInstallationRepository {
|
|||
id: 0,
|
||||
name: '',
|
||||
),
|
||||
provider: ServerProvider.Unknown,
|
||||
provider: ServerProvider.unknown,
|
||||
id: 0,
|
||||
ip4: '',
|
||||
startTime: null,
|
||||
|
@ -487,7 +487,7 @@ class ServerInstallationRepository {
|
|||
|
||||
Future<User> getMainUser() async {
|
||||
var serverApi = ServerApi();
|
||||
final fallbackUser = User(
|
||||
const fallbackUser = User(
|
||||
isFoundOnServer: false,
|
||||
note: 'Couldn\'t find main user on server, API is outdated',
|
||||
login: 'UNKNOWN',
|
||||
|
|
|
@ -122,7 +122,7 @@ class ServerInstallationNotFinished extends ServerInstallationState {
|
|||
final bool isLoading;
|
||||
final Map<String, bool>? dnsMatches;
|
||||
|
||||
ServerInstallationNotFinished({
|
||||
const ServerInstallationNotFinished({
|
||||
String? hetznerKey,
|
||||
String? cloudFlareKey,
|
||||
BackblazeCredential? backblazeCredential,
|
||||
|
@ -203,7 +203,7 @@ class ServerInstallationNotFinished extends ServerInstallationState {
|
|||
}
|
||||
|
||||
class ServerInstallationEmpty extends ServerInstallationNotFinished {
|
||||
ServerInstallationEmpty()
|
||||
const ServerInstallationEmpty()
|
||||
: super(
|
||||
hetznerKey: null,
|
||||
cloudFlareKey: null,
|
||||
|
@ -256,14 +256,14 @@ class ServerInstallationFinished extends ServerInstallationState {
|
|||
}
|
||||
|
||||
enum RecoveryStep {
|
||||
Selecting,
|
||||
RecoveryKey,
|
||||
NewDeviceKey,
|
||||
OldToken,
|
||||
HetznerToken,
|
||||
ServerSelection,
|
||||
CloudflareToken,
|
||||
BackblazeToken,
|
||||
selecting,
|
||||
recoveryKey,
|
||||
newDeviceKey,
|
||||
oldToken,
|
||||
hetznerToken,
|
||||
serverSelection,
|
||||
cloudflareToken,
|
||||
backblazeToken,
|
||||
}
|
||||
|
||||
enum ServerRecoveryCapabilities {
|
||||
|
@ -289,8 +289,8 @@ class ServerInstallationRecovery extends ServerInstallationState {
|
|||
ServerDomain? serverDomain,
|
||||
User? rootUser,
|
||||
ServerHostingDetails? serverDetails,
|
||||
required RecoveryStep this.currentStep,
|
||||
required ServerRecoveryCapabilities this.recoveryCapabilities,
|
||||
required this.currentStep,
|
||||
required this.recoveryCapabilities,
|
||||
}) : super(
|
||||
hetznerKey: hetznerKey,
|
||||
cloudFlareKey: cloudFlareKey,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:selfprivacy/logic/api_maps/server.dart';
|
||||
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
|
||||
part 'services_state.dart';
|
||||
|
||||
|
@ -9,6 +8,7 @@ class ServicesCubit extends ServerInstallationDependendCubit<ServicesState> {
|
|||
ServicesCubit(ServerInstallationCubit serverInstallationCubit)
|
||||
: super(serverInstallationCubit, ServicesState.allOff());
|
||||
final api = ServerApi();
|
||||
@override
|
||||
Future<void> load() async {
|
||||
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
||||
var statuses = await api.servicesPowerCheck();
|
||||
|
|
|
@ -15,14 +15,14 @@ class ServicesState extends ServerInstallationDependendState {
|
|||
final bool isSocialNetworkEnable;
|
||||
final bool isVpnEnable;
|
||||
|
||||
factory ServicesState.allOff() => ServicesState(
|
||||
factory ServicesState.allOff() => const ServicesState(
|
||||
isPasswordManagerEnable: false,
|
||||
isCloudEnable: false,
|
||||
isGitEnable: false,
|
||||
isSocialNetworkEnable: false,
|
||||
isVpnEnable: false,
|
||||
);
|
||||
factory ServicesState.allOn() => ServicesState(
|
||||
factory ServicesState.allOn() => const ServicesState(
|
||||
isPasswordManagerEnable: true,
|
||||
isCloudEnable: true,
|
||||
isGitEnable: true,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:hive/hive.dart';
|
||||
import 'package:selfprivacy/config/hive_config.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
||||
import 'package:selfprivacy/logic/models/hive/user.dart';
|
||||
|
||||
import '../../api_maps/server.dart';
|
||||
|
@ -14,18 +13,19 @@ class UsersCubit extends ServerInstallationDependendCubit<UsersState> {
|
|||
UsersCubit(ServerInstallationCubit serverInstallationCubit)
|
||||
: super(
|
||||
serverInstallationCubit,
|
||||
UsersState(
|
||||
const UsersState(
|
||||
<User>[], User(login: 'root'), User(login: 'loading...')));
|
||||
Box<User> box = Hive.box<User>(BNames.usersBox);
|
||||
Box serverInstallationBox = Hive.box(BNames.serverInstallationBox);
|
||||
|
||||
final api = ServerApi();
|
||||
|
||||
@override
|
||||
Future<void> load() async {
|
||||
if (serverInstallationCubit.state is ServerInstallationFinished) {
|
||||
var loadedUsers = box.values.toList();
|
||||
final primaryUser = serverInstallationBox.get(BNames.rootUser,
|
||||
defaultValue: User(login: 'loading...'));
|
||||
defaultValue: const User(login: 'loading...'));
|
||||
List<String> rootKeys = [
|
||||
...serverInstallationBox.get(BNames.rootKeys, defaultValue: [])
|
||||
];
|
||||
|
@ -308,6 +308,7 @@ class UsersCubit extends ServerInstallationDependendCubit<UsersState> {
|
|||
|
||||
@override
|
||||
void clear() async {
|
||||
emit(UsersState(<User>[], User(login: 'root'), User(login: 'loading...')));
|
||||
emit(const UsersState(
|
||||
<User>[], User(login: 'root'), User(login: 'loading...')));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
|||
import 'package:selfprivacy/logic/models/hive/server_domain.dart';
|
||||
|
||||
class ApiConfigModel {
|
||||
Box _box = Hive.box(BNames.serverInstallationBox);
|
||||
final Box _box = Hive.box(BNames.serverInstallationBox);
|
||||
|
||||
ServerHostingDetails? get serverDetails => _serverDetails;
|
||||
String? get hetznerKey => _hetznerKey;
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:selfprivacy/logic/models/message.dart';
|
||||
|
||||
class ConsoleModel extends ChangeNotifier {
|
||||
List<Message> _messages = [];
|
||||
final List<Message> _messages = [];
|
||||
|
||||
List<Message> get messages => _messages;
|
||||
|
||||
|
|
|
@ -24,6 +24,6 @@ class BackblazeBucket {
|
|||
|
||||
@override
|
||||
String toString() {
|
||||
return '$bucketName';
|
||||
return bucketName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class BackblazeCredential {
|
|||
}
|
||||
|
||||
String encodedBackblazeKey(String? keyId, String? applicationKey) {
|
||||
String _apiKey = '$keyId:$applicationKey';
|
||||
String encodedApiKey = base64.encode(utf8.encode(_apiKey));
|
||||
String apiKey = '$keyId:$applicationKey';
|
||||
String encodedApiKey = base64.encode(utf8.encode(apiKey));
|
||||
return encodedApiKey;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ServerHostingDetails {
|
|||
@HiveField(5)
|
||||
final String apiToken;
|
||||
|
||||
@HiveField(6, defaultValue: ServerProvider.Hetzner)
|
||||
@HiveField(6, defaultValue: ServerProvider.hetzner)
|
||||
final ServerProvider provider;
|
||||
|
||||
ServerHostingDetails copyWith({DateTime? startTime}) {
|
||||
|
@ -47,6 +47,7 @@ class ServerHostingDetails {
|
|||
);
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() => id.toString();
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ class ServerVolume {
|
|||
@HiveType(typeId: 101)
|
||||
enum ServerProvider {
|
||||
@HiveField(0)
|
||||
Unknown,
|
||||
unknown,
|
||||
@HiveField(1)
|
||||
Hetzner,
|
||||
hetzner,
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ class ServerHostingDetailsAdapter extends TypeAdapter<ServerHostingDetails> {
|
|||
volume: fields[4] as ServerVolume,
|
||||
apiToken: fields[5] as String,
|
||||
provider: fields[6] == null
|
||||
? ServerProvider.Hetzner
|
||||
? ServerProvider.hetzner
|
||||
: fields[6] as ServerProvider,
|
||||
startTime: fields[2] as DateTime?,
|
||||
);
|
||||
|
@ -105,21 +105,21 @@ class ServerProviderAdapter extends TypeAdapter<ServerProvider> {
|
|||
ServerProvider read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return ServerProvider.Unknown;
|
||||
return ServerProvider.unknown;
|
||||
case 1:
|
||||
return ServerProvider.Hetzner;
|
||||
return ServerProvider.hetzner;
|
||||
default:
|
||||
return ServerProvider.Unknown;
|
||||
return ServerProvider.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, ServerProvider obj) {
|
||||
switch (obj) {
|
||||
case ServerProvider.Unknown:
|
||||
case ServerProvider.unknown:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case ServerProvider.Hetzner:
|
||||
case ServerProvider.hetzner:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class ServerDomain {
|
|||
@HiveField(1)
|
||||
final String zoneId;
|
||||
|
||||
@HiveField(2, defaultValue: DnsProvider.Cloudflare)
|
||||
@HiveField(2, defaultValue: DnsProvider.cloudflare)
|
||||
final DnsProvider provider;
|
||||
|
||||
@override
|
||||
|
@ -28,7 +28,7 @@ class ServerDomain {
|
|||
@HiveType(typeId: 100)
|
||||
enum DnsProvider {
|
||||
@HiveField(0)
|
||||
Unknown,
|
||||
unknown,
|
||||
@HiveField(1)
|
||||
Cloudflare,
|
||||
cloudflare,
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class ServerDomainAdapter extends TypeAdapter<ServerDomain> {
|
|||
domainName: fields[0] as String,
|
||||
zoneId: fields[1] as String,
|
||||
provider:
|
||||
fields[2] == null ? DnsProvider.Cloudflare : fields[2] as DnsProvider,
|
||||
fields[2] == null ? DnsProvider.cloudflare : fields[2] as DnsProvider,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -55,21 +55,21 @@ class DnsProviderAdapter extends TypeAdapter<DnsProvider> {
|
|||
DnsProvider read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return DnsProvider.Unknown;
|
||||
return DnsProvider.unknown;
|
||||
case 1:
|
||||
return DnsProvider.Cloudflare;
|
||||
return DnsProvider.cloudflare;
|
||||
default:
|
||||
return DnsProvider.Unknown;
|
||||
return DnsProvider.unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, DnsProvider obj) {
|
||||
switch (obj) {
|
||||
case DnsProvider.Unknown:
|
||||
case DnsProvider.unknown:
|
||||
writer.writeByte(0);
|
||||
break;
|
||||
case DnsProvider.Cloudflare:
|
||||
case DnsProvider.cloudflare:
|
||||
writer.writeByte(1);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ part 'user.g.dart';
|
|||
|
||||
@HiveType(typeId: 1)
|
||||
class User extends Equatable {
|
||||
User({
|
||||
const User({
|
||||
required this.login,
|
||||
this.password,
|
||||
this.sshKeys = const [],
|
||||
|
@ -22,7 +22,7 @@ class User extends Equatable {
|
|||
@HiveField(1)
|
||||
final String? password;
|
||||
|
||||
@HiveField(2, defaultValue: const [])
|
||||
@HiveField(2, defaultValue: [])
|
||||
final List<String> sshKeys;
|
||||
|
||||
@HiveField(3, defaultValue: true)
|
||||
|
@ -36,6 +36,7 @@ class User extends Equatable {
|
|||
|
||||
Color get color => stringToColor(login);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return '$login, ${isFoundOnServer ? 'found' : 'not found'}, ${sshKeys.length} ssh keys, note: $note';
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class CreateSSHKeyJob extends Job {
|
|||
CreateSSHKeyJob({
|
||||
required this.user,
|
||||
required this.publicKey,
|
||||
}) : super(title: '${"jobs.create_ssh_key".tr(args: [user.login])}');
|
||||
}) : super(title: 'jobs.create_ssh_key'.tr(args: [user.login]));
|
||||
|
||||
final User user;
|
||||
final String publicKey;
|
||||
|
@ -84,7 +84,7 @@ class DeleteSSHKeyJob extends Job {
|
|||
DeleteSSHKeyJob({
|
||||
required this.user,
|
||||
required this.publicKey,
|
||||
}) : super(title: '${"jobs.delete_ssh_key".tr(args: [user.login])}');
|
||||
}) : super(title: 'jobs.delete_ssh_key'.tr(args: [user.login]));
|
||||
|
||||
final User user;
|
||||
final String publicKey;
|
||||
|
|
|
@ -7,12 +7,13 @@ class ApiToken {
|
|||
ApiToken({
|
||||
required this.name,
|
||||
required this.date,
|
||||
required this.is_caller,
|
||||
required this.isCaller,
|
||||
});
|
||||
|
||||
final String name;
|
||||
final DateTime date;
|
||||
final bool is_caller;
|
||||
@JsonKey(name: 'is_caller')
|
||||
final bool isCaller;
|
||||
|
||||
factory ApiToken.fromJson(Map<String, dynamic> json) =>
|
||||
_$ApiTokenFromJson(json);
|
||||
|
|
|
@ -9,5 +9,5 @@ part of 'api_token.dart';
|
|||
ApiToken _$ApiTokenFromJson(Map<String, dynamic> json) => ApiToken(
|
||||
name: json['name'] as String,
|
||||
date: DateTime.parse(json['date'] as String),
|
||||
is_caller: json['is_caller'] as bool,
|
||||
isCaller: json['is_caller'] as bool,
|
||||
);
|
||||
|
|
|
@ -8,7 +8,7 @@ class AutoUpgradeSettings extends Equatable {
|
|||
final bool enable;
|
||||
final bool allowReboot;
|
||||
|
||||
AutoUpgradeSettings({
|
||||
const AutoUpgradeSettings({
|
||||
required this.enable,
|
||||
required this.allowReboot,
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@ part 'recovery_token_status.g.dart';
|
|||
|
||||
@JsonSerializable()
|
||||
class RecoveryKeyStatus extends Equatable {
|
||||
RecoveryKeyStatus({
|
||||
const RecoveryKeyStatus({
|
||||
required this.exists,
|
||||
required this.valid,
|
||||
this.date,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:intl/intl.dart';
|
||||
|
||||
final formatter = new DateFormat('hh:mm');
|
||||
final formatter = DateFormat('hh:mm');
|
||||
|
||||
class Message {
|
||||
Message({this.text, this.type = MessageType.normal}) : time = DateTime.now();
|
||||
|
|
|
@ -85,9 +85,9 @@ class MyApp extends StatelessWidget {
|
|||
appSettings.isDarkModeOn ? ThemeMode.dark : ThemeMode.light,
|
||||
home: appSettings.isOnboardingShowing
|
||||
? OnboardingPage(nextPage: InitializingPage())
|
||||
: RootPage(),
|
||||
: const RootPage(),
|
||||
builder: (BuildContext context, Widget? widget) {
|
||||
Widget error = Text('...rendering error...');
|
||||
Widget error = const Text('...rendering error...');
|
||||
if (widget is Scaffold || widget is Navigator) {
|
||||
error = Scaffold(body: Center(child: error));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ abstract class AppThemeFactory {
|
|||
}
|
||||
|
||||
static Future<ThemeData> _createAppTheme({
|
||||
bool isDark: false,
|
||||
bool isDark = false,
|
||||
required Color fallbackColor,
|
||||
}) async {
|
||||
ColorScheme? gtkColorsScheme;
|
||||
|
@ -39,12 +39,12 @@ abstract class AppThemeFactory {
|
|||
);
|
||||
}
|
||||
|
||||
final accentColor = await SystemAccentColor(fallbackColor);
|
||||
final accentColor = SystemAccentColor(fallbackColor);
|
||||
|
||||
try {
|
||||
await accentColor.load();
|
||||
} on MissingPluginException catch (e) {
|
||||
print("_createAppTheme: ${e.message}");
|
||||
print('_createAppTheme: ${e.message}');
|
||||
}
|
||||
|
||||
final fallbackColorScheme = ColorScheme.fromSeed(
|
||||
|
|
|
@ -20,7 +20,7 @@ class ActionButton extends StatelessWidget {
|
|||
return TextButton(
|
||||
child: Text(
|
||||
text!,
|
||||
style: isRed ? TextStyle(color: BrandColors.red1) : null,
|
||||
style: isRed ? const TextStyle(color: BrandColors.red1) : null,
|
||||
),
|
||||
onPressed: () {
|
||||
navigator.pop();
|
||||
|
|
|
@ -44,9 +44,9 @@ class BrandBottomSheet extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
const SizedBox(height: 6),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: mainHeight),
|
||||
child: innerWidget,
|
||||
|
|
|
@ -14,7 +14,7 @@ class BrandButton {
|
|||
assert(text == null || child == null, 'required title or child');
|
||||
assert(text != null || child != null, 'required title or child');
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 48,
|
||||
minWidth: double.infinity,
|
||||
),
|
||||
|
@ -33,7 +33,7 @@ class BrandButton {
|
|||
required String title,
|
||||
}) =>
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 48,
|
||||
minWidth: double.infinity,
|
||||
),
|
||||
|
|
|
@ -16,11 +16,11 @@ class FilledButton extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
child: child ?? Text(title ?? ''),
|
||||
style: ElevatedButton.styleFrom(
|
||||
onPrimary: Theme.of(context).colorScheme.onPrimary,
|
||||
primary: Theme.of(context).colorScheme.primary,
|
||||
).copyWith(elevation: ButtonStyleButton.allOrNull(0.0)),
|
||||
child: child ?? Text(title ?? ''),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -3,22 +3,22 @@ import 'package:selfprivacy/config/brand_colors.dart';
|
|||
|
||||
class BrandCards {
|
||||
static Widget big({required Widget child}) => _BrandCard(
|
||||
child: child,
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 15,
|
||||
),
|
||||
shadow: bigShadow,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: child,
|
||||
);
|
||||
static Widget small({required Widget child}) => _BrandCard(
|
||||
child: child,
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15,
|
||||
vertical: 10,
|
||||
),
|
||||
shadow: bigShadow,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: child,
|
||||
);
|
||||
static Widget outlined({required Widget child}) => _OutlinedCard(
|
||||
child: child,
|
||||
|
@ -70,7 +70,7 @@ class _OutlinedCard extends StatelessWidget {
|
|||
return Card(
|
||||
elevation: 0.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
side: BorderSide(
|
||||
color: Theme.of(context).colorScheme.outline,
|
||||
),
|
||||
|
@ -92,19 +92,19 @@ class _FilledCard extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
elevation: 0.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: child,
|
||||
color: Theme.of(context).colorScheme.surfaceVariant,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
final bigShadow = [
|
||||
BoxShadow(
|
||||
offset: Offset(0, 4),
|
||||
offset: const Offset(0, 4),
|
||||
blurRadius: 8,
|
||||
color: Colors.black.withOpacity(.08),
|
||||
)
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:selfprivacy/ui/components/pre_styled_buttons/pre_styled_buttons.
|
|||
class BrandHeader extends StatelessWidget {
|
||||
const BrandHeader({
|
||||
Key? key,
|
||||
this.title = "",
|
||||
this.title = '',
|
||||
this.hasBackButton = false,
|
||||
this.hasFlashButton = false,
|
||||
this.onBackButtonPressed,
|
||||
|
@ -25,22 +25,20 @@ class BrandHeader extends StatelessWidget {
|
|||
padding: EdgeInsets.only(
|
||||
left: hasBackButton ? 1 : 15,
|
||||
),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
if (hasBackButton) ...[
|
||||
IconButton(
|
||||
icon: Icon(BrandIcons.arrow_left),
|
||||
onPressed:
|
||||
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
],
|
||||
BrandText.h4(title),
|
||||
Spacer(),
|
||||
if (hasFlashButton) PreStyledButtons.flash(),
|
||||
child: Row(
|
||||
children: [
|
||||
if (hasBackButton) ...[
|
||||
IconButton(
|
||||
icon: const Icon(BrandIcons.arrowLeft),
|
||||
onPressed:
|
||||
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
BrandText.h4(title),
|
||||
const Spacer(),
|
||||
if (hasFlashButton) PreStyledButtons.flash(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class BrandHeroScreen extends StatelessWidget {
|
|||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: Size.fromHeight(52.0),
|
||||
preferredSize: const Size.fromHeight(52.0),
|
||||
child: BrandHeader(
|
||||
title: headerTitle,
|
||||
hasBackButton: hasBackButton,
|
||||
|
@ -37,29 +37,29 @@ class BrandHeroScreen extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: <Widget>[
|
||||
if (heroIcon != null)
|
||||
Container(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: Icon(
|
||||
heroIcon,
|
||||
size: 48.0,
|
||||
),
|
||||
alignment: Alignment.bottomLeft,
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
const SizedBox(height: 8.0),
|
||||
if (heroTitle != null)
|
||||
Text(
|
||||
heroTitle!,
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
textAlign: TextAlign.start,
|
||||
),
|
||||
SizedBox(height: 8.0),
|
||||
const SizedBox(height: 8.0),
|
||||
if (heroSubtitle != null)
|
||||
Text(heroSubtitle!,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
textAlign: TextAlign.start),
|
||||
SizedBox(height: 16.0),
|
||||
const SizedBox(height: 16.0),
|
||||
...children,
|
||||
],
|
||||
),
|
||||
|
|
|
@ -67,7 +67,7 @@ class BrandIcons {
|
|||
IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData upload =
|
||||
IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData arrow_left =
|
||||
static const IconData arrowLeft =
|
||||
IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData shape =
|
||||
IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
|
|
|
@ -12,8 +12,8 @@ class _HorizontalLoader extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('basis.wait'.tr()),
|
||||
SizedBox(height: 10),
|
||||
LinearProgressIndicator(minHeight: 3),
|
||||
const SizedBox(height: 10),
|
||||
const LinearProgressIndicator(minHeight: 3),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:selfprivacy/config/brand_colors.dart';
|
||||
|
||||
class BrandRadio extends StatelessWidget {
|
||||
BrandRadio({
|
||||
const BrandRadio({
|
||||
Key? key,
|
||||
required this.isChecked,
|
||||
}) : super(key: key);
|
||||
|
@ -15,7 +15,7 @@ class BrandRadio extends StatelessWidget {
|
|||
height: 20,
|
||||
width: 20,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.all(2),
|
||||
padding: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: _getBorder(),
|
||||
|
@ -24,7 +24,7 @@ class BrandRadio extends StatelessWidget {
|
|||
? Container(
|
||||
height: 10,
|
||||
width: 10,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: BrandColors.primary,
|
||||
),
|
||||
|
|
|
@ -21,13 +21,13 @@ class BrandRadioTile extends StatelessWidget {
|
|||
onTap: onPress,
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(2),
|
||||
padding: const EdgeInsets.all(2),
|
||||
child: Row(
|
||||
children: [
|
||||
BrandRadio(
|
||||
isChecked: isChecked,
|
||||
),
|
||||
SizedBox(width: 9),
|
||||
const SizedBox(width: 9),
|
||||
BrandText.h5(text)
|
||||
],
|
||||
),
|
||||
|
|
|
@ -11,7 +11,7 @@ class BrandSpanButton extends TextSpan {
|
|||
}) : super(
|
||||
recognizer: TapGestureRecognizer()..onTap = onTap,
|
||||
text: text,
|
||||
style: (style ?? TextStyle()).copyWith(color: BrandColors.blue),
|
||||
style: (style ?? const TextStyle()).copyWith(color: BrandColors.blue),
|
||||
);
|
||||
|
||||
static link({
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart';
|
||||
|
||||
class BrandTabBar extends StatefulWidget {
|
||||
BrandTabBar({Key? key, this.controller}) : super(key: key);
|
||||
const BrandTabBar({Key? key, this.controller}) : super(key: key);
|
||||
|
||||
final TabController? controller;
|
||||
@override
|
||||
|
|
|
@ -31,7 +31,7 @@ class _BrandTimerState extends State<BrandTimer> {
|
|||
|
||||
_timerStart() {
|
||||
_timeString = differenceFromStart;
|
||||
timer = Timer.periodic(Duration(seconds: 1), (Timer t) {
|
||||
timer = Timer.periodic(const Duration(seconds: 1), (Timer t) {
|
||||
var timePassed = DateTime.now().difference(widget.startDateTime);
|
||||
if (timePassed > widget.duration) {
|
||||
t.cancel();
|
||||
|
@ -54,7 +54,7 @@ class _BrandTimerState extends State<BrandTimer> {
|
|||
Widget build(BuildContext context) {
|
||||
return BrandText.medium(
|
||||
_timeString,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontWeight: NamedFontWeight.demiBold,
|
||||
),
|
||||
);
|
||||
|
@ -71,10 +71,10 @@ class _BrandTimerState extends State<BrandTimer> {
|
|||
|
||||
String _durationToString(Duration duration) {
|
||||
var timeLeft = widget.duration - duration;
|
||||
String twoDigits(int n) => n.toString().padLeft(2, "0");
|
||||
String twoDigits(int n) => n.toString().padLeft(2, '0');
|
||||
String twoDigitSeconds = twoDigits(timeLeft.inSeconds);
|
||||
|
||||
return "timer.sec".tr(args: [twoDigitSeconds]);
|
||||
return 'timer.sec'.tr(args: [twoDigitSeconds]);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -16,7 +16,7 @@ class DotsIndicator extends StatelessWidget {
|
|||
var dots = List.generate(
|
||||
count,
|
||||
(index) => Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 5, vertical: 10),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
|
||||
height: 10,
|
||||
width: 10,
|
||||
decoration: BoxDecoration(
|
||||
|
|
|
@ -16,7 +16,7 @@ class BrandError extends StatelessWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(error.toString()),
|
||||
Text('stackTrace: '),
|
||||
const Text('stackTrace: '),
|
||||
Text(stackTrace.toString()),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -3,7 +3,7 @@ import 'package:selfprivacy/config/brand_colors.dart';
|
|||
import 'package:selfprivacy/logic/models/state_types.dart';
|
||||
|
||||
class IconStatusMask extends StatelessWidget {
|
||||
IconStatusMask({required this.child, required this.status});
|
||||
const IconStatusMask({required this.child, required this.status});
|
||||
final Icon child;
|
||||
|
||||
final StateType status;
|
||||
|
@ -24,8 +24,8 @@ class IconStatusMask extends StatelessWidget {
|
|||
}
|
||||
return ShaderMask(
|
||||
shaderCallback: (bounds) => LinearGradient(
|
||||
begin: Alignment(-1, -0.8),
|
||||
end: Alignment(0.9, 0.9),
|
||||
begin: const Alignment(-1, -0.8),
|
||||
end: const Alignment(0.9, 0.9),
|
||||
colors: colors,
|
||||
tileMode: TileMode.mirror,
|
||||
).createShader(bounds),
|
||||
|
|
|
@ -24,19 +24,19 @@ class JobsContent extends StatelessWidget {
|
|||
var installationState = context.read<ServerInstallationCubit>().state;
|
||||
if (state is JobsStateEmpty) {
|
||||
widgets = [
|
||||
SizedBox(height: 80),
|
||||
const SizedBox(height: 80),
|
||||
Center(child: BrandText.body1('jobs.empty'.tr())),
|
||||
];
|
||||
|
||||
if (installationState is ServerInstallationFinished) {
|
||||
widgets = [
|
||||
...widgets,
|
||||
SizedBox(height: 80),
|
||||
const SizedBox(height: 80),
|
||||
BrandButton.rised(
|
||||
onPressed: () => context.read<JobsCubit>().upgradeServer(),
|
||||
text: 'jobs.upgradeServer'.tr(),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
BrandButton.text(
|
||||
onPressed: () {
|
||||
var nav = getIt<NavigationService>();
|
||||
|
@ -61,7 +61,7 @@ class JobsContent extends StatelessWidget {
|
|||
}
|
||||
} else if (state is JobsStateLoading) {
|
||||
widgets = [
|
||||
SizedBox(height: 80),
|
||||
const SizedBox(height: 80),
|
||||
BrandLoader.horizontal(),
|
||||
];
|
||||
} else if (state is JobsStateWithJobs) {
|
||||
|
@ -75,7 +75,7 @@ class JobsContent extends StatelessWidget {
|
|||
child: Text(j.title),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
const SizedBox(width: 10),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: BrandColors.red1,
|
||||
|
@ -91,7 +91,7 @@ class JobsContent extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
.toList(),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
BrandButton.rised(
|
||||
onPressed: () => context.read<JobsCubit>().applyAll(),
|
||||
text: 'jobs.start'.tr(),
|
||||
|
@ -101,13 +101,13 @@ class JobsContent extends StatelessWidget {
|
|||
return ListView(
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
SizedBox(height: 15),
|
||||
const SizedBox(height: 15),
|
||||
Center(
|
||||
child: BrandText.h2(
|
||||
'jobs.title'.tr(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
...widgets
|
||||
],
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ class NotReadyCard extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15), color: BrandColors.gray6),
|
||||
child: RichText(
|
||||
|
@ -19,7 +19,7 @@ class NotReadyCard extends StatelessWidget {
|
|||
children: [
|
||||
TextSpan(
|
||||
text: 'not_ready_card.1'.tr(),
|
||||
style: TextStyle(color: BrandColors.white),
|
||||
style: const TextStyle(color: BrandColors.white),
|
||||
),
|
||||
WidgetSpan(
|
||||
child: Padding(
|
||||
|
@ -44,7 +44,7 @@ class NotReadyCard extends StatelessWidget {
|
|||
),
|
||||
TextSpan(
|
||||
text: 'not_ready_card.3'.tr(),
|
||||
style: TextStyle(color: BrandColors.white),
|
||||
style: const TextStyle(color: BrandColors.white),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -18,18 +18,18 @@ class OnePage extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 51,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: BrandText.h4('basis.details'.tr()),
|
||||
),
|
||||
BrandDivider(),
|
||||
const BrandDivider(),
|
||||
],
|
||||
),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: child,
|
||||
bottomNavigationBar: SafeArea(
|
||||
|
|
|
@ -13,7 +13,7 @@ class _CloseButton extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
BrandText.h4('basis.close'.tr()),
|
||||
Icon(Icons.close),
|
||||
const Icon(Icons.close),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
part of 'pre_styled_buttons.dart';
|
||||
|
||||
class _BrandFlashButton extends StatefulWidget {
|
||||
_BrandFlashButton({Key? key}) : super(key: key);
|
||||
const _BrandFlashButton({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BrandFlashButtonState createState() => _BrandFlashButtonState();
|
||||
|
@ -14,8 +14,8 @@ class _BrandFlashButtonState extends State<_BrandFlashButton>
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_animationController =
|
||||
AnimationController(vsync: this, duration: Duration(milliseconds: 800));
|
||||
_animationController = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 800));
|
||||
_colorTween = ColorTween(
|
||||
begin: BrandColors.black,
|
||||
end: BrandColors.primary,
|
||||
|
@ -61,7 +61,7 @@ class _BrandFlashButtonState extends State<_BrandFlashButton>
|
|||
onPressed: () {
|
||||
showBrandBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => BrandBottomSheet(
|
||||
builder: (context) => const BrandBottomSheet(
|
||||
isExpended: true,
|
||||
child: JobsContent(),
|
||||
),
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
|||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
||||
|
||||
class BrandFab extends StatefulWidget {
|
||||
BrandFab({Key? key}) : super(key: key);
|
||||
const BrandFab({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BrandFabState createState() => _BrandFabState();
|
||||
|
@ -21,8 +21,8 @@ class _BrandFabState extends State<BrandFab>
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_animationController =
|
||||
AnimationController(vsync: this, duration: Duration(milliseconds: 800));
|
||||
_animationController = AnimationController(
|
||||
vsync: this, duration: const Duration(milliseconds: 800));
|
||||
_colorTween = ColorTween(
|
||||
begin: BrandColors.black,
|
||||
end: BrandColors.primary,
|
||||
|
@ -68,7 +68,7 @@ class _BrandFabState extends State<BrandFab>
|
|||
onPressed: () {
|
||||
showBrandBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => BrandBottomSheet(
|
||||
builder: (context) => const BrandBottomSheet(
|
||||
isExpended: true,
|
||||
child: JobsContent(),
|
||||
),
|
|
@ -18,5 +18,5 @@ class PreStyledButtons {
|
|||
}) =>
|
||||
_CloseButton(onPress: onPress);
|
||||
|
||||
static Widget flash() => _BrandFlashButton();
|
||||
static Widget flash() => const _BrandFlashButton();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart';
|
|||
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
|
||||
|
||||
class ProgressBar extends StatefulWidget {
|
||||
ProgressBar({
|
||||
const ProgressBar({
|
||||
Key? key,
|
||||
required this.steps,
|
||||
required this.activeIndex,
|
||||
|
@ -49,12 +49,12 @@ class _ProgressBarState extends State<ProgressBar> {
|
|||
|
||||
odd.insert(
|
||||
0,
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
);
|
||||
odd.add(
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
);
|
||||
|
@ -63,12 +63,12 @@ class _ProgressBarState extends State<ProgressBar> {
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
BrandText.h2('Progress'),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
children: even,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: even,
|
||||
),
|
||||
SizedBox(height: 7),
|
||||
const SizedBox(height: 7),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
decoration: BoxDecoration(
|
||||
|
@ -82,23 +82,23 @@ class _ProgressBarState extends State<ProgressBar> {
|
|||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
gradient: LinearGradient(
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: BrandColors.stableGradientColors,
|
||||
),
|
||||
),
|
||||
duration: Duration(
|
||||
duration: const Duration(
|
||||
milliseconds: 300,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
children: odd,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: odd,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
@ -114,7 +114,7 @@ class _ProgressBarState extends State<ProgressBar> {
|
|||
|
||||
style = isActive ? style!.copyWith(fontWeight: FontWeight.w700) : style;
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
height: 20,
|
||||
alignment: Alignment.center,
|
||||
child: RichText(
|
||||
|
@ -123,9 +123,9 @@ class _ProgressBarState extends State<ProgressBar> {
|
|||
style: progressTextStyleLight,
|
||||
children: [
|
||||
checked
|
||||
? WidgetSpan(
|
||||
? const WidgetSpan(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2, right: 2),
|
||||
padding: EdgeInsets.only(bottom: 2, right: 2),
|
||||
child: Icon(BrandIcons.check, size: 11),
|
||||
))
|
||||
: TextSpan(text: '${index + 1}.', style: style),
|
||||
|
|
|
@ -16,8 +16,8 @@ class SwitcherBlock extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
|
||||
)),
|
||||
|
@ -26,7 +26,7 @@ class SwitcherBlock extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: child),
|
||||
SizedBox(width: 5),
|
||||
const SizedBox(width: 5),
|
||||
Switch(
|
||||
activeColor: BrandColors.green1,
|
||||
activeTrackColor: BrandColors.green2,
|
||||
|
|
|
@ -9,6 +9,6 @@ Future<T?> showBrandBottomSheet<T>({
|
|||
builder: builder,
|
||||
barrierColor: Colors.black45,
|
||||
context: context,
|
||||
shadow: BoxShadow(color: Colors.transparent),
|
||||
shadow: const BoxShadow(color: Colors.transparent),
|
||||
backgroundColor: Colors.transparent,
|
||||
);
|
||||
|
|
|
@ -72,7 +72,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
: () async {
|
||||
await context.read<BackupsCubit>().createBackup();
|
||||
},
|
||||
leading: Icon(
|
||||
leading: const Icon(
|
||||
Icons.add_circle_outline_rounded,
|
||||
),
|
||||
title: Text(
|
||||
|
@ -105,7 +105,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
),
|
||||
if (backupStatus == BackupStatusEnum.error)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
leading: const Icon(
|
||||
Icons.error_outline,
|
||||
color: BrandColors.red1,
|
||||
),
|
||||
|
@ -117,7 +117,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
// Card with a list of existing backups
|
||||
// Each list item has a date
|
||||
// When clicked, starts the restore action
|
||||
|
@ -128,7 +128,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
leading: const Icon(
|
||||
Icons.refresh,
|
||||
),
|
||||
title: Text(
|
||||
|
@ -136,12 +136,12 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
const Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
if (backups.isEmpty)
|
||||
ListTile(
|
||||
leading: Icon(
|
||||
leading: const Icon(
|
||||
Icons.error_outline,
|
||||
),
|
||||
title: Text('providers.backup.no_backups'.tr()),
|
||||
|
@ -174,11 +174,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
));
|
||||
},
|
||||
title: Text(
|
||||
MaterialLocalizations.of(context)
|
||||
.formatShortDate(backup.time) +
|
||||
' ' +
|
||||
TimeOfDay.fromDateTime(backup.time)
|
||||
.format(context),
|
||||
'${MaterialLocalizations.of(context).formatShortDate(backup.time)} ${TimeOfDay.fromDateTime(backup.time).format(context)}',
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
|
@ -186,7 +182,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
const SizedBox(height: 16),
|
||||
BrandCards.outlined(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -203,7 +199,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
if (providerState != StateType.uninitialized)
|
||||
Column(
|
||||
children: [
|
||||
Divider(
|
||||
const Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
ListTile(
|
||||
|
@ -218,7 +214,7 @@ class _BackupDetailsState extends State<BackupDetails>
|
|||
.forceUpdateBackups()
|
||||
},
|
||||
),
|
||||
Divider(
|
||||
const Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
ListTile(
|
||||
|
|
|
@ -16,26 +16,26 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
Widget _getStateCard(DnsRecordsStatus dnsState, Function fixCallback) {
|
||||
var description = '';
|
||||
var subtitle = '';
|
||||
var icon = Icon(
|
||||
var icon = const Icon(
|
||||
Icons.check,
|
||||
color: Colors.green,
|
||||
);
|
||||
switch (dnsState) {
|
||||
case DnsRecordsStatus.uninitialized:
|
||||
description = 'providers.domain.states.uninitialized'.tr();
|
||||
icon = Icon(
|
||||
icon = const Icon(
|
||||
Icons.refresh,
|
||||
);
|
||||
break;
|
||||
case DnsRecordsStatus.refreshing:
|
||||
description = 'providers.domain.states.refreshing'.tr();
|
||||
icon = Icon(
|
||||
icon = const Icon(
|
||||
Icons.refresh,
|
||||
);
|
||||
break;
|
||||
case DnsRecordsStatus.good:
|
||||
description = 'providers.domain.states.ok'.tr();
|
||||
icon = Icon(
|
||||
icon = const Icon(
|
||||
Icons.check,
|
||||
color: Colors.green,
|
||||
);
|
||||
|
@ -43,7 +43,7 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
case DnsRecordsStatus.error:
|
||||
description = 'providers.domain.states.error'.tr();
|
||||
subtitle = 'providers.domain.states.error_subtitle'.tr();
|
||||
icon = Icon(
|
||||
icon = const Icon(
|
||||
Icons.error,
|
||||
color: Colors.red,
|
||||
);
|
||||
|
@ -104,7 +104,7 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 16.0),
|
||||
const SizedBox(height: 16.0),
|
||||
// Outlined card with a list of A records and their
|
||||
// status.
|
||||
BrandCards.outlined(
|
||||
|
@ -128,7 +128,7 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
.map(
|
||||
(dnsRecord) => Column(
|
||||
children: [
|
||||
Divider(
|
||||
const Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
ListTile(
|
||||
|
@ -162,7 +162,7 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16.0),
|
||||
const SizedBox(height: 16.0),
|
||||
BrandCards.outlined(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -184,7 +184,7 @@ class _DnsDetailsPageState extends State<DnsDetailsPage> {
|
|||
.map(
|
||||
(dnsRecord) => Column(
|
||||
children: [
|
||||
Divider(
|
||||
const Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
ListTile(
|
||||
|
|
|
@ -11,14 +11,12 @@ class AboutPage extends StatelessWidget {
|
|||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: BrandHeader(
|
||||
title: 'more.about_project'.tr(), hasBackButton: true),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: Container(
|
||||
child: BrandMarkdown(
|
||||
fileName: 'about',
|
||||
),
|
||||
body: const BrandMarkdown(
|
||||
fileName: 'about',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -28,17 +28,17 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
child: Builder(builder: (context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: BrandHeader(
|
||||
title: 'more.settings.title'.tr(), hasBackButton: true),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: ListView(
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
BrandDivider(),
|
||||
const BrandDivider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
|
||||
)),
|
||||
|
@ -52,7 +52,7 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
value: 'more.settings.2'.tr(),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
const SizedBox(width: 5),
|
||||
BrandSwitch(
|
||||
value: Theme.of(context).brightness == Brightness.dark,
|
||||
onChanged: (value) => context
|
||||
|
@ -63,8 +63,8 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
|
||||
)),
|
||||
|
@ -78,14 +78,14 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
value: 'more.settings.4'.tr(),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
const SizedBox(width: 5),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: BrandColors.red1,
|
||||
),
|
||||
child: Text(
|
||||
'basis.reset'.tr(),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
color: BrandColors.white,
|
||||
fontWeight: NamedFontWeight.demiBold,
|
||||
),
|
||||
|
@ -131,8 +131,8 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
var isDisabled =
|
||||
context.watch<ServerInstallationCubit>().state.serverDetails == null;
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(width: 1, color: BrandColors.dividerColor),
|
||||
)),
|
||||
|
@ -146,18 +146,11 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
value: 'more.settings.6'.tr(),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
const SizedBox(width: 5),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: BrandColors.red1,
|
||||
),
|
||||
child: Text(
|
||||
'basis.delete'.tr(),
|
||||
style: TextStyle(
|
||||
color: BrandColors.white,
|
||||
fontWeight: NamedFontWeight.demiBold,
|
||||
),
|
||||
),
|
||||
onPressed: isDisabled
|
||||
? null
|
||||
: () {
|
||||
|
@ -177,7 +170,8 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
builder: (context) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
child: CircularProgressIndicator(),
|
||||
child:
|
||||
const CircularProgressIndicator(),
|
||||
);
|
||||
});
|
||||
await context
|
||||
|
@ -193,6 +187,13 @@ class _AppSettingsPageState extends State<AppSettingsPage> {
|
|||
},
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'basis.delete'.tr(),
|
||||
style: const TextStyle(
|
||||
color: BrandColors.white,
|
||||
fontWeight: NamedFontWeight.demiBold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -220,9 +221,9 @@ class _TextColumn extends StatelessWidget {
|
|||
title,
|
||||
style: TextStyle(color: hasWarning ? BrandColors.warning : null),
|
||||
),
|
||||
SizedBox(height: 5),
|
||||
const SizedBox(height: 5),
|
||||
BrandText.body1(value,
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
height: 1.53,
|
||||
color: BrandColors.gray1,
|
||||
|
|
|
@ -35,13 +35,13 @@ class _ConsoleState extends State<Console> {
|
|||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(53),
|
||||
child: Column(
|
||||
children: [
|
||||
children: const [
|
||||
BrandHeader(title: 'Console', hasBackButton: true),
|
||||
BrandDivider(),
|
||||
],
|
||||
),
|
||||
preferredSize: Size.fromHeight(53),
|
||||
),
|
||||
body: FutureBuilder(
|
||||
future: getIt.allReady(),
|
||||
|
@ -53,7 +53,7 @@ class _ConsoleState extends State<Console> {
|
|||
reverse: true,
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
...UnmodifiableListView(messages
|
||||
.map((message) {
|
||||
var isError = message.type == MessageType.warning;
|
||||
|
@ -84,7 +84,7 @@ class _ConsoleState extends State<Console> {
|
|||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
children: const [
|
||||
Text('Waiting for initialisation'),
|
||||
SizedBox(
|
||||
height: 16,
|
||||
|
|
|
@ -14,14 +14,14 @@ class InfoPage extends StatelessWidget {
|
|||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: BrandHeader(title: 'more.about_app'.tr(), hasBackButton: true),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: ListView(
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
BrandDivider(),
|
||||
SizedBox(height: 10),
|
||||
const BrandDivider(),
|
||||
const SizedBox(height: 10),
|
||||
FutureBuilder(
|
||||
future: _version(),
|
||||
builder: (context, snapshot) {
|
||||
|
|
|
@ -27,11 +27,11 @@ class MorePage extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: BrandHeader(
|
||||
title: 'basis.more'.tr(),
|
||||
hasFlashButton: true,
|
||||
),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
|
@ -39,7 +39,7 @@ class MorePage extends StatelessWidget {
|
|||
padding: paddingH15V0,
|
||||
child: Column(
|
||||
children: [
|
||||
BrandDivider(),
|
||||
const BrandDivider(),
|
||||
_NavItem(
|
||||
title: 'more.configuration_wizard'.tr(),
|
||||
iconData: BrandIcons.triangle,
|
||||
|
@ -48,27 +48,27 @@ class MorePage extends StatelessWidget {
|
|||
_NavItem(
|
||||
title: 'more.settings.title'.tr(),
|
||||
iconData: BrandIcons.settings,
|
||||
goTo: AppSettingsPage(),
|
||||
goTo: const AppSettingsPage(),
|
||||
),
|
||||
_NavItem(
|
||||
title: 'more.about_project'.tr(),
|
||||
iconData: BrandIcons.engineer,
|
||||
goTo: AboutPage(),
|
||||
goTo: const AboutPage(),
|
||||
),
|
||||
_NavItem(
|
||||
title: 'more.about_app'.tr(),
|
||||
iconData: BrandIcons.fire,
|
||||
goTo: InfoPage(),
|
||||
goTo: const InfoPage(),
|
||||
),
|
||||
_NavItem(
|
||||
title: 'more.onboarding'.tr(),
|
||||
iconData: BrandIcons.start,
|
||||
goTo: OnboardingPage(nextPage: RootPage()),
|
||||
goTo: const OnboardingPage(nextPage: RootPage()),
|
||||
),
|
||||
_NavItem(
|
||||
title: 'more.console'.tr(),
|
||||
iconData: BrandIcons.terminal,
|
||||
goTo: Console(),
|
||||
goTo: const Console(),
|
||||
),
|
||||
_NavItem(
|
||||
isEnabled: context.read<ServerInstallationCubit>().state
|
||||
|
@ -131,8 +131,8 @@ class _MoreMenuItem extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 24),
|
||||
decoration: BoxDecoration(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
decoration: const BoxDecoration(
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 1.0,
|
||||
|
@ -148,7 +148,7 @@ class _MoreMenuItem extends StatelessWidget {
|
|||
color: isActive ? null : Colors.grey,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
width: 56,
|
||||
child: Icon(
|
||||
|
|
|
@ -53,11 +53,11 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 30),
|
||||
const SizedBox(height: 30),
|
||||
BrandText.h2(
|
||||
'onboarding.page1_title'.tr(),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
BrandText.body2('onboarding.page1_text'.tr()),
|
||||
Flexible(
|
||||
child: Center(
|
||||
|
@ -75,13 +75,13 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
onPressed: () {
|
||||
pageController.animateToPage(
|
||||
1,
|
||||
duration: Duration(milliseconds: 300),
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeIn,
|
||||
);
|
||||
},
|
||||
text: 'basis.next'.tr(),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
@ -94,11 +94,11 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 30),
|
||||
const SizedBox(height: 30),
|
||||
BrandText.h2('onboarding.page2_title'.tr()),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
BrandText.body2('onboarding.page2_text'.tr()),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
Center(
|
||||
child: Image.asset(
|
||||
_fileName(
|
||||
|
@ -131,7 +131,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
},
|
||||
text: 'basis.got_it'.tr(),
|
||||
),
|
||||
SizedBox(height: 30),
|
||||
const SizedBox(height: 30),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ import 'package:selfprivacy/utils/route_transitions/basic.dart';
|
|||
var navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
class ProvidersPage extends StatefulWidget {
|
||||
ProvidersPage({Key? key}) : super(key: key);
|
||||
const ProvidersPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ProvidersPageState createState() => _ProvidersPageState();
|
||||
|
@ -49,7 +49,7 @@ class _ProvidersPageState extends State<ProvidersPage> {
|
|||
final cards = ProviderType.values
|
||||
.map(
|
||||
(type) => Padding(
|
||||
padding: EdgeInsets.only(bottom: 30),
|
||||
padding: const EdgeInsets.only(bottom: 30),
|
||||
child: _Card(
|
||||
provider: ProviderModel(
|
||||
state: isReady
|
||||
|
@ -67,18 +67,18 @@ class _ProvidersPageState extends State<ProvidersPage> {
|
|||
.toList();
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: BrandHeader(
|
||||
title: 'providers.page_title'.tr(),
|
||||
hasFlashButton: true,
|
||||
),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: ListView(
|
||||
padding: paddingH15V0,
|
||||
children: [
|
||||
if (!isReady) ...[
|
||||
NotReadyCard(),
|
||||
SizedBox(height: 24),
|
||||
const NotReadyCard(),
|
||||
const SizedBox(height: 24),
|
||||
],
|
||||
...cards,
|
||||
],
|
||||
|
@ -111,7 +111,7 @@ class _Card extends StatelessWidget {
|
|||
stableText = 'providers.server.status'.tr();
|
||||
onTap = () => showBrandBottomSheet(
|
||||
context: context,
|
||||
builder: (context) => BrandBottomSheet(
|
||||
builder: (context) => const BrandBottomSheet(
|
||||
isExpended: true,
|
||||
child: ServerDetailsScreen(),
|
||||
),
|
||||
|
@ -132,7 +132,7 @@ class _Card extends StatelessWidget {
|
|||
stableText = 'providers.backup.status'.tr();
|
||||
|
||||
onTap = () => Navigator.of(context).push(materialRoute(
|
||||
BackupDetails(),
|
||||
const BackupDetails(),
|
||||
));
|
||||
break;
|
||||
}
|
||||
|
@ -146,12 +146,12 @@ class _Card extends StatelessWidget {
|
|||
status: provider.state,
|
||||
child: Icon(provider.icon, size: 30, color: Colors.white),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
BrandText.h2(title),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
if (message != null) ...[
|
||||
BrandText.body2(message),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
if (provider.state == StateType.stable) BrandText.body2(stableText),
|
||||
],
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:selfprivacy/ui/pages/providers/providers.dart';
|
|||
import 'package:selfprivacy/ui/pages/services/services.dart';
|
||||
import 'package:selfprivacy/ui/pages/users/users.dart';
|
||||
|
||||
import '../components/pre_styled_buttons/flashFab.dart';
|
||||
import '../components/pre_styled_buttons/flash_fab.dart';
|
||||
|
||||
class RootPage extends StatefulWidget {
|
||||
const RootPage({Key? key}) : super(key: key);
|
||||
|
@ -42,7 +42,7 @@ class _RootPageState extends State<RootPage>
|
|||
create: (_) => ChangeTab(tabController.animateTo),
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: [
|
||||
children: const [
|
||||
ProvidersPage(),
|
||||
ServicesPage(),
|
||||
UsersPage(),
|
||||
|
@ -53,7 +53,7 @@ class _RootPageState extends State<RootPage>
|
|||
bottomNavigationBar: BrandTabBar(
|
||||
controller: tabController,
|
||||
),
|
||||
floatingActionButton: BrandFab(),
|
||||
floatingActionButton: const BrandFab(),
|
||||
),
|
||||
);
|
||||
}
|
|
@ -19,33 +19,33 @@ class _Chart extends StatelessWidget {
|
|||
];
|
||||
} else if (state is HetznerMetricsLoaded) {
|
||||
charts = [
|
||||
Legend(color: Colors.red, text: 'CPU %'),
|
||||
SizedBox(height: 20),
|
||||
const Legend(color: Colors.red, text: 'CPU %'),
|
||||
const SizedBox(height: 20),
|
||||
getCpuChart(state),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
BrandText.small('Public Network interface packets per sec'),
|
||||
SizedBox(width: 10),
|
||||
Legend(color: Colors.red, text: 'IN'),
|
||||
SizedBox(width: 5),
|
||||
Legend(color: Colors.green, text: 'OUT'),
|
||||
const SizedBox(width: 10),
|
||||
const Legend(color: Colors.red, text: 'IN'),
|
||||
const SizedBox(width: 5),
|
||||
const Legend(color: Colors.green, text: 'OUT'),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
getPpsChart(state),
|
||||
SizedBox(height: 1),
|
||||
const SizedBox(height: 1),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
BrandText.small('Public Network interface bytes per sec'),
|
||||
SizedBox(width: 10),
|
||||
Legend(color: Colors.red, text: 'IN'),
|
||||
SizedBox(width: 5),
|
||||
Legend(color: Colors.green, text: 'OUT'),
|
||||
const SizedBox(width: 10),
|
||||
const Legend(color: Colors.red, text: 'IN'),
|
||||
const SizedBox(width: 5),
|
||||
const Legend(color: Colors.green, text: 'OUT'),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
getBandwidthChart(state),
|
||||
];
|
||||
} else {
|
||||
|
@ -57,7 +57,7 @@ class _Chart extends StatelessWidget {
|
|||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
@ -88,7 +88,7 @@ class _Chart extends StatelessWidget {
|
|||
Widget getCpuChart(HetznerMetricsLoaded state) {
|
||||
var data = state.cpu;
|
||||
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: CpuChart(data, state.period, state.start),
|
||||
);
|
||||
|
@ -98,7 +98,7 @@ class _Chart extends StatelessWidget {
|
|||
var ppsIn = state.ppsIn;
|
||||
var ppsOut = state.ppsOut;
|
||||
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: NetworkChart(
|
||||
[ppsIn, ppsOut],
|
||||
|
@ -112,7 +112,7 @@ class _Chart extends StatelessWidget {
|
|||
var ppsIn = state.bandwidthIn;
|
||||
var ppsOut = state.bandwidthOut;
|
||||
|
||||
return Container(
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: NetworkChart(
|
||||
[ppsIn, ppsOut],
|
||||
|
@ -138,7 +138,7 @@ class Legend extends StatelessWidget {
|
|||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
_ColoredBox(color: color),
|
||||
SizedBox(width: 5),
|
||||
const SizedBox(width: 5),
|
||||
BrandText.small(text),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:selfprivacy/logic/models/hetzner_metrics.dart';
|
|||
import 'package:intl/intl.dart';
|
||||
|
||||
class CpuChart extends StatelessWidget {
|
||||
CpuChart(this.data, this.period, this.start);
|
||||
const CpuChart(this.data, this.period, this.start);
|
||||
|
||||
final List<TimeSeriesData> data;
|
||||
final Period period;
|
||||
|
@ -54,13 +54,13 @@ class CpuChart extends StatelessWidget {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RotatedBox(
|
||||
quarterTurns: 1,
|
||||
child: Text(bottomTitle(value.toInt()),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
quarterTurns: 1,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -71,7 +71,7 @@ class CpuChart extends StatelessWidget {
|
|||
sideTitles: SideTitles(
|
||||
getTitlesWidget: (value, titleMeta) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
padding: const EdgeInsets.only(right: 15),
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: progressTextStyleLight.copyWith(
|
||||
|
|
|
@ -16,17 +16,17 @@ class _Header extends StatelessWidget {
|
|||
children: [
|
||||
IconStatusMask(
|
||||
status: providerState,
|
||||
child: Icon(
|
||||
child: const Icon(
|
||||
BrandIcons.server,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
const SizedBox(width: 10),
|
||||
BrandText.h2('providers.server.card_title'.tr()),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 4,
|
||||
horizontal: 2,
|
||||
),
|
||||
|
@ -41,12 +41,12 @@ class _Header extends StatelessWidget {
|
|||
break;
|
||||
}
|
||||
},
|
||||
icon: Icon(Icons.more_vert),
|
||||
icon: const Icon(Icons.more_vert),
|
||||
itemBuilder: (BuildContext context) => [
|
||||
PopupMenuItem<_PopupMenuItemType>(
|
||||
value: _PopupMenuItemType.setting,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 5),
|
||||
padding: const EdgeInsets.only(left: 5),
|
||||
child: Text('basis.settings'.tr()),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -9,7 +9,7 @@ import 'package:selfprivacy/logic/models/hetzner_metrics.dart';
|
|||
import 'package:intl/intl.dart';
|
||||
|
||||
class NetworkChart extends StatelessWidget {
|
||||
NetworkChart(
|
||||
const NetworkChart(
|
||||
this.listData,
|
||||
this.period,
|
||||
this.start,
|
||||
|
@ -76,13 +76,13 @@ class NetworkChart extends StatelessWidget {
|
|||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RotatedBox(
|
||||
quarterTurns: 1,
|
||||
child: Text(bottomTitle(value.toInt()),
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.purple,
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
quarterTurns: 1,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -94,7 +94,7 @@ class NetworkChart extends StatelessWidget {
|
|||
reservedSize: 50,
|
||||
getTitlesWidget: (value, titleMeta) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(right: 5),
|
||||
padding: const EdgeInsets.only(right: 5),
|
||||
child: Text(
|
||||
value.toInt().toString(),
|
||||
style: progressTextStyleLight.copyWith(
|
||||
|
|
|
@ -69,25 +69,25 @@ class _ServerDetailsScreenState extends State<ServerDetailsScreen>
|
|||
create: (context) => ServerDetailsCubit()..check(),
|
||||
child: Scaffold(
|
||||
appBar: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: 51,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: BrandText.h4('basis.details'.tr()),
|
||||
),
|
||||
BrandDivider(),
|
||||
const BrandDivider(),
|
||||
],
|
||||
),
|
||||
preferredSize: Size.fromHeight(52),
|
||||
),
|
||||
body: TabBarView(
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
controller: tabController,
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
physics: ClampingScrollPhysics(),
|
||||
physics: const ClampingScrollPhysics(),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -103,13 +103,13 @@ class _ServerDetailsScreenState extends State<ServerDetailsScreen>
|
|||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
const SizedBox(height: 10),
|
||||
BlocProvider(
|
||||
create: (context) => HetznerMetricsCubit()..restart(),
|
||||
child: _Chart(),
|
||||
child: const _Chart(),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
_TextDetails(),
|
||||
const SizedBox(height: 20),
|
||||
const _TextDetails(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue