mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-08 17:11:14 +00:00
refactor(ui): Delete BrandButton.rised
This commit is contained in:
parent
a5020e729e
commit
3cd61e9cee
|
@ -1,28 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class BrandButton {
|
||||
static ConstrainedBox rised({
|
||||
required final VoidCallback? onPressed,
|
||||
final Key? key,
|
||||
final String? text,
|
||||
final Widget? child,
|
||||
}) {
|
||||
assert((text ?? child) != null, 'either title or child must not be empty');
|
||||
assert(text != null || child != null, 'title or child must be provided');
|
||||
|
||||
return ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 48,
|
||||
minWidth: double.infinity,
|
||||
),
|
||||
child: FilledButton(
|
||||
key: key,
|
||||
onPressed: onPressed,
|
||||
child: child ?? Text(text ?? ''),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static ConstrainedBox filled({
|
||||
required final VoidCallback? onPressed,
|
||||
final Key? key,
|
||||
|
|
|
@ -77,7 +77,7 @@ class JobsContent extends StatelessWidget {
|
|||
widgets = [
|
||||
...widgets,
|
||||
const Gap(80),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: () => context.read<JobsCubit>().upgradeServer(),
|
||||
text: 'jobs.upgrade_server'.tr(),
|
||||
),
|
||||
|
@ -368,7 +368,7 @@ class JobsContent extends StatelessWidget {
|
|||
},
|
||||
),
|
||||
const Gap(16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: () => context.read<JobsCubit>().acknowledgeFinished(),
|
||||
text: 'basis.done'.tr(),
|
||||
),
|
||||
|
@ -432,7 +432,7 @@ class JobsContent extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const Gap(16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: hasBlockingJobs
|
||||
? null
|
||||
: () => context.read<JobsCubit>().applyAll(),
|
||||
|
|
|
@ -80,7 +80,7 @@ class BackupDetailsPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
if (!preventActions)
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: preventActions
|
||||
? null
|
||||
: () {
|
||||
|
|
|
@ -116,7 +116,7 @@ class ProviderInputDataPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
text: 'basis.connect'.tr(),
|
||||
onPressed: () => providerCubit.trySubmit(),
|
||||
),
|
||||
|
@ -197,7 +197,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
|||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
text: 'basis.select'.tr(),
|
||||
onPressed: () {
|
||||
serverInstallationCubit
|
||||
|
@ -252,7 +252,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
|||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
text: 'basis.select'.tr(),
|
||||
onPressed: () {
|
||||
serverInstallationCubit
|
||||
|
@ -308,7 +308,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
|||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
text: 'basis.select'.tr(),
|
||||
onPressed: () {
|
||||
serverInstallationCubit
|
||||
|
|
|
@ -304,7 +304,7 @@ class InitializingPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
||||
|
@ -624,7 +624,7 @@ class AddSshKey extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context
|
||||
|
|
|
@ -211,7 +211,7 @@ class SelectTypePage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: () {
|
||||
backToLocationPickingCallback();
|
||||
},
|
||||
|
|
|
@ -53,7 +53,7 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
||||
|
|
|
@ -51,7 +51,7 @@ class RecoveryConfirmDns extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<DnsProviderFormCubit>().trySubmit(),
|
||||
|
|
|
@ -106,7 +106,7 @@ class NewUserPage extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<UserFormCubit>().trySubmit(),
|
||||
|
|
|
@ -63,7 +63,7 @@ class ResetPassword extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<UserFormCubit>().trySubmit(),
|
||||
|
|
|
@ -328,7 +328,7 @@ class NewSshKey extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
BrandButton.rised(
|
||||
BrandButton.filled(
|
||||
onPressed: formCubitState.isSubmitting
|
||||
? null
|
||||
: () => context.read<SshFormCubit>().trySubmit(),
|
||||
|
|
Loading…
Reference in a new issue