custom_polygon_package 0.0.1 copy "custom_polygon_package: ^0.0.1" to clipboard
custom_polygon_package: ^0.0.1 copied to clipboard

A Flutter package for custom painting.

Custom Polygon Package #

A Flutter package for custom painting.

In this version of the Flutter package, we implemented a code that defines a widget named as CustomPolygonWidget that allows users to interactively adjust the number of sides, size, and rotation of a polygon using sliders. The also implemented a class named as ShapePainter that uses the provided parameters to draw the polygon on the canvas.

Additionally, we prepared the package for publishing on pub.dev, including setting up the necessary metadata and documentation.

Installation #

  1. Use this package as a library, Run this command:

✔️ With Dart:

$ dart pub add custom_polygon_package
copied to clipboard

✔️ With Flutter:

$ flutter pub add custom_polygon_package
copied to clipboard
  1. This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
  custom_polygon_package: ^0.0.1
copied to clipboard
  1. Now in your Dart code, you can use:
import 'package:custom_polygon_package/custom_polygon_package.dart';
copied to clipboard

Usage #

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

void main() {
  runApp(MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Polygon Package Testing...',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: HomeScreen(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Polygons', style: TextStyle(fontWeight: FontWeight.bold)),
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: CustomPolygonWidget(),
      ),
    );
  }
}
copied to clipboard

Resources #

  1. Creating Packages

  2. Publishing Packages

  3. How to draw and animate designs with Flutter CustomPaint Widget

  4. CustomPaint Class

  5. CustomPainter Class

2
likes
140
points
27
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.13 - 2025.03.28

A Flutter package for custom painting.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on custom_polygon_package