gradientButton.dart 743 B

1234567891011121314151617181920212223242526272829
  1. import 'package:flutter/material.dart';
  2. class GradientButton extends StatelessWidget {
  3. final Widget child;
  4. final List<Color> linearGradientColors;
  5. final Function onTap;
  6. GradientButton({Key key, this.child, this.linearGradientColors, this.onTap})
  7. : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. return InkWell(
  11. onTap: onTap,
  12. child: Container(
  13. height: 56,
  14. decoration: BoxDecoration(
  15. gradient: LinearGradient(
  16. begin: Alignment(0.1, -0.9),
  17. end: Alignment(-0.6, 0.9),
  18. colors: linearGradientColors,
  19. ),
  20. borderRadius: BorderRadius.circular(8),
  21. ),
  22. child: Center(child: child),
  23. ),
  24. );
  25. }
  26. }