60 lines
1.6 KiB
Dart
60 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class LongButton extends StatelessWidget {
|
|
final String text;
|
|
final IconData icon;
|
|
final VoidCallback onPressed;
|
|
final bool isLoading;
|
|
|
|
const LongButton({
|
|
super.key,
|
|
required this.text,
|
|
required this.icon,
|
|
required this.onPressed,
|
|
this.isLoading = false,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
BorderRadius borderRadius = BorderRadius.circular(8.0);
|
|
|
|
return Card(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
elevation: 3,
|
|
shape: RoundedRectangleBorder(borderRadius: borderRadius),
|
|
child: Material(
|
|
color: Theme.of(context).cardColor,
|
|
borderRadius: borderRadius,
|
|
child: InkWell(
|
|
borderRadius: borderRadius,
|
|
onTap: isLoading ? null : onPressed,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 28,
|
|
color: Theme.of(context).colorScheme.primary,
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Text(
|
|
text,
|
|
style: Theme.of(context).textTheme.titleMedium,
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.arrow_forward_ios_rounded,
|
|
size: 18,
|
|
color: Theme.of(context).colorScheme.primary,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|