Add eraser
This commit is contained in:
@@ -43,13 +43,24 @@ class DrawingToolbar extends StatelessWidget {
|
||||
...PaintPreset.quickAccess.map((preset) => _buildPresetButton(
|
||||
context,
|
||||
preset,
|
||||
isSelected: controller.currentPreset == preset,
|
||||
isSelected: !controller.isEraserMode &&
|
||||
controller.currentPreset == preset,
|
||||
)),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
_buildDivider(context),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// Eraser button
|
||||
_buildEraserButton(
|
||||
context,
|
||||
isSelected: controller.isEraserMode,
|
||||
),
|
||||
|
||||
const SizedBox(width: 8),
|
||||
_buildDivider(context),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
// Undo button
|
||||
_buildActionButton(
|
||||
context,
|
||||
@@ -127,6 +138,37 @@ class DrawingToolbar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEraserButton(
|
||||
BuildContext context, {
|
||||
required bool isSelected,
|
||||
}) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return Tooltip(
|
||||
message: 'Eraser',
|
||||
child: InkWell(
|
||||
onTap: () => controller.setEraserMode(true),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
child: Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 2),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
border: isSelected
|
||||
? Border.all(color: colorScheme.primary, width: 2)
|
||||
: null,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.auto_fix_high,
|
||||
size: 20,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildActionButton(
|
||||
BuildContext context, {
|
||||
required IconData icon,
|
||||
|
||||
Reference in New Issue
Block a user