flutter_desktop: change cursor on scroll auto
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
d8f16a523e
commit
adafa38cfa
@ -537,8 +537,17 @@ class ImagePaint extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final m = Provider.of<ImageModel>(context);
|
||||
var c = Provider.of<CanvasModel>(context);
|
||||
|
||||
final s = c.scale;
|
||||
|
||||
mouseRegion({child}) => Obx(() => MouseRegion(
|
||||
cursor: (cursorOverImage.isTrue && keyboardEnabled.isTrue)
|
||||
? (remoteCursorMoved.isTrue
|
||||
? SystemMouseCursors.none
|
||||
: _buildCustomCursorLinux(context, s))
|
||||
: MouseCursor.defer,
|
||||
onHover: (evt) {},
|
||||
child: child));
|
||||
|
||||
if (c.scrollStyle == ScrollStyle.scrollbar) {
|
||||
final imageWidget = SizedBox(
|
||||
width: c.getDisplayWidth() * s,
|
||||
@ -547,7 +556,6 @@ class ImagePaint extends StatelessWidget {
|
||||
painter: ImagePainter(image: m.image, x: 0, y: 0, scale: s),
|
||||
));
|
||||
|
||||
Rx<Offset> pos = Rx<Offset>(const Offset(0.0, 0.0));
|
||||
return Center(
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (notification) {
|
||||
@ -562,16 +570,8 @@ class ImagePaint extends StatelessWidget {
|
||||
c.setScrollPercent(percentX, percentY);
|
||||
return false;
|
||||
},
|
||||
child: Obx(() => MouseRegion(
|
||||
cursor: (cursorOverImage.isTrue && keyboardEnabled.isTrue)
|
||||
? (remoteCursorMoved.isTrue
|
||||
? SystemMouseCursors.none
|
||||
: _buildCustomCursorLinux(context, s))
|
||||
: MouseCursor.defer,
|
||||
onHover: (evt) {
|
||||
pos.value = evt.position;
|
||||
},
|
||||
child: _buildCrossScrollbar(_buildListener(imageWidget)))),
|
||||
child: mouseRegion(
|
||||
child: _buildCrossScrollbar(_buildListener(imageWidget))),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@ -582,7 +582,7 @@ class ImagePaint extends StatelessWidget {
|
||||
painter:
|
||||
ImagePainter(image: m.image, x: c.x / s, y: c.y / s, scale: s),
|
||||
));
|
||||
return _buildListener(imageWidget);
|
||||
return mouseRegion(child: _buildListener(imageWidget));
|
||||
}
|
||||
}
|
||||
|
||||
@ -594,6 +594,8 @@ class ImagePaint extends StatelessWidget {
|
||||
} else {
|
||||
final key = cacheLinux.key(scale);
|
||||
cursor.addKeyLinux(key);
|
||||
// debugPrint(
|
||||
// 'REMOVE ME ================================= linux curor key: $key');
|
||||
return FlutterCustomMemoryImageCursor(
|
||||
pixbuf: cacheLinux.data,
|
||||
key: key,
|
||||
|
@ -8,7 +8,7 @@ import './material_mod_popup_menu.dart' as mod_menu;
|
||||
|
||||
// https://stackoverflow.com/questions/68318314/flutter-popup-menu-inside-popup-menu
|
||||
class PopupMenuChildrenItem<T> extends mod_menu.PopupMenuEntry<T> {
|
||||
PopupMenuChildrenItem({
|
||||
const PopupMenuChildrenItem({
|
||||
key,
|
||||
this.height = kMinInteractiveDimension,
|
||||
this.padding,
|
||||
|
Loading…
x
Reference in New Issue
Block a user