52 lines
1.3 KiB
Dart
52 lines
1.3 KiB
Dart
import 'dart:io';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
class PostCardPreviewWidget extends StatelessWidget {
|
|
final String imagePath;
|
|
final String message;
|
|
final String? selectedFont;
|
|
|
|
const PostCardPreviewWidget({
|
|
super.key,
|
|
required this.imagePath,
|
|
required this.message,
|
|
this.selectedFont,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: double.infinity,
|
|
height: 227.h,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(6.r),
|
|
child: Image.file(File(imagePath), fit: BoxFit.cover)),
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 🖋 Custom Painter for horizontal lines
|
|
class LinedPaperPainter extends CustomPainter {
|
|
final double lineHeight;
|
|
final double topPadding;
|
|
|
|
LinedPaperPainter({this.lineHeight = 26.0, this.topPadding = 18.0});
|
|
|
|
@override
|
|
void paint(Canvas canvas, Size size) {
|
|
final paint = Paint()
|
|
..color = const Color(0xffE6DCDC)
|
|
..strokeWidth = 1;
|
|
|
|
// Draw lines spaced evenly based on text line height
|
|
for (double y = topPadding; y < size.height; y += lineHeight) {
|
|
canvas.drawLine(Offset(0, y), Offset(size.width, y), paint);
|
|
}
|
|
}
|
|
|
|
@override
|
|
bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
|
|
}
|