screenshots, changelog adjustments

This commit is contained in:
Jonas Bark
2026-06-30 09:51:46 +02:00
parent bca8fee0be
commit b99d54f6ee
7 changed files with 215 additions and 45 deletions

View File

@@ -1,6 +1,6 @@
### 6.2.0 (26-06-2026)
**Features**:
- Virtual front derailleur: adds a second chainring (2× drivetrain) for more realism. The new assignable "Front Shift (Chainring)" action — or pressing both shifters together, SRAM-AXS style — toggles between your small and large rings, changing resistance by the exact chainring ratio while staying on the same rear cog. While it's active your current gear reads as head-unit-style position notation (e.g. 2×14) in the app, the gear overlay, and the iOS Live Activity. Set your chainring sizes per trainer in the gear settings.
- Virtual front derailleur: adds a second chainring (2× drivetrain) for more realism. The new assignable "Front Shift (Chainring)" action toggles between your small and large rings, changing resistance by the exact chainring ratio while staying on the same rear cog.
- SRAM style shifting: when you click shift up & down at the same time, the front chainring switches
- iOS / iPadOS: Floating gear overlay (Picture-in-Picture): your current gear can now show in a floating window over your trainer app during a ride.
- Screen recording: a new assignable "Record Screen" action starts a screen recording from a controller button.

View File

