divider_with_text.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // lib/app/widgets/divider_with_text.dart
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:nomo/config/theme/theme_extensions/theme_extension.dart';
  5. class DividerWithText extends StatelessWidget {
  6. final String text;
  7. final double height;
  8. final Color? dividerColor;
  9. final Color? textColor;
  10. final double dividerThickness;
  11. final EdgeInsets padding;
  12. const DividerWithText({
  13. super.key,
  14. this.text = 'Or',
  15. this.height = 16.0,
  16. this.dividerColor,
  17. this.textColor,
  18. this.dividerThickness = 1.0,
  19. this.padding = const EdgeInsets.symmetric(horizontal: 24.0),
  20. });
  21. @override
  22. Widget build(BuildContext context) {
  23. return Padding(
  24. padding: padding,
  25. child: Row(
  26. children: [
  27. Expanded(
  28. child: Divider(
  29. height: height,
  30. thickness: dividerThickness,
  31. color: dividerColor ?? Get.reactiveTheme.dividerColor,
  32. ),
  33. ),
  34. Padding(
  35. padding: const EdgeInsets.symmetric(horizontal: 16.0),
  36. child: Text(
  37. text,
  38. style: TextStyle(
  39. color:
  40. textColor ?? Get.reactiveTheme.textTheme.bodyLarge!.color,
  41. fontSize: 14,
  42. ),
  43. ),
  44. ),
  45. Expanded(
  46. child: Divider(
  47. height: height,
  48. thickness: dividerThickness,
  49. color: dividerColor ?? Colors.grey[400],
  50. ),
  51. ),
  52. ],
  53. ),
  54. );
  55. }
  56. }