import 'package:flutter/material.dart'; class OrDivider extends StatelessWidget { final String title; final Color color, textColor; OrDivider({ Key key, @required this.title, this.color = Colors.grey, this.textColor = Colors.white, }) : super(key: key); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return Container( margin: EdgeInsets.symmetric(vertical: size.height * 0.02), width: size.width * 0.8, child: Row( children: [ buildDivider(), Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Text( title, style: TextStyle( color: textColor, fontWeight: FontWeight.w600, ), ), ), buildDivider(), ], ), ); } Expanded buildDivider() { return Expanded( child: Divider( color: color, height: 1.5, ), ); } }