Coder Social home page Coder Social logo

unluckyy1 / flutter-resizable-widget Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zamaniafshar/flutter-resizable-widget

0.0 0.0 0.0 228 KB

A Flutter widget that allow user to resize or move it's child in the screen by dragging.

License: Other

C++ 34.62% C 2.36% Objective-C 0.06% Kotlin 0.21% Dart 27.81% Swift 1.92% HTML 3.01% CMake 30.02%

flutter-resizable-widget's Introduction

ℹ️ About

A Flutter widget that allow user to resize or move it's child in the screen by dragging.

Preview

bandicam.2023-01-28.10-34-34-603.mp4

Sample

Scaffold(
      appBar: AppBar(
        title: const Text('First Example'),
        centerTitle: true,
      ),
      body: LayoutBuilder(
        builder: (context, constraint) {
          double areaHeight = constraint.maxHeight * 0.8;
          double areaWidth = constraint.maxWidth * 0.8;

          return Container(
            width: constraint.maxWidth,
            height: constraint.maxHeight,
            decoration: BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.topLeft,
                end: Alignment.bottomRight,
                colors: [
                  Colors.lightBlue.shade200,
                  Colors.blue.shade700,
                ],
              ),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                const SizedBox(height: 10),
                const Text(
                  'Widget Area',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 16,
                  ),
                ),
                const SizedBox(height: 10),
                Container(
                  height: constraint.maxHeight * 0.8,
                  width: constraint.maxWidth * 0.8,
                  decoration: BoxDecoration(
                    border: Border.all(
                      color: Colors.white,
                      width: 2,
                    ),
                  ),
                  child: ResizableWidget(
                    areaHeight: areaHeight,
                    areaWidth: areaWidth,
                    height: 250,
                    width: 250,
                    minHeight: 100,
                    minWidth: 100,
                    dragWidgetsArea: const Size.square(30 / 2),
                    triggersList: DragTriggersEnum.values
                        .map(
                          (e) => Trigger(
                            dragTriggerType: e,
                            child: Container(
                              height: 30,
                              width: 30,
                              decoration: const BoxDecoration(
                                color: Colors.white38,
                                shape: BoxShape.circle,
                              ),
                            ),
                          ),
                        )
                        .toList(),
                    child: Container(
                      decoration: BoxDecoration(
                        border: Border.all(
                          color: Colors.white,
                          width: 2,
                        ),
                      ),
                      child: Stack(
                        children: [
                          Column(
                            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                            children: List.generate(
                              3,
                              (index) => const Divider(
                                color: Colors.white,
                              ),
                            ),
                          ),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                            children: List.generate(
                              3,
                              (index) => const VerticalDivider(
                                color: Colors.white,
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                ),
              ],
            ),
          );
        },
      ),
    );
    ```

flutter-resizable-widget's People

Contributors

zamaniafshar avatar hosseinkhojany avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.