refactor(ui): Delete BrandButton.rised

This commit is contained in:
Inex Code 2024-10-30 15:01:46 +03:00
parent a5020e729e
commit 3cd61e9cee
11 changed files with 16 additions and 38 deletions

View file

@ -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,

View file

@ -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(),

View file

@ -80,7 +80,7 @@ class BackupDetailsPage extends StatelessWidget {
),
),
if (!preventActions)
BrandButton.rised(
BrandButton.filled(
onPressed: preventActions
? null
: () {

View file

@ -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

View file

@ -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

View file

@ -211,7 +211,7 @@ class SelectTypePage extends StatelessWidget {
),
),
const SizedBox(height: 16),
BrandButton.rised(
BrandButton.filled(
onPressed: () {
backToLocationPickingCallback();
},

View file

@ -53,7 +53,7 @@ class RecoveryConfirmBackblaze extends StatelessWidget {
),
),
const SizedBox(height: 16),
BrandButton.rised(
BrandButton.filled(
onPressed: formCubitState.isSubmitting
? null
: () => context.read<BackblazeFormCubit>().trySubmit(),

View file

@ -51,7 +51,7 @@ class RecoveryConfirmDns extends StatelessWidget {
),
),
const SizedBox(height: 16),
BrandButton.rised(
BrandButton.filled(
onPressed: formCubitState.isSubmitting
? null
: () => context.read<DnsProviderFormCubit>().trySubmit(),

View file

@ -106,7 +106,7 @@ class NewUserPage extends StatelessWidget {
),
),
const SizedBox(height: 30),
BrandButton.rised(
BrandButton.filled(
onPressed: formCubitState.isSubmitting
? null
: () => context.read<UserFormCubit>().trySubmit(),

View file

@ -63,7 +63,7 @@ class ResetPassword extends StatelessWidget {
),
),
const SizedBox(height: 30),
BrandButton.rised(
BrandButton.filled(
onPressed: formCubitState.isSubmitting
? null
: () => context.read<UserFormCubit>().trySubmit(),

View file

@ -328,7 +328,7 @@ class NewSshKey extends StatelessWidget {
),
),
const SizedBox(height: 30),
BrandButton.rised(
BrandButton.filled(
onPressed: formCubitState.isSubmitting
? null
: () => context.read<SshFormCubit>().trySubmit(),