Complete refactor to clean up project
This commit is contained in:
42
lib/features/sheet_viewer/widgets/paint_mode_layer.dart
Normal file
42
lib/features/sheet_viewer/widgets/paint_mode_layer.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_drawing_board/flutter_drawing_board.dart';
|
||||
|
||||
import 'pdf_page_display.dart';
|
||||
|
||||
/// Drawing overlay for annotating PDF pages.
|
||||
///
|
||||
/// Uses flutter_drawing_board to provide a paint canvas over the PDF.
|
||||
/// Only available in single-page mode.
|
||||
class PaintModeLayer extends StatelessWidget {
|
||||
final PdfPageDisplay pageDisplay;
|
||||
|
||||
const PaintModeLayer({
|
||||
super.key,
|
||||
required this.pageDisplay,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox.expand(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final maxSize = Size(constraints.maxWidth, constraints.maxHeight);
|
||||
final (pageSize, _) = pageDisplay.calculateScaledPageSizes(maxSize);
|
||||
|
||||
return DrawingBoard(
|
||||
background: SizedBox(
|
||||
width: pageSize.width,
|
||||
height: pageSize.height,
|
||||
child: pageDisplay,
|
||||
),
|
||||
boardConstrained: true,
|
||||
minScale: 1,
|
||||
maxScale: 3,
|
||||
alignment: Alignment.topRight,
|
||||
boardBoundaryMargin: EdgeInsets.zero,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user