Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions lib/view/image_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import 'package:magicepaperapp/constants/color_constants.dart';
import 'package:magicepaperapp/l10n/app_localizations.dart';
import '../util/app_logger.dart';
import 'package:magicepaperapp/provider/getitlocator.dart';
import 'package:magicepaperapp/view/widget/configurable_epd_dialog.dart';
import 'package:magicepaperapp/util/epd/configurable_editor.dart';
import 'package:magicepaperapp/provider/color_palette_provider.dart';

AppLocalizations appLocalizations = getIt.get<AppLocalizations>();

Expand Down Expand Up @@ -722,6 +725,53 @@ class BottomActionMenu extends StatelessWidget {
}
},
),
_buildActionButton(
context: context,
icon: Icons.developer_mode_outlined,
label: 'Custom',
onTap: () async {
// Open the existing configurable EPD dialog used by the drawer/Arduino flow
final configurable = ConfigurableEpd(
modelId: 'NA',
width: 400,
height: 300,
colors: [Colors.white, Colors.black, Colors.red],
);

final result = await showDialog<CustomEpdConfig>(
context: context,
builder: (context) => ConfigurableEpdDialog(
initialWidth: configurable.width,
initialHeight: configurable.height,
initialColors: List<Color>.from(configurable.colors),
),
);

if (result != null) {
final customEpd = ConfigurableEpd(
width: result.width,
height: result.height,
colors: result.colors,
name: result.presetName,
modelId: result.presetName,
);

try {
context.read<ColorPaletteProvider>().updateColors(customEpd.colors);
} catch (e) {
// provider may not be available in some contexts; ignore silently
}

// Open export-only ImageEditor with the custom display
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ImageEditor(isExportOnly: true, device: customEpd),
),
);
}
},
),
],
),
),
Expand Down