social_button.dart 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_svg/svg.dart';
  3. class SocialButton extends StatelessWidget {
  4. final String type;
  5. final double width;
  6. final double height;
  7. final Function press;
  8. SocialButton({
  9. Key key,
  10. this.type,
  11. this.width = 32.0,
  12. this.height = 32.0,
  13. this.press,
  14. }) : super(key: key);
  15. String iconSrc;
  16. Color bgColor;
  17. @override
  18. Widget build(BuildContext context) {
  19. switch(type){
  20. case 'kakao':
  21. iconSrc = "assets/icons/kakao_talk_A.svg";
  22. bgColor = Color(0xFFFFE600);
  23. break;
  24. case 'naver':
  25. iconSrc = "assets/icons/naver_n.svg";
  26. bgColor = Color(0xFF4AB749);
  27. break;
  28. case 'google':
  29. iconSrc = "assets/icons/google_A.svg";
  30. bgColor = Colors.white;
  31. break;
  32. case 'facebook':
  33. iconSrc = "assets/icons/facebook.svg";
  34. bgColor = Color(0xFF3C5A99);
  35. break;
  36. }
  37. return GestureDetector(
  38. onTap: press,
  39. child: Container(
  40. margin: EdgeInsets.all(10),
  41. padding: EdgeInsets.all(5),
  42. decoration: BoxDecoration(
  43. color: bgColor,
  44. border: Border.all(
  45. width: 1,
  46. color: bgColor,
  47. ),
  48. shape: BoxShape.circle,
  49. ),
  50. child: SvgPicture.asset(
  51. iconSrc,
  52. height: width,
  53. width: height,
  54. ),
  55. ),
  56. );
  57. }
  58. }