electric_digital_sketch

Offline-first Flutter package for drawing, annotating and exporting electrical network sketches.

This package provides a ready-to-use editor page built on top of simple_painter, with workflows focused on electrical design and field sketching.

Features

  • Freehand drawing and erase tools
  • Selection, layer management, undo and redo
  • Electrical network line mode with specialized line styles
  • Geometric shapes and grouped electrical symbols
  • Text insertion and editing
  • Location and description metadata for custom electrical items
  • Result preview with share/export flow
  • Confirmation callback that returns the generated image file

Included editor tools

  • SketchMode.select
  • SketchMode.brush
  • SketchMode.erase
  • SketchMode.changes
  • SketchMode.text
  • SketchMode.shapes
  • SketchMode.layers
  • SketchMode.redes

The package also includes grouped electrical symbols such as:

  • transformers
  • poles
  • switches
  • grounding items
  • surge protection items

Installation

Add the package to your pubspec.yaml:

dependencies:
  electric_digital_sketch: ^1.0.0

Then run:

flutter pub get

Basic usage

The package exports a single entry-point:

import 'package:electric_digital_sketch/electric_digital_sketch.dart';

Use ElectricSketchPage as a full-screen editor:

import 'dart:io';

import 'package:electric_digital_sketch/electric_digital_sketch.dart';
import 'package:flutter/material.dart';

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ElectricSketchPage(
        onConfirm: (File imageFile) async {
          debugPrint('Generated image: ${imageFile.path}');
        },
      ),
    );
  }
}

Export and confirmation flow

When the user opens the result preview:

  • the editor renders the current sketch as a PNG file
  • the result page shows the generated image
  • the user can share/save the file
  • if onConfirm is provided, the page exposes confirm action and returns the generated File

Example:

Widget build(BuildContext context){
  return ElectricSketchPage(
    onConfirm: (file) async {
      // Upload, persist or attach the final PNG file.
    },
  );
}

Platform behavior

  • Android and iOS: result export uses the native share sheet
  • Desktop platforms: result export uses a native save dialog

Current public API

Main public types:

  • ElectricSketchPage
  • ElectricSketchController
  • SketchMode
  • LineStyle
  • ElectricShapeType
  • LocationService

Example project

An example app is included in example/.

Run it with:

flutter run -d <device>

Notes

  • The package is designed around an editor page, not a low-level drawing API.
  • Internal widgets and controllers may evolve, but ElectricSketchPage is the intended integration point for consumers.
  • Location-related features depend on platform permission configuration in the host app.

License

This project is licensed under the MIT License.

Libraries

domain/enums/electric_shape_type
domain/enums/line_style
domain/enums/sketch_mode
domain/exceptions/electric_digital_sketch_exception
electric_digital_sketch
plugins/location_service
ui/add_edit_text_page
ui/electric_sketch_page
ui/result_page
ui/viewmodels/electric_sketch_controller
ui/widgets/add_text_page/add_text_page_bottom
ui/widgets/add_text_page/add_text_page_header
ui/widgets/app_bar/app_bar_widget
ui/widgets/app_bar/more_options_widget
ui/widgets/app_bar/undo_redo_button_group_widget
ui/widgets/bottom_bar/bottom_bar_content_factory
ui/widgets/bottom_bar/bottom_bar_widget
ui/widgets/bottom_bar/items/brush_options
ui/widgets/bottom_bar/items/change_list/change_list_item
ui/widgets/bottom_bar/items/change_list/changes_list
ui/widgets/bottom_bar/items/erase_options
ui/widgets/bottom_bar/items/layers/layer_option_item
ui/widgets/bottom_bar/items/layers/layer_options
ui/widgets/bottom_bar/items/redes/rede_options
ui/widgets/bottom_bar/items/redes/rede_type_select_widget
ui/widgets/bottom_bar/items/select_options
ui/widgets/bottom_bar/items/shapes/coordenada_input
ui/widgets/bottom_bar/items/shapes/custom_shape_options
ui/widgets/bottom_bar/items/shapes/desc_input
ui/widgets/bottom_bar/items/shapes/shape_options
ui/widgets/bottom_bar/items/shapes/shape_select
ui/widgets/bottom_bar/items/shapes/shape_subselect
ui/widgets/bottom_bar/items/text_items/font_size_range
ui/widgets/bottom_bar/items/text_items/text_align_input
ui/widgets/bottom_bar/items/text_items/text_options
ui/widgets/core/alert
ui/widgets/core/borderless_input
ui/widgets/core/double_switch
ui/widgets/core/icon_button
ui/widgets/core/primary_button
ui/widgets/core/text_button_widget
ui/widgets/core/text_input
ui/widgets/core/toggle_button/toggle_button
ui/widgets/core/toggle_button/toggle_button_group
ui/widgets/result_appbar/confirm_button
ui/widgets/result_appbar/result_appbar
ui/widgets/result_appbar/share_button
ui/widgets/toolbar/items/brush_toolbar_item_widget
ui/widgets/toolbar/items/changes_toolbar_item_widget
ui/widgets/toolbar/items/erase_toolbar_item_widget
ui/widgets/toolbar/items/layer_toolbar_item_widget
ui/widgets/toolbar/items/line_toolbar_item_widget
ui/widgets/toolbar/items/select_toolbar_item_widget
ui/widgets/toolbar/items/shapes_toolbar_item_widget
ui/widgets/toolbar/items/text_toolbar_item_widget
ui/widgets/toolbar/items/toolbar_item_widget
ui/widgets/toolbar/toolbar_widget
utils/extensions/painter_controller_extension
utils/helpers/listener_service