ExtendButton.dart 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. class ExtendButton extends StatelessWidget {
  4. ExtendButton(
  5. {this.imgUrl = "",
  6. this.tips = "",
  7. this.onTap,
  8. this.imgHieght = 0,
  9. this.imgColor,
  10. Key? key})
  11. : super(key: key);
  12. final String imgUrl;
  13. final double imgHieght;
  14. final Color? imgColor;
  15. final String tips;
  16. final GestureTapCallback? onTap;
  17. @override
  18. Widget build(BuildContext context) {
  19. return InkWell(
  20. onTap: () {
  21. this.onTap!();
  22. },
  23. child: Column(
  24. mainAxisAlignment: MainAxisAlignment.center,
  25. children: [
  26. Image.asset(
  27. imgUrl,
  28. height: imgHieght > 0 ? this.imgHieght : 52.0,
  29. color: imgColor != null ? imgColor : null,
  30. ),
  31. Container(
  32. margin: EdgeInsets.only(top: 10),
  33. child: Text(
  34. tips,
  35. style: TextStyle(fontSize: 12, color: Colors.white),
  36. ),
  37. ),
  38. ],
  39. ),
  40. );
  41. }
  42. }