or_divider.dart 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:flutter/material.dart';
  2. class OrDivider extends StatelessWidget {
  3. final String title;
  4. final Color color, textColor;
  5. OrDivider({
  6. Key key,
  7. @required this.title,
  8. this.color = Colors.grey,
  9. this.textColor = Colors.white,
  10. }) : super(key: key);
  11. @override
  12. Widget build(BuildContext context) {
  13. Size size = MediaQuery.of(context).size;
  14. return Container(
  15. margin: EdgeInsets.symmetric(vertical: size.height * 0.02),
  16. width: size.width * 0.8,
  17. child: Row(
  18. children: <Widget>[
  19. buildDivider(),
  20. Padding(
  21. padding: const EdgeInsets.symmetric(horizontal: 10),
  22. child: Text(
  23. title,
  24. style: TextStyle(
  25. color: textColor,
  26. fontWeight: FontWeight.w600,
  27. ),
  28. ),
  29. ),
  30. buildDivider(),
  31. ],
  32. ),
  33. );
  34. }
  35. Expanded buildDivider() {
  36. return Expanded(
  37. child: Divider(
  38. color: color,
  39. height: 1.5,
  40. ),
  41. );
  42. }
  43. }