mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 13:08:42 +00:00
fix #96
This commit is contained in:
parent
3d23948b4c
commit
3094da5c70
1 changed files with 43 additions and 2 deletions
|
|
@ -20,12 +20,13 @@ class DrawLayer extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _DrawLayerState extends State<DrawLayer> {
|
class _DrawLayerState extends State<DrawLayer> {
|
||||||
Color pickerColor = Colors.white, currentColor = Colors.white;
|
Color currentColor = Colors.red;
|
||||||
|
|
||||||
var screenshotController = ScreenshotController();
|
var screenshotController = ScreenshotController();
|
||||||
|
|
||||||
List<CubicPath> undoList = [];
|
List<CubicPath> undoList = [];
|
||||||
bool skipNextEvent = false;
|
bool skipNextEvent = false;
|
||||||
|
bool showMagnifyingGlass = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -45,7 +46,7 @@ class _DrawLayerState extends State<DrawLayer> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
double _sliderValue = 0.0;
|
double _sliderValue = 0.125;
|
||||||
|
|
||||||
final colors = [
|
final colors = [
|
||||||
Colors.white,
|
Colors.white,
|
||||||
|
|
@ -189,6 +190,16 @@ class _DrawLayerState extends State<DrawLayer> {
|
||||||
activeColor: Colors.transparent,
|
activeColor: Colors.transparent,
|
||||||
inactiveColor: Colors.transparent,
|
inactiveColor: Colors.transparent,
|
||||||
onChanged: _onSliderChanged,
|
onChanged: _onSliderChanged,
|
||||||
|
onChangeStart: (value) => {
|
||||||
|
setState(() {
|
||||||
|
showMagnifyingGlass = true;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onChangeEnd: (value) => {
|
||||||
|
setState(() {
|
||||||
|
showMagnifyingGlass = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
min: 0.0,
|
min: 0.0,
|
||||||
max: 1.0,
|
max: 1.0,
|
||||||
divisions: 100,
|
divisions: 100,
|
||||||
|
|
@ -198,6 +209,12 @@ class _DrawLayerState extends State<DrawLayer> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (showMagnifyingGlass)
|
||||||
|
Positioned(
|
||||||
|
right: 80,
|
||||||
|
top: 50 + (185 * _sliderValue),
|
||||||
|
child: MagnifyingGlass(color: currentColor),
|
||||||
|
),
|
||||||
if (!widget.layerData.isEditing)
|
if (!widget.layerData.isEditing)
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|
@ -207,3 +224,27 @@ class _DrawLayerState extends State<DrawLayer> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MagnifyingGlass extends StatelessWidget {
|
||||||
|
final Color color;
|
||||||
|
|
||||||
|
const MagnifyingGlass({super.key, required this.color});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: Colors.white,
|
||||||
|
width: 2,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue