didvan-app/lib/views/widgets/text_divider.dart

53 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
class TextDivider extends StatelessWidget {
final String text;
final Color? textColor;
final Color? lineColor;
final TextStyle? textStyle;
final double? lineThickness;
final EdgeInsets? padding;
const TextDivider({
Key? key,
required this.text,
this.textColor,
this.lineColor,
this.textStyle,
this.lineThickness,
this.padding,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: padding ?? const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Row(
children: [
Expanded(
child: Divider(
color: lineColor ?? Theme.of(context).dividerColor,
thickness: lineThickness ?? 1.0,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
text,
style: textStyle ?? Theme.of(context).textTheme.bodyMedium?.copyWith(
color: textColor ?? Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: Divider(
color: lineColor ?? Theme.of(context).dividerColor,
thickness: lineThickness ?? 1.0,
),
),
],
),
);
}
}