Files
hash-wallet/lib/new-ui/widgets/new_primary_button.dart
T
jwinterm 788318a3a2 style: format Dart at 100 columns, as upstream does
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
2026-10-24 22:48:17 -04:00

63 lines
1.8 KiB
Dart

import "package:flutter/cupertino.dart";
import "package:flutter/material.dart";
class NewPrimaryButton extends StatelessWidget {
const NewPrimaryButton({
required this.onPressed,
required this.text,
required this.color,
required this.textColor,
this.image,
this.isLoading = false,
this.borderColor = Colors.transparent,
this.disabled = false,
super.key,
});
final VoidCallback onPressed;
final bool isLoading;
final bool disabled;
final Widget? image;
final Color color;
final Color textColor;
final Color borderColor;
final String text;
@override
Widget build(BuildContext context) => SizedBox(
height: 52,
child: TextButton(
onPressed: disabled ? null : onPressed,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
disabled ? color.withAlpha(128) : color,
),
shape: WidgetStateProperty.all<RoundedSuperellipseBorder>(
RoundedSuperellipseBorder(
borderRadius: BorderRadius.circular(18),
),
),
),
child: Center(
child: isLoading
? const CupertinoActivityIndicator()
: Row(
spacing: 10,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (image != null) image!,
Text(
text,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontSize: 14,
fontWeight: FontWeight.w600,
color: textColor,
),
),
],
),
),
),
);
}