mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-09 17:39:42 +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';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BrandButton {
|
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({
|
static ConstrainedBox filled({
|
||||||
required final VoidCallback? onPressed,
|
required final VoidCallback? onPressed,
|
||||||
final Key? key,
|
final Key? key,
|
||||||
|
|
|
@ -77,7 +77,7 @@ class JobsContent extends StatelessWidget {
|
||||||
widgets = [
|
widgets = [
|
||||||
...widgets,
|
...widgets,
|
||||||
const Gap(80),
|
const Gap(80),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: () => context.read<JobsCubit>().upgradeServer(),
|
onPressed: () => context.read<JobsCubit>().upgradeServer(),
|
||||||
text: 'jobs.upgrade_server'.tr(),
|
text: 'jobs.upgrade_server'.tr(),
|
||||||
),
|
),
|
||||||
|
@ -368,7 +368,7 @@ class JobsContent extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: () => context.read<JobsCubit>().acknowledgeFinished(),
|
onPressed: () => context.read<JobsCubit>().acknowledgeFinished(),
|
||||||
text: 'basis.done'.tr(),
|
text: 'basis.done'.tr(),
|
||||||
),
|
),
|
||||||
|
@ -432,7 +432,7 @@ class JobsContent extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Gap(16),
|
const Gap(16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: hasBlockingJobs
|
onPressed: hasBlockingJobs
|
||||||
? null
|
? null
|
||||||
: () => context.read<JobsCubit>().applyAll(),
|
: () => context.read<JobsCubit>().applyAll(),
|
||||||
|
|
|
@ -80,7 +80,7 @@ class BackupDetailsPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!preventActions)
|
if (!preventActions)
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: preventActions
|
onPressed: preventActions
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
|
|
|
@ -116,7 +116,7 @@ class ProviderInputDataPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
text: 'basis.connect'.tr(),
|
text: 'basis.connect'.tr(),
|
||||||
onPressed: () => providerCubit.trySubmit(),
|
onPressed: () => providerCubit.trySubmit(),
|
||||||
),
|
),
|
||||||
|
@ -197,7 +197,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
text: 'basis.select'.tr(),
|
text: 'basis.select'.tr(),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
serverInstallationCubit
|
serverInstallationCubit
|
||||||
|
@ -252,7 +252,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
text: 'basis.select'.tr(),
|
text: 'basis.select'.tr(),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
serverInstallationCubit
|
serverInstallationCubit
|
||||||
|
@ -308,7 +308,7 @@ class ProviderSelectionPage extends StatelessWidget {
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
text: 'basis.select'.tr(),
|
text: 'basis.select'.tr(),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
serverInstallationCubit
|
serverInstallationCubit
|
||||||
|
|
|
@ -304,7 +304,7 @@ class InitializingPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
||||||
|
@ -624,7 +624,7 @@ class AddSshKey extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context
|
: () => context
|
||||||
|
|
|
@ -211,7 +211,7 @@ class SelectTypePage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
backToLocationPickingCallback();
|
backToLocationPickingCallback();
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
||||||
|
|
|
@ -51,7 +51,7 @@ class RecoveryConfirmDns extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<DnsProviderFormCubit>().trySubmit(),
|
: () => context.read<DnsProviderFormCubit>().trySubmit(),
|
||||||
|
|
|
@ -106,7 +106,7 @@ class NewUserPage extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<UserFormCubit>().trySubmit(),
|
: () => context.read<UserFormCubit>().trySubmit(),
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ResetPassword extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<UserFormCubit>().trySubmit(),
|
: () => context.read<UserFormCubit>().trySubmit(),
|
||||||
|
|
|
@ -328,7 +328,7 @@ class NewSshKey extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
BrandButton.rised(
|
BrandButton.filled(
|
||||||
onPressed: formCubitState.isSubmitting
|
onPressed: formCubitState.isSubmitting
|
||||||
? null
|
? null
|
||||||
: () => context.read<SshFormCubit>().trySubmit(),
|
: () => context.read<SshFormCubit>().trySubmit(),
|
||||||
|
|
Loading…
Reference in a new issue