ar_tourism_flutter_unity/lib/components/gradientButton.dart
2025-05-14 17:04:13 +08:00

49 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
class GradientButton extends StatelessWidget {
final String text;
final VoidCallback? onPressed;
final double width;
final double height;
const GradientButton({
super.key,
this.width = 330,
this.height = 45,
required this.text,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return Align(
child: Container(
height: height,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
gradient: const LinearGradient(colors: [
Color(0xff80DAA4),
Color(0xff79DDED),
]),
),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
elevation: 0,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(8)),
),
minimumSize: const Size(double.infinity, 50),
padding: const EdgeInsets.symmetric(horizontal: 20),
),
onPressed: onPressed,
child: Text(
text,
style: const TextStyle(color: Colors.black, fontSize: 16),
),
),
),
);
}
}