3933ff980c
Keep the Material settings implementation while preserving public Cupertino parameters for later cleanup. Narrow settings tests to the Material-only behavior.
44 lines
1.4 KiB
Dart
44 lines
1.4 KiB
Dart
import 'dart:async';
|
|
import 'package:flutter/material.dart';
|
|
import '../../ui/motion/quick_switch_animation.dart';
|
|
import 'settings_theme.dart';
|
|
import 'quick_switch_preview.dart';
|
|
|
|
class SettingsQuickSwitchControl extends StatelessWidget {
|
|
const SettingsQuickSwitchControl({super.key, required this.controller});
|
|
final QuickSwitchAnimationController controller;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ListenableBuilder(
|
|
listenable: controller,
|
|
builder: (context, _) => Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Text(
|
|
'Quick switch animation',
|
|
style: settingsTextStyle(context, title: true),
|
|
),
|
|
DropdownButton<QuickSwitchAnimation>(
|
|
value: controller.value,
|
|
isExpanded: true,
|
|
items: [
|
|
for (final animation in QuickSwitchAnimation.values)
|
|
DropdownMenuItem(value: animation, child: Text(animation.label)),
|
|
],
|
|
onChanged: (value) {
|
|
if (value != null) unawaited(controller.setAnimation(value));
|
|
},
|
|
),
|
|
Text(controller.value.description),
|
|
const SizedBox(height: 8),
|
|
QuickSwitchPreview(animation: controller.value),
|
|
if (controller.saveFailed)
|
|
Text(
|
|
'Could not save; applies until reload.',
|
|
style: TextStyle(color: settingsErrorColor(context)),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|