mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-11-28 16:50:24 +08:00
* fix: prevent custom scale dialog from closing when interacting with slider Wrapped MobileCustomScaleControls in GestureDetector with opaque behavior to prevent touch events from propagating to parent dialog's clickMaskDismiss handler. The slider now works correctly without closing the dialog. Signed-off-by: Alessandro De Blasis <alex@deblasis.net> * Update flutter/lib/mobile/widgets/custom_scale_widget.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update flutter/lib/mobile/widgets/custom_scale_widget.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update flutter/lib/mobile/widgets/custom_scale_widget.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update flutter/lib/mobile/widgets/custom_scale_widget.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Revert "fix: mobile remove "Scale custom" (#13323)" This reverts commit265d08fc3b. * chore: keep remote_toolbar.dart cleanup (remove dead code) The dead code removed in265d08fc3hasn't been used since Aug 2023. Only reverting toolbar.dart is needed for the mobile Scale custom fix. * Update flutter/lib/mobile/pages/remote_page.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: Implement CustomScaleControlsMixin for shared scaling logic across mobile and desktop widgets - Introduced a new mixin `CustomScaleControlsMixin` to encapsulate custom scale control logic, allowing for code reuse in both mobile and desktop widgets. - Refactored `_CustomScaleMenuControlsState` and `_MobileCustomScaleControlsState` to utilize the new mixin, simplifying the scaling logic and reducing code duplication. - Updated slider handling and state management to leverage the mixin's methods for improved maintainability. Signed-off-by: Alessandro De Blasis <alex@deblasis.net> * Update flutter/lib/desktop/widgets/remote_toolbar.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update flutter/lib/mobile/widgets/custom_scale_widget.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update flutter/lib/mobile/pages/remote_page.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * refactor: changed from mixin to abstract class Signed-off-by: Alessandro De Blasis <alex@deblasis.net> * Revert "Update flutter/lib/mobile/pages/remote_page.dart" This reverts commit7c35897408. * refactor: remove unnecessary tap event handling in custom scale controls - Removed the `onTap` handler from the Signed-off-by: Alessandro De Blasis <alex@deblasis.net> * refactor: simplify MobileCustomScaleControls usage in remote_page.dart - Removed unnecessary GestureDetector wrapper around MobileCustomScaleControls for cleaner code. Signed-off-by: Alessandro De Blasis <alex@deblasis.net> --------- Signed-off-by: Alessandro De Blasis <alex@deblasis.net> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
71 lines
2.2 KiB
Dart
71 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hbb/models/model.dart';
|
|
import 'package:flutter_hbb/common.dart';
|
|
import 'package:flutter_hbb/common/widgets/custom_scale_base.dart';
|
|
|
|
class MobileCustomScaleControls extends StatefulWidget {
|
|
final FFI ffi;
|
|
final ValueChanged<int>? onChanged;
|
|
const MobileCustomScaleControls({super.key, required this.ffi, this.onChanged});
|
|
|
|
@override
|
|
State<MobileCustomScaleControls> createState() => _MobileCustomScaleControlsState();
|
|
}
|
|
|
|
class _MobileCustomScaleControlsState extends CustomScaleControls<MobileCustomScaleControls> {
|
|
@override
|
|
FFI get ffi => widget.ffi;
|
|
|
|
@override
|
|
ValueChanged<int>? get onScaleChanged => widget.onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// Smaller button size for mobile
|
|
const smallBtnConstraints = BoxConstraints(minWidth: 32, minHeight: 32);
|
|
|
|
final sliderControl = Slider(
|
|
value: scalePos,
|
|
min: 0.0,
|
|
max: 1.0,
|
|
divisions: (CustomScaleControls.maxPercent - CustomScaleControls.minPercent).round(),
|
|
label: '$scaleValue%',
|
|
onChanged: onSliderChanged,
|
|
);
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 8.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'${translate("Scale custom")}: $scaleValue%',
|
|
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
iconSize: 20,
|
|
padding: const EdgeInsets.all(4),
|
|
constraints: smallBtnConstraints,
|
|
icon: const Icon(Icons.remove),
|
|
tooltip: translate('Decrease'),
|
|
onPressed: () => nudgeScale(-1),
|
|
),
|
|
Expanded(child: sliderControl),
|
|
IconButton(
|
|
iconSize: 20,
|
|
padding: const EdgeInsets.all(4),
|
|
constraints: smallBtnConstraints,
|
|
icon: const Icon(Icons.add),
|
|
tooltip: translate('Increase'),
|
|
onPressed: () => nudgeScale(1),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|