mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-30 06:48:49 +01:00
Upstream reformatted its whole tree in 16ddc0837. Matching it removes
formatting from the conflict surface of this and every later sync.
63 lines
1.8 KiB
Dart
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|