|
@@ -9,6 +9,9 @@ class _ContrastToneBarState extends State<_ContrastToneBar> {
|
|
|
late final measureController = Get.find<MeasureController>();
|
|
|
VidPlayerController playerController =
|
|
|
Get.find<IPlayerController>() as VidPlayerController;
|
|
|
+
|
|
|
+ ///屏幕缩放比例
|
|
|
+ double get devicePixelRatio => MediaQuery.of(context).devicePixelRatio;
|
|
|
double curValue = 0;
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -34,9 +37,10 @@ class _ContrastToneBarState extends State<_ContrastToneBar> {
|
|
|
max: 100,
|
|
|
min: -100,
|
|
|
value: curValue,
|
|
|
- icon: const Icon(
|
|
|
+ icon: Icon(
|
|
|
Icons.contrast,
|
|
|
color: Colors.white,
|
|
|
+ size: 24 / devicePixelRatio,
|
|
|
),
|
|
|
onChange: (v) {
|
|
|
playerController.setContrast(v.toInt());
|
|
@@ -73,6 +77,9 @@ class _BrightnessToneBarState extends State<_BrightnessToneBar> {
|
|
|
late final measureController = Get.find<MeasureController>();
|
|
|
VidPlayerController playerController =
|
|
|
Get.find<IPlayerController>() as VidPlayerController;
|
|
|
+
|
|
|
+ ///屏幕缩放比例
|
|
|
+ double get devicePixelRatio => MediaQuery.of(context).devicePixelRatio;
|
|
|
double curValue = 0;
|
|
|
@override
|
|
|
void initState() {
|
|
@@ -98,9 +105,10 @@ class _BrightnessToneBarState extends State<_BrightnessToneBar> {
|
|
|
max: 100,
|
|
|
min: -100,
|
|
|
value: curValue,
|
|
|
- icon: const Icon(
|
|
|
+ icon: Icon(
|
|
|
Icons.wb_sunny_sharp,
|
|
|
color: Colors.white,
|
|
|
+ size: 24 / devicePixelRatio,
|
|
|
),
|
|
|
onChange: (v) {
|
|
|
playerController.setBrightness(v.toInt());
|
|
@@ -150,9 +158,9 @@ class _ToneBar extends StatefulWidget {
|
|
|
}
|
|
|
|
|
|
class _ToneBarState extends State<_ToneBar> {
|
|
|
- static const _kIconSize = 20.0;
|
|
|
- static const splashRadius = _kIconSize / 2 + 3;
|
|
|
-
|
|
|
+ double get _kIconSize => 20.0 / devicePixelRatio;
|
|
|
+ double get splashRadius => _kIconSize / 2 + 3;
|
|
|
+ double get devicePixelRatio => MediaQuery.of(context).devicePixelRatio;
|
|
|
late double _value;
|
|
|
|
|
|
@override
|
|
@@ -183,7 +191,7 @@ class _ToneBarState extends State<_ToneBar> {
|
|
|
buildIncreaseIcon(),
|
|
|
const SizedBox(width: 8),
|
|
|
SizedBox(
|
|
|
- width: 30,
|
|
|
+ width: 30 / devicePixelRatio,
|
|
|
child: Text(
|
|
|
'${_value.toInt()}',
|
|
|
style: TextStyle(color: widget.themeColor),
|
|
@@ -195,7 +203,7 @@ class _ToneBarState extends State<_ToneBar> {
|
|
|
Widget buildReduceIcon() {
|
|
|
return IconButton(
|
|
|
color: widget.themeColor,
|
|
|
- constraints: const BoxConstraints(
|
|
|
+ constraints: BoxConstraints(
|
|
|
minHeight: _kIconSize,
|
|
|
minWidth: _kIconSize,
|
|
|
),
|
|
@@ -204,14 +212,14 @@ class _ToneBarState extends State<_ToneBar> {
|
|
|
onPressed: () {
|
|
|
updateValue(_value - 1);
|
|
|
},
|
|
|
- icon: const Icon(Icons.remove_circle_outline, size: _kIconSize),
|
|
|
+ icon: Icon(Icons.remove_circle_outline, size: _kIconSize),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
Widget buildIncreaseIcon() {
|
|
|
return IconButton(
|
|
|
color: widget.themeColor,
|
|
|
- constraints: const BoxConstraints(
|
|
|
+ constraints: BoxConstraints(
|
|
|
minHeight: _kIconSize,
|
|
|
minWidth: _kIconSize,
|
|
|
),
|
|
@@ -220,37 +228,40 @@ class _ToneBarState extends State<_ToneBar> {
|
|
|
onPressed: () {
|
|
|
updateValue(_value + 1);
|
|
|
},
|
|
|
- icon: const Icon(Icons.add_circle_outline, size: _kIconSize),
|
|
|
+ icon: Icon(Icons.add_circle_outline, size: _kIconSize),
|
|
|
);
|
|
|
}
|
|
|
|
|
|
Widget buildSlider(BuildContext context) {
|
|
|
final trackColor = Theme.of(context).primaryColor;
|
|
|
- return SliderTheme(
|
|
|
- data: SliderThemeData(
|
|
|
- trackHeight: 4,
|
|
|
- activeTrackColor: trackColor,
|
|
|
- inactiveTrackColor: trackColor,
|
|
|
- thumbColor: Colors.grey[300],
|
|
|
- thumbShape: const RoundSliderThumbShape(
|
|
|
- enabledThumbRadius: 6,
|
|
|
- elevation: 3.0,
|
|
|
+ return Expanded(
|
|
|
+ child: SliderTheme(
|
|
|
+ data: SliderThemeData(
|
|
|
+ trackHeight: 4,
|
|
|
+ activeTrackColor: trackColor,
|
|
|
+ inactiveTrackColor: trackColor,
|
|
|
+ thumbColor: Colors.grey[300],
|
|
|
+ thumbShape: const RoundSliderThumbShape(
|
|
|
+ enabledThumbRadius: 6,
|
|
|
+ elevation: 3.0,
|
|
|
+ ),
|
|
|
+ overlayShape: SliderComponentShape.noOverlay,
|
|
|
+ trackShape: _FullWidthRectangularSliderTrackShape(
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
|
+ devicePixelRatio: devicePixelRatio,
|
|
|
+ ),
|
|
|
),
|
|
|
- overlayShape: SliderComponentShape.noOverlay,
|
|
|
- trackShape: const _FullWidthRectangularSliderTrackShape(
|
|
|
- padding: EdgeInsets.symmetric(horizontal: 4),
|
|
|
+ child: Slider(
|
|
|
+ max: widget.max,
|
|
|
+ min: widget.min,
|
|
|
+ value: _value,
|
|
|
+ label: _value.toInt().toString(),
|
|
|
+ divisions: (widget.max - widget.min).toInt(),
|
|
|
+ onChanged: (v) {
|
|
|
+ updateValue(v);
|
|
|
+ },
|
|
|
),
|
|
|
),
|
|
|
- child: Slider(
|
|
|
- max: widget.max,
|
|
|
- min: widget.min,
|
|
|
- value: _value,
|
|
|
- label: _value.toInt().toString(),
|
|
|
- divisions: (widget.max - widget.min).toInt(),
|
|
|
- onChanged: (v) {
|
|
|
- updateValue(v);
|
|
|
- },
|
|
|
- ),
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -267,10 +278,15 @@ class _ToneBarState extends State<_ToneBar> {
|
|
|
|
|
|
class _FullWidthRectangularSliderTrackShape
|
|
|
extends RectangularSliderTrackShape {
|
|
|
- const _FullWidthRectangularSliderTrackShape({this.padding});
|
|
|
+ const _FullWidthRectangularSliderTrackShape({
|
|
|
+ this.padding,
|
|
|
+ this.devicePixelRatio = 1,
|
|
|
+ });
|
|
|
|
|
|
final EdgeInsets? padding;
|
|
|
|
|
|
+ final double devicePixelRatio;
|
|
|
+
|
|
|
@override
|
|
|
Rect getPreferredRect({
|
|
|
required RenderBox parentBox,
|
|
@@ -307,7 +323,10 @@ class _ResetToneButton extends StatelessWidget {
|
|
|
},
|
|
|
child: Text(
|
|
|
i18nBook.measure.resetTone4Btn.t,
|
|
|
- style: const TextStyle(color: Colors.white),
|
|
|
+ style: const TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 16,
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|