Formatting fixes

pull/116/head
Inex Code 2022-09-16 00:08:32 +03:00
parent 6619e42cfa
commit 71a18695e4
8 changed files with 70 additions and 58 deletions

View File

@ -17,18 +17,18 @@ class FilledCard extends StatelessWidget {
final bool secondary;
@override
Widget build(final BuildContext context) => Card(
elevation: 0.0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
clipBehavior: clipped ? Clip.antiAlias : Clip.none,
color: error
? Theme.of(context).colorScheme.errorContainer
: secondary
? Theme.of(context).colorScheme.secondaryContainer
: tertiary
? Theme.of(context).colorScheme.tertiaryContainer
: Theme.of(context).colorScheme.surfaceVariant,
child: child,
);
elevation: 0.0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)),
),
clipBehavior: clipped ? Clip.antiAlias : Clip.none,
color: error
? Theme.of(context).colorScheme.errorContainer
: secondary
? Theme.of(context).colorScheme.secondaryContainer
: tertiary
? Theme.of(context).colorScheme.tertiaryContainer
: Theme.of(context).colorScheme.surfaceVariant,
child: child,
);
}

View File

@ -9,14 +9,14 @@ class OutlinedCard extends StatelessWidget {
final Widget child;
@override
Widget build(final BuildContext context) => Card(
elevation: 0.0,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
side: BorderSide(
color: Theme.of(context).colorScheme.outline,
),
),
clipBehavior: Clip.antiAlias,
child: child,
);
elevation: 0.0,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
side: BorderSide(
color: Theme.of(context).colorScheme.outline,
),
),
clipBehavior: Clip.antiAlias,
child: child,
);
}

View File

@ -12,20 +12,20 @@ class InfoBox extends StatelessWidget {
@override
Widget build(final BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
isWarning ? Icons.warning_amber_outlined : Icons.info_outline,
size: 24,
color: Theme.of(context).colorScheme.onBackground,
),
const SizedBox(height: 16),
Text(
text,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
],
);
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
isWarning ? Icons.warning_amber_outlined : Icons.info_outline,
size: 24,
color: Theme.of(context).colorScheme.onBackground,
),
const SizedBox(height: 16),
Text(
text,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground,
),
),
],
);
}

View File

@ -13,7 +13,6 @@ import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.da
import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart';
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class BackupDetails extends StatefulWidget {

View File

@ -52,7 +52,9 @@ class _DevicesScreenState extends State<DevicesScreen> {
const SizedBox(height: 16),
const Divider(height: 1),
const SizedBox(height: 16),
InfoBox(text: 'devices.main_screen.tip'.tr(),),
InfoBox(
text: 'devices.main_screen.tip'.tr(),
),
],
const SizedBox(height: 24),
],

View File

@ -29,7 +29,9 @@ class RecoveryKeyReceiving extends StatelessWidget {
const SizedBox(height: 16),
const Divider(),
const SizedBox(height: 16),
InfoBox(text: 'recovery_key.key_receiving_info'.tr(),),
InfoBox(
text: 'recovery_key.key_receiving_info'.tr(),
),
const SizedBox(height: 16),
FilledButton(
title: 'recovery_key.key_receiving_done'.tr(),

View File

@ -51,17 +51,20 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
/// Check the services and if a service is moved (in a serviceToDisk entry)
/// subtract the used storage from the old volume and add it to the new volume.
/// The old volume is the volume the service is currently on, shown in services list.
DiskVolume recalculatedDiskUsages(final DiskVolume volume, final List<Service> services) {
DiskVolume recalculatedDiskUsages(
final DiskVolume volume, final List<Service> services) {
DiskSize used = volume.sizeUsed;
for (final Service service in services) {
if (service.storageUsage.volume != null) {
if (service.storageUsage.volume == volume.name) {
if (serviceToDisk[service.id] != null && serviceToDisk[service.id] != volume.name) {
if (serviceToDisk[service.id] != null &&
serviceToDisk[service.id] != volume.name) {
used -= service.storageUsage.used;
}
} else {
if (serviceToDisk[service.id] != null && serviceToDisk[service.id] == volume.name) {
if (serviceToDisk[service.id] != null &&
serviceToDisk[service.id] == volume.name) {
used += service.storageUsage.used;
}
}
@ -101,7 +104,8 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
(final volume) => Column(
children: [
ServerStorageListItem(
volume: recalculatedDiskUsages(volume, widget.services),
volume: recalculatedDiskUsages(
volume, widget.services),
dense: true,
),
const SizedBox(height: headerVerticalPadding),
@ -119,7 +123,8 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
body: ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
if (widget.services.isEmpty) const Center(child: CircularProgressIndicator()),
if (widget.services.isEmpty)
const Center(child: CircularProgressIndicator()),
...widget.services
.map(
(final service) => Column(
@ -139,7 +144,10 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
.toList(),
Padding(
padding: const EdgeInsets.all(8.0),
child: InfoBox(text: 'providers.storage.data_migration_notice'.tr(), isWarning: true,),
child: InfoBox(
text: 'providers.storage.data_migration_notice'.tr(),
isWarning: true,
),
),
const SizedBox(height: 16),
FilledButton(

View File

@ -68,15 +68,16 @@ class DiskVolume {
final bool? isResizable,
final ServerDiskVolume? serverDiskVolume,
final ServerVolume? providerVolume,
}) => DiskVolume(
sizeUsed: sizeUsed ?? this.sizeUsed,
sizeTotal: sizeTotal ?? this.sizeTotal,
name: name ?? this.name,
root: root ?? this.root,
isResizable: isResizable ?? this.isResizable,
serverDiskVolume: serverDiskVolume ?? this.serverDiskVolume,
providerVolume: providerVolume ?? this.providerVolume,
);
}) =>
DiskVolume(
sizeUsed: sizeUsed ?? this.sizeUsed,
sizeTotal: sizeTotal ?? this.sizeTotal,
name: name ?? this.name,
root: root ?? this.root,
isResizable: isResizable ?? this.isResizable,
serverDiskVolume: serverDiskVolume ?? this.serverDiskVolume,
providerVolume: providerVolume ?? this.providerVolume,
);
}
class DiskStatus {