@@ -139,49 +139,7 @@ class _GearRatiosEditorPageState extends State<GearRatiosEditorPage> {
Widget _heroCurve(BuildContext context) => GearRatioCurve(definition: def);
Widget _vsModeCard() {
return AnimatedBuilder(
animation: Listenable.merge([def.virtualShiftingMode, def.trainerFeature]),
builder: (context, _) {
final mode = def.virtualShiftingMode.value;
return SettingTile(
title: AppLocalizations.of(context).virtualShiftingMode,
subtitle: AppLocalizations.of(context).virtualShiftingModeDesc,
child: RadioGroup<VirtualShiftingMode>(
value: mode,
onChanged: (v) async {
def.setVirtualShiftingMode(v);
await _updateActive((c) => c.copyWith(mode: v));
},
child: Row(
spacing: 6,
children: [
_vsRadioCard(AppLocalizations.of(context).targetPowerMode, VirtualShiftingMode.targetPower),
_vsRadioCard(AppLocalizations.of(context).trackResistanceMode, VirtualShiftingMode.trackResistance),
_vsRadioCard(AppLocalizations.of(context).basicMode, VirtualShiftingMode.basicResistance),
],
),
),
);
},
);
}
Widget _vsRadioCard(String label, VirtualShiftingMode value) {
final supported = def.supportsVirtualShiftingMode(value);
return Expanded(
child: RadioCard<VirtualShiftingMode>(
value: value,
enabled: supported,
child: Center(
child: Text(
label,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
),
),
),
);
}
Widget _vsModeCard() => VirtualShiftingModeCard(definition: def, device: widget.device);
Widget _gearCountCard(BuildContext context) {
final cs = Theme.of(context).colorScheme;
@@ -556,3 +514,67 @@ class _Preset {
final List<double> values;
_Preset({required this.label, required this.range, required this.values});
}
/// The Virtual Shifting mode selector (Target Power / Track Resistance / Basic),
/// extracted from [GearRatiosEditorPage] so it can be rendered standalone (e.g.
/// for a widget snapshot). It reads/writes the same [core.shiftingConfigs] and
/// the passed [definition], so behaviour inside the page is unchanged.
class VirtualShiftingModeCard extends StatelessWidget {
final FitnessBikeDefinition definition;
final ProxyDevice device;
const VirtualShiftingModeCard({
super.key,
required this.definition,
required this.device,
});
Future<void> _updateActive(ShiftingConfig Function(ShiftingConfig) mutate) async {
final current = core.shiftingConfigs.activeFor(device.trainerKey);
await core.shiftingConfigs.upsert(mutate(current));
}
Widget _vsRadioCard(String label, VirtualShiftingMode value) {
final supported = definition.supportsVirtualShiftingMode(value);
return Expanded(
child: RadioCard<VirtualShiftingMode>(
value: value,
enabled: supported,
child: Center(
child: Text(
label,
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w600),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: Listenable.merge([definition.virtualShiftingMode, definition.trainerFeature]),
builder: (context, _) {
final mode = definition.virtualShiftingMode.value;
return SettingTile(
title: AppLocalizations.of(context).virtualShiftingMode,
subtitle: AppLocalizations.of(context).virtualShiftingModeDesc,
child: RadioGroup<VirtualShiftingMode>(
value: mode,
onChanged: (v) async {
definition.setVirtualShiftingMode(v);
await _updateActive((c) => c.copyWith(mode: v));
},
child: Row(
spacing: 6,
children: [
_vsRadioCard(AppLocalizations.of(context).targetPowerMode, VirtualShiftingMode.targetPower),
_vsRadioCard(AppLocalizations.of(context).trackResistanceMode, VirtualShiftingMode.trackResistance),
_vsRadioCard(AppLocalizations.of(context).basicMode, VirtualShiftingMode.basicResistance),
],
),
),
);
},
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
screenshots/en/vs-mode.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -22,6 +22,11 @@ import 'package:bike_control/pages/overview.dart';
import 'package:bike_control/pages/proxy_device_details.dart';
import 'package:bike_control/pages/proxy_device_details/front_shift_card.dart';
import 'package:bike_control/pages/proxy_device_details/gear_ratios_editor_page.dart';
import 'package:bike_control/pages/proxy_device_details/overlay_settings_section.dart';
import 'package:bike_control/pages/proxy_device_details/shifting_config_picker.dart';
import 'package:bike_control/pages/proxy_device_details/trainer_settings_section.dart';
import 'package:bike_control/models/shifting_config.dart';
import 'package:bike_control/services/overlay/trainer_overlay_service.dart';
import 'package:bike_control/pages/trainer_connection_settings.dart';
import 'package:bike_control/utils/core.dart' show core;
import 'package:bike_control/utils/iap/iap_manager.dart';
@@ -47,6 +52,7 @@ import 'package:bike_control/widgets/controller/controller_canvas.dart';
import 'package:bike_control/widgets/overlay/trainer_overlay_view.dart';
import 'package:bike_control/widgets/ui/animated_button_widget.dart';
import 'package:flutter/material.dart' as ma;
import 'package:flutter/services.dart' show MethodChannel;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_screenshot/golden_screenshot.dart' hide testGoldens;
@@ -354,8 +360,13 @@ Future<void> main() async {
Finder Function()? capture,
Future<void> Function(WidgetTester tester)? afterPump,
TargetPlatform platform = TargetPlatform.android,
// Override the (frameless) render resolution. Defaults to the noFrame size
// (~367 logical px wide); pass a wider Size for widgets that need more room
// (e.g. a Row whose Select would collapse at phone-narrow widths).
Size? size,
}) async {
final nf = sizes.firstWhere((s) => s.type == DeviceType.noFrame);
final res = size ?? nf.size;
await AppLocalizations.load(const Locale('en'));
screenshotLocale = const Locale('en');
await tester.pumpWidget(
@@ -366,7 +377,7 @@ Future<void> main() async {
// queries the Windows accent colour via advapi32.dll, which can't load
// on a macOS test host.
platform: platform,
resolution: nf.size,
resolution: res,
pixelRatio: 3,
goldenSubFolder: 'iphoneScreenshots/',
frameBuilder:
@@ -1091,4 +1102,141 @@ Future<void> main() async {
testGoldens('overview-thinkrider-vs200', (WidgetTester tester) async {
await shootOverview(tester, 'overview-thinkrider-vs200', thinkriderVs200);
});
// --- Virtual-shifting settings widget snapshots (settings video) -------------
// Tight single-widget captures of the virtual-shifting settings controls, each
// rendered standalone inside a keyed RepaintBoundary (English, light) so the
// golden captures ONLY that widget (no page chrome).
// Seed a few NAMED shifting configs for the proxy trainer, with "Climb day"
// active, so the picker and the settings sections show genuine content.
Future<void> seedShiftingConfigs() async {
final key = proxy.trainerKey;
await core.shiftingConfigs.upsert(
ShiftingConfig.defaults(trainerKey: key, name: 'Default', isActive: false),
);
await core.shiftingConfigs.upsert(
ShiftingConfig.defaults(trainerKey: key, name: 'Sprint', isActive: false)
.copyWith(riderWeightKg: 72, bikeWeightKg: 7.5),
);
await core.shiftingConfigs.upsert(
ShiftingConfig.defaults(trainerKey: key, name: 'Climb day', isActive: true)
.copyWith(riderWeightKg: 78, bikeWeightKg: 8.5),
);
}
// 1) The named-config picker (active "Climb day" + New / Manage buttons).
testGoldens('shifting-config-picker', (WidgetTester tester) async {
await seedShiftingConfigs();
const k = ValueKey('shot');
await shootOne(
tester,
'shifting-config-picker',
() => BikeControlApp(
customChild: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: RepaintBoundary(
key: k,
child: ShiftingConfigPicker(trainerKey: proxy.trainerKey),
),
),
),
),
capture: () => find.byKey(k),
size: const Size(1980, 2390),
);
});
// 2) Ride-feel / trainer settings: the config picker + gear settings card +
// bike-weight + rider-weight steppers.
testGoldens('ride-feel', (WidgetTester tester) async {
await seedShiftingConfigs();
proxy.debugAttachFitnessBike(fbd);
const k = ValueKey('shot');
await shootOne(
tester,
'ride-feel',
() => BikeControlApp(
customChild: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: RepaintBoundary(
key: k,
child: TrainerSettingsSection(definition: fbd, device: proxy),
),
),
),
),
capture: () => find.byKey(k),
// Wide enough that the embedded config picker's Select shows the active
// config name on one line (it sizes to its Expanded slot, which collapses
// at phone-narrow widths).
size: const Size(1980, 2390),
);
});
// 3) Overlay settings: the enable tile + the display-field toggles (Power /
// Cadence / ERG / Gear / Controls). The field list only renders while the
// overlay is "showing", so flip the platform controller (the same singleton
// the section reads in initState) on up front.
testGoldens('overlay-settings', (WidgetTester tester) async {
proxy.debugAttachFitnessBike(fbd);
// The desktop overlay controller opens a native window via this method
// channel; stub it so show() (used below to expand the field list) doesn't
// throw MissingPluginException in the host test VM.
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
const MethodChannel('com.coditas.multi_window_native/pluginChannel'),
(call) async => null,
);
await core.settings.setOverlayFields({
OverlayField.power,
OverlayField.cadence,
OverlayField.gearRatio,
});
await TrainerOverlayService.forCurrentPlatform()
.show(fbd, core.settings.getOverlayFields());
const k = ValueKey('shot');
await shootOne(
tester,
'overlay-settings',
() => BikeControlApp(
customChild: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: RepaintBoundary(
key: k,
child: OverlaySettingsSection(definition: fbd, device: proxy),
),
),
),
),
capture: () => find.byKey(k),
);
});
// 4) The Virtual Shifting mode selector (Target Power / Track Resistance /
// Basic radio group), extracted from GearRatiosEditorPage as a public widget.
testGoldens('vs-mode', (WidgetTester tester) async {
await seedShiftingConfigs();
proxy.debugAttachFitnessBike(fbd);
fbd.setVirtualShiftingMode(VirtualShiftingMode.targetPower);
const k = ValueKey('shot');
await shootOne(
tester,
'vs-mode',
() => BikeControlApp(
customChild: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20),
child: RepaintBoundary(
key: k,
child: VirtualShiftingModeCard(definition: fbd, device: proxy),
),
),
),
),
capture: () => find.byKey(k),
);
});
}