my_card.dart 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/res/colors.dart';
  3. import 'package:liftmanager/utils/theme_utils.dart';
  4. class MyCard extends StatelessWidget {
  5. const MyCard({
  6. Key key,
  7. @required this.child,
  8. this.color,
  9. this.shadowColor
  10. }): super(key: key);
  11. final Widget child;
  12. final Color color;
  13. final Color shadowColor;
  14. @override
  15. Widget build(BuildContext context) {
  16. Color _backgroundColor;
  17. Color _shadowColor;
  18. if (color == null){
  19. _backgroundColor = Colors.white;
  20. }else{
  21. _backgroundColor = color;
  22. }
  23. if (shadowColor == null){
  24. _shadowColor = const Color(0x80DCE7FA);
  25. }else{
  26. _shadowColor = shadowColor;
  27. }
  28. return DecoratedBox(
  29. decoration: BoxDecoration(
  30. color: _backgroundColor,
  31. borderRadius: BorderRadius.circular(8.0),
  32. boxShadow: [
  33. BoxShadow(color: _shadowColor, offset: Offset(0.0, 2.0), blurRadius: 8.0, spreadRadius: 0.0),
  34. ]
  35. ),
  36. child: child,
  37. );
  38. }
  39. }