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; final bool secondary;
@override @override
Widget build(final BuildContext context) => Card( Widget build(final BuildContext context) => Card(
elevation: 0.0, elevation: 0.0,
shape: const RoundedRectangleBorder( shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12)), borderRadius: BorderRadius.all(Radius.circular(12)),
), ),
clipBehavior: clipped ? Clip.antiAlias : Clip.none, clipBehavior: clipped ? Clip.antiAlias : Clip.none,
color: error color: error
? Theme.of(context).colorScheme.errorContainer ? Theme.of(context).colorScheme.errorContainer
: secondary : secondary
? Theme.of(context).colorScheme.secondaryContainer ? Theme.of(context).colorScheme.secondaryContainer
: tertiary : tertiary
? Theme.of(context).colorScheme.tertiaryContainer ? Theme.of(context).colorScheme.tertiaryContainer
: Theme.of(context).colorScheme.surfaceVariant, : Theme.of(context).colorScheme.surfaceVariant,
child: child, child: child,
); );
} }

View File

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

View File

@ -12,20 +12,20 @@ class InfoBox extends StatelessWidget {
@override @override
Widget build(final BuildContext context) => Column( Widget build(final BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon( Icon(
isWarning ? Icons.warning_amber_outlined : Icons.info_outline, isWarning ? Icons.warning_amber_outlined : Icons.info_outline,
size: 24, size: 24,
color: Theme.of(context).colorScheme.onBackground, color: Theme.of(context).colorScheme.onBackground,
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
text, text,
style: Theme.of(context).textTheme.bodyMedium!.copyWith( style: Theme.of(context).textTheme.bodyMedium!.copyWith(
color: Theme.of(context).colorScheme.onBackground, 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_icons/brand_icons.dart';
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart'; import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>(); GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class BackupDetails extends StatefulWidget { class BackupDetails extends StatefulWidget {

View File

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

View File

@ -29,7 +29,9 @@ class RecoveryKeyReceiving extends StatelessWidget {
const SizedBox(height: 16), const SizedBox(height: 16),
const Divider(), const Divider(),
const SizedBox(height: 16), const SizedBox(height: 16),
InfoBox(text: 'recovery_key.key_receiving_info'.tr(),), InfoBox(
text: 'recovery_key.key_receiving_info'.tr(),
),
const SizedBox(height: 16), const SizedBox(height: 16),
FilledButton( FilledButton(
title: 'recovery_key.key_receiving_done'.tr(), 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) /// 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. /// 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. /// 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; DiskSize used = volume.sizeUsed;
for (final Service service in services) { for (final Service service in services) {
if (service.storageUsage.volume != null) { if (service.storageUsage.volume != null) {
if (service.storageUsage.volume == volume.name) { 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; used -= service.storageUsage.used;
} }
} else { } 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; used += service.storageUsage.used;
} }
} }
@ -101,7 +104,8 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
(final volume) => Column( (final volume) => Column(
children: [ children: [
ServerStorageListItem( ServerStorageListItem(
volume: recalculatedDiskUsages(volume, widget.services), volume: recalculatedDiskUsages(
volume, widget.services),
dense: true, dense: true,
), ),
const SizedBox(height: headerVerticalPadding), const SizedBox(height: headerVerticalPadding),
@ -119,7 +123,8 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
body: ListView( body: ListView(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
children: <Widget>[ children: <Widget>[
if (widget.services.isEmpty) const Center(child: CircularProgressIndicator()), if (widget.services.isEmpty)
const Center(child: CircularProgressIndicator()),
...widget.services ...widget.services
.map( .map(
(final service) => Column( (final service) => Column(
@ -139,7 +144,10 @@ class _DataMigrationPageState extends State<DataMigrationPage> {
.toList(), .toList(),
Padding( Padding(
padding: const EdgeInsets.all(8.0), 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), const SizedBox(height: 16),
FilledButton( FilledButton(

View File

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