gradientButton.dart 737 B

12345678910111213141516171819202122232425262728
  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}) : super(key: key);
  7. @override
  8. Widget build(BuildContext context) {
  9. return InkWell(
  10. onTap: onTap,
  11. child: Container(
  12. height: 56,
  13. decoration: BoxDecoration(
  14. gradient: LinearGradient(
  15. begin: Alignment(0.1, -0.9),
  16. end: Alignment(-0.6, 0.9),
  17. colors: linearGradientColors,
  18. ),
  19. borderRadius: BorderRadius.circular(8),
  20. ),
  21. child: Center(child: child),
  22. ),
  23. );
  24. }
  25. }