divider_widget.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/theme/ente_theme.dart';
  3. enum DividerType {
  4. solid,
  5. menu,
  6. menuNoIcon,
  7. bottomBar,
  8. }
  9. class DividerWidget extends StatelessWidget {
  10. final DividerType dividerType;
  11. final Color bgColor;
  12. final bool divColorHasBlur;
  13. const DividerWidget({
  14. required this.dividerType,
  15. this.bgColor = Colors.transparent,
  16. this.divColorHasBlur = true,
  17. super.key,
  18. });
  19. @override
  20. Widget build(BuildContext context) {
  21. final dividerColor = divColorHasBlur
  22. ? getEnteColorScheme(context).blurStrokeFaint
  23. : getEnteColorScheme(context).strokeFaint;
  24. if (dividerType == DividerType.solid) {
  25. return Container(
  26. color: getEnteColorScheme(context).strokeFaint,
  27. width: double.infinity,
  28. height: 1,
  29. );
  30. }
  31. if (dividerType == DividerType.bottomBar) {
  32. return Container(
  33. color: dividerColor,
  34. width: double.infinity,
  35. height: 1,
  36. );
  37. }
  38. return Container(
  39. color: bgColor,
  40. child: Row(
  41. children: [
  42. SizedBox(
  43. width: dividerType == DividerType.menu
  44. ? 48
  45. : dividerType == DividerType.menuNoIcon
  46. ? 16
  47. : 0,
  48. height: 1,
  49. ),
  50. Expanded(
  51. child: Container(
  52. color: dividerColor,
  53. height: 1,
  54. width: double.infinity,
  55. ),
  56. ),
  57. ],
  58. ),
  59. );
  60. }
  61. }