new UI + new targets.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import '../theme/app_theme.dart';
|
||||
import '../utils/format.dart';
|
||||
import 'camera_sheet.dart';
|
||||
import 'ui.dart';
|
||||
|
||||
enum ImageFilterType { none, greyscale, invert, highContrast }
|
||||
|
||||
@@ -104,7 +107,6 @@ Future<void> showImageSettingsSheet(
|
||||
required ImageAdjustments initial,
|
||||
required String settingsId,
|
||||
required String cameraLabel,
|
||||
required Color accent,
|
||||
required String Function(String) t,
|
||||
required ValueChanged<ImageAdjustments> onChanged,
|
||||
}) {
|
||||
@@ -113,6 +115,7 @@ Future<void> showImageSettingsSheet(
|
||||
context,
|
||||
builder: (sheet) => StatefulBuilder(
|
||||
builder: (context, setSheetState) {
|
||||
final c = Palette.current;
|
||||
void update(ImageAdjustments next) {
|
||||
setSheetState(() => value = next);
|
||||
onChanged(next);
|
||||
@@ -121,37 +124,20 @@ Future<void> showImageSettingsSheet(
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
CameraSheetHeader(
|
||||
title: t('Image Settings'),
|
||||
subtitle: '$cameraLabel · ${t('Saved for this camera')}',
|
||||
trailing: TextButton.icon(
|
||||
style: TextButton.styleFrom(foregroundColor: Colors.white70),
|
||||
icon: const Icon(Icons.restart_alt_rounded, size: 18),
|
||||
label: Text(t('Reset')),
|
||||
onPressed: () => update(value.resetPicture()),
|
||||
),
|
||||
subtitle: '$cameraLabel · ${t('saved for this camera')}',
|
||||
trailing: ResetPill(label: t('Reset'), onTap: () => update(value.resetPicture())),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
for (final (f, icon, label) in [
|
||||
(ImageFilterType.none, Icons.image_outlined, 'None'),
|
||||
(
|
||||
ImageFilterType.greyscale,
|
||||
Icons.filter_b_and_w_rounded,
|
||||
'Greyscale'
|
||||
),
|
||||
(
|
||||
ImageFilterType.highContrast,
|
||||
Icons.contrast_rounded,
|
||||
'High contrast'
|
||||
),
|
||||
(
|
||||
ImageFilterType.invert,
|
||||
Icons.invert_colors_rounded,
|
||||
'Invert'
|
||||
),
|
||||
(ImageFilterType.greyscale, Icons.contrast_rounded, 'Greyscale'),
|
||||
(ImageFilterType.highContrast, Icons.wb_sunny_outlined, 'High contrast'),
|
||||
(ImageFilterType.invert, Icons.visibility_outlined, 'Invert'),
|
||||
]) ...[
|
||||
if (f != ImageFilterType.none) const SizedBox(width: 8),
|
||||
Expanded(
|
||||
@@ -159,43 +145,51 @@ Future<void> showImageSettingsSheet(
|
||||
icon: icon,
|
||||
label: t(label),
|
||||
selected: value.filter == f,
|
||||
accent: accent,
|
||||
onTap: () => update(value.copyWith(filter: f)),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
const SizedBox(height: 16),
|
||||
SheetSlider(
|
||||
icon: Icons.brightness_6_rounded,
|
||||
icon: Icons.light_mode_outlined,
|
||||
label: t('Brightness'),
|
||||
valueText:
|
||||
'${value.brightness >= 0 ? '+' : ''}${(value.brightness * 100).round()}',
|
||||
valueText: '${value.brightness >= 0 ? '+' : '−'}${(value.brightness.abs() * 100).round()}',
|
||||
value: value.brightness,
|
||||
min: -1,
|
||||
max: 1,
|
||||
accent: accent,
|
||||
onChanged: (v) => update(value.copyWith(brightness: v)),
|
||||
),
|
||||
SheetSlider(
|
||||
icon: Icons.tonality_rounded,
|
||||
icon: Icons.contrast_rounded,
|
||||
label: t('Contrast'),
|
||||
valueText: '${(value.contrast * 100).round()} %',
|
||||
valueText: dec(value.contrast, 1),
|
||||
value: value.contrast,
|
||||
min: 0.5,
|
||||
max: 2,
|
||||
accent: accent,
|
||||
onChanged: (v) => update(value.copyWith(contrast: v)),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SheetToggle(
|
||||
icon: Icons.rotate_90_degrees_cw_rounded,
|
||||
label: '${t('Rotate')} · ${value.quarterTurns * 90}°',
|
||||
active: value.quarterTurns != 0,
|
||||
accent: accent,
|
||||
onTap: () => update(
|
||||
value.copyWith(quarterTurns: (value.quarterTurns + 1) % 4)),
|
||||
AppCard(
|
||||
color: c.isDark ? c.card2 : c.card,
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 8, 8),
|
||||
onTap: () => update(value.copyWith(quarterTurns: (value.quarterTurns + 1) % 4)),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.rotate_right_rounded, size: 20, color: c.muted),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Text('${t('Rotate')} · ${value.quarterTurns * 90}°',
|
||||
style: TextStyle(fontSize: 14.5, fontWeight: FontWeight.w500, color: c.ink)),
|
||||
),
|
||||
CircleButton(
|
||||
icon: Icons.rotate_right_rounded,
|
||||
size: 36,
|
||||
onTap: () => update(value.copyWith(quarterTurns: (value.quarterTurns + 1) % 4)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -208,46 +202,33 @@ class _FilterTile extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String label;
|
||||
final bool selected;
|
||||
final Color accent;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const _FilterTile({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
required this.selected,
|
||||
required this.accent,
|
||||
required this.onTap,
|
||||
});
|
||||
const _FilterTile({required this.icon, required this.label, required this.selected, required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final c = Palette.current;
|
||||
return Material(
|
||||
color: selected
|
||||
? accent.withValues(alpha: 0.18)
|
||||
: Colors.white.withValues(alpha: 0.06),
|
||||
color: selected ? c.accentSoft : (c.isDark ? c.card2 : c.tile),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
side:
|
||||
BorderSide(color: selected ? accent : Colors.transparent, width: 2),
|
||||
side: BorderSide(color: selected ? c.accent : Colors.transparent, width: 1.5),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(icon, color: selected ? accent : Colors.white70, size: 26),
|
||||
const SizedBox(height: 4),
|
||||
Icon(icon, color: selected ? c.accent : c.muted, size: 22),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: selected ? Colors.white : Colors.white70,
|
||||
),
|
||||
style: TextStyle(fontSize: 10.5, fontWeight: FontWeight.w600, color: selected ? c.ink : c.muted),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user