notification_warning_widget.dart 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/ente_theme_data.dart';
  3. class NotificationWarningWidget extends StatelessWidget {
  4. final IconData warningIcon;
  5. final IconData actionIcon;
  6. final String text;
  7. final GestureTapCallback onTap;
  8. const NotificationWarningWidget({
  9. Key? key,
  10. required this.warningIcon,
  11. required this.actionIcon,
  12. required this.text,
  13. required this.onTap,
  14. }) : super(key: key);
  15. @override
  16. Widget build(BuildContext context) {
  17. return Center(
  18. child: GestureDetector(
  19. onTap: onTap,
  20. child: Padding(
  21. padding: const EdgeInsets.all(10.0),
  22. child: Container(
  23. decoration: BoxDecoration(
  24. borderRadius: const BorderRadius.all(
  25. Radius.circular(8),
  26. ),
  27. boxShadow: Theme.of(context).colorScheme.shadowMenu,
  28. color: Theme.of(context).colorScheme.warning500,
  29. ),
  30. child: Padding(
  31. padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
  32. child: Row(
  33. children: [
  34. Icon(
  35. warningIcon,
  36. size: 36,
  37. color: Colors.white,
  38. ),
  39. const SizedBox(width: 10),
  40. Flexible(
  41. child: Text(
  42. text,
  43. style: const TextStyle(height: 1.4, color: Colors.white),
  44. textAlign: TextAlign.left,
  45. ),
  46. ),
  47. const SizedBox(width: 10),
  48. ClipOval(
  49. child: Material(
  50. color: Theme.of(context).colorScheme.fillFaint,
  51. child: InkWell(
  52. splashColor: Colors.red, // Splash color
  53. onTap: onTap,
  54. child: SizedBox(
  55. width: 40,
  56. height: 40,
  57. child: Icon(
  58. actionIcon,
  59. color: Colors.white,
  60. ),
  61. ),
  62. ),
  63. ),
  64. ),
  65. ],
  66. ),
  67. ),
  68. ),
  69. ),
  70. ),
  71. );
  72. }
  73. }