How do I crop a widget, or cut out a square portion of a widget of that particular size?Is there a way to get the size of an existing widget?Positioning/Sizing a widget depending of the position/size of another widgetFlutter: Drag and drop with GridHow to use the sizes of other widgets before the widget tree is drawn ? [with Example]How to square crop a Flutter camera previewWidgets sliding from outside the screen in Flutter ? Similar to Android 8 app drawerHow to use Expanded in stepper when using columnsHow to make flutter widgets adaptive to different screen sizesHow to redraw a particular widget from multiple widget in the widget treeHow to prevent RenderBox from drawing over other widgets?

Electricity free spaceship

What is the color of artificial intelligence?

Why am I getting a strange double quote (“) in Open Office instead of the ordinary one (")?

Is it expected that a reader will skip parts of what you write?

Soft question: Examples where lack of mathematical rigour cause security breaches?

How does the Around command at zero work?

Changing Out a "Vintage" Dimmer Switch

Is it legal for a bar bouncer to confiscate a fake ID

Why does logistic function use e rather than 2?

If I leave the US through an airport, do I have to return through the same airport?

Learning the concept of Serialism from its basics - where should I start from?

How did old MS-DOS games utilize various graphic cards?

Fermat's statement about the ancients: How serious was he?

Determining fair price for profitable mobile app business

How to use memset in c++?

Why we don’t make use of the t-distribution for constructing a confidence interval for a proportion?

Live action TV show where High school Kids go into the virtual world and have to clear levels

You have (3^2 + 2^3 + 2^2) Guesses Left. Figure out the Last one

If every company in the economy earns zero economic profit, can they contribute to real economic growth?

Thread Pool C++ Implementation

Winning Strategy for the Magician and his Apprentice

Despite of atoms being mostly vacuum, why are things so rigid around us?

Can I utilise a baking stone to make crepes?

Why didn't Voldemort recognize that Dumbledore was affected by his curse?



How do I crop a widget, or cut out a square portion of a widget of that particular size?


Is there a way to get the size of an existing widget?Positioning/Sizing a widget depending of the position/size of another widgetFlutter: Drag and drop with GridHow to use the sizes of other widgets before the widget tree is drawn ? [with Example]How to square crop a Flutter camera previewWidgets sliding from outside the screen in Flutter ? Similar to Android 8 app drawerHow to use Expanded in stepper when using columnsHow to make flutter widgets adaptive to different screen sizesHow to redraw a particular widget from multiple widget in the widget treeHow to prevent RenderBox from drawing over other widgets?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I want to crop a CameraPreview widget, so that I only get the exact size and position where I want to cut it.



Currently I am able to clip it using ClipRect,
but i get this black area around where widget was clipped out which I want to remove ( see my replacement for a good graphic below )



Lets say we have a widget like this



 -------------- 
|88888888888888|
|88888888888888|
|88888888888888|
|88888888888888|
|88888888888888|
|88888888888888|
--------------


I need to crop the widget, (not clip)



 -------------- 
| |
| |
| 888 | -----
| 888 | | 888 |
| 888 | | 888 |
| | | 888 |
-------------- -----
CLIPPING CROPPING



Can anyone help me with cropping a widget?










share|improve this question






























    0















    I want to crop a CameraPreview widget, so that I only get the exact size and position where I want to cut it.



    Currently I am able to clip it using ClipRect,
    but i get this black area around where widget was clipped out which I want to remove ( see my replacement for a good graphic below )



    Lets say we have a widget like this



     -------------- 
    |88888888888888|
    |88888888888888|
    |88888888888888|
    |88888888888888|
    |88888888888888|
    |88888888888888|
    --------------


    I need to crop the widget, (not clip)



     -------------- 
    | |
    | |
    | 888 | -----
    | 888 | | 888 |
    | 888 | | 888 |
    | | | 888 |
    -------------- -----
    CLIPPING CROPPING



    Can anyone help me with cropping a widget?










    share|improve this question


























      0












      0








      0


      0






      I want to crop a CameraPreview widget, so that I only get the exact size and position where I want to cut it.



      Currently I am able to clip it using ClipRect,
      but i get this black area around where widget was clipped out which I want to remove ( see my replacement for a good graphic below )



      Lets say we have a widget like this



       -------------- 
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      --------------


      I need to crop the widget, (not clip)



       -------------- 
      | |
      | |
      | 888 | -----
      | 888 | | 888 |
      | 888 | | 888 |
      | | | 888 |
      -------------- -----
      CLIPPING CROPPING



      Can anyone help me with cropping a widget?










      share|improve this question
















      I want to crop a CameraPreview widget, so that I only get the exact size and position where I want to cut it.



      Currently I am able to clip it using ClipRect,
      but i get this black area around where widget was clipped out which I want to remove ( see my replacement for a good graphic below )



      Lets say we have a widget like this



       -------------- 
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      |88888888888888|
      --------------


      I need to crop the widget, (not clip)



       -------------- 
      | |
      | |
      | 888 | -----
      | 888 | | 888 |
      | 888 | | 888 |
      | | | 888 |
      -------------- -----
      CLIPPING CROPPING



      Can anyone help me with cropping a widget?







      dart flutter flutter-layout






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 22:07









      cipli onat

      554313




      554313










      asked Mar 24 at 18:54









      Prerak MannPrerak Mann

      11




      11






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Try this



          final Size size = controller.value.size;
          return ClipRect(
          child: OverflowBox(
          maxWidth: double.infinity,
          maxHeight: double.infinity,
          alignment: Alignment.center,
          child: FittedBox(
          fit: BoxFit.cover,
          alignment: Alignment.center,
          child: new Container(
          width: size.width,
          height: size.height,
          child: CameraPreview(controller)
          )
          )
          )
          );





          share|improve this answer























          • I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

            – Prerak Mann
            Mar 26 at 6:06


















          0














          Nevermind i managed to solve it on my own,
          It felt like flutter framework works in mysterious ways until i figured this out



          return Container( // just a parent
          child: Align( // important
          alignment: Alignment.center,
          child: Container( // just a parent
          width: some_width,
          height: some_height,
          child: SizedBox(
          width: width, // final width of cropped portion
          height: width, // final height of cropped portion
          child: OverflowBox(
          alignment: Alignment(-1,-1), // gives you top left portion of the size above, (1,1) gives bottom right, right direction is positive x, downward direction is positive y, see about Alignment on flutter docs for more details
          maxWidth: double.infinity,
          maxHeight: double.infinity,
          child: Container(
          width: width,
          height: width,
          child: ClipRect(
          clipper: RectClipper(i, width / 4),// this is a custom clipper i made of type CustomClipper<Rect>
          child: CameraPreview(controller),
          ),
          ),
          ),
          ),
          ),
          ),
          );





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327339%2fhow-do-i-crop-a-widget-or-cut-out-a-square-portion-of-a-widget-of-that-particul%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Try this



            final Size size = controller.value.size;
            return ClipRect(
            child: OverflowBox(
            maxWidth: double.infinity,
            maxHeight: double.infinity,
            alignment: Alignment.center,
            child: FittedBox(
            fit: BoxFit.cover,
            alignment: Alignment.center,
            child: new Container(
            width: size.width,
            height: size.height,
            child: CameraPreview(controller)
            )
            )
            )
            );





            share|improve this answer























            • I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

              – Prerak Mann
              Mar 26 at 6:06















            0














            Try this



            final Size size = controller.value.size;
            return ClipRect(
            child: OverflowBox(
            maxWidth: double.infinity,
            maxHeight: double.infinity,
            alignment: Alignment.center,
            child: FittedBox(
            fit: BoxFit.cover,
            alignment: Alignment.center,
            child: new Container(
            width: size.width,
            height: size.height,
            child: CameraPreview(controller)
            )
            )
            )
            );





            share|improve this answer























            • I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

              – Prerak Mann
              Mar 26 at 6:06













            0












            0








            0







            Try this



            final Size size = controller.value.size;
            return ClipRect(
            child: OverflowBox(
            maxWidth: double.infinity,
            maxHeight: double.infinity,
            alignment: Alignment.center,
            child: FittedBox(
            fit: BoxFit.cover,
            alignment: Alignment.center,
            child: new Container(
            width: size.width,
            height: size.height,
            child: CameraPreview(controller)
            )
            )
            )
            );





            share|improve this answer













            Try this



            final Size size = controller.value.size;
            return ClipRect(
            child: OverflowBox(
            maxWidth: double.infinity,
            maxHeight: double.infinity,
            alignment: Alignment.center,
            child: FittedBox(
            fit: BoxFit.cover,
            alignment: Alignment.center,
            child: new Container(
            width: size.width,
            height: size.height,
            child: CameraPreview(controller)
            )
            )
            )
            );






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 24 at 18:57









            mirkancalmirkancal

            6171518




            6171518












            • I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

              – Prerak Mann
              Mar 26 at 6:06

















            • I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

              – Prerak Mann
              Mar 26 at 6:06
















            I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

            – Prerak Mann
            Mar 26 at 6:06





            I tried this but this is for center cropping, i want to crop the widget at the exact position and size i want.

            – Prerak Mann
            Mar 26 at 6:06













            0














            Nevermind i managed to solve it on my own,
            It felt like flutter framework works in mysterious ways until i figured this out



            return Container( // just a parent
            child: Align( // important
            alignment: Alignment.center,
            child: Container( // just a parent
            width: some_width,
            height: some_height,
            child: SizedBox(
            width: width, // final width of cropped portion
            height: width, // final height of cropped portion
            child: OverflowBox(
            alignment: Alignment(-1,-1), // gives you top left portion of the size above, (1,1) gives bottom right, right direction is positive x, downward direction is positive y, see about Alignment on flutter docs for more details
            maxWidth: double.infinity,
            maxHeight: double.infinity,
            child: Container(
            width: width,
            height: width,
            child: ClipRect(
            clipper: RectClipper(i, width / 4),// this is a custom clipper i made of type CustomClipper<Rect>
            child: CameraPreview(controller),
            ),
            ),
            ),
            ),
            ),
            ),
            );





            share|improve this answer



























              0














              Nevermind i managed to solve it on my own,
              It felt like flutter framework works in mysterious ways until i figured this out



              return Container( // just a parent
              child: Align( // important
              alignment: Alignment.center,
              child: Container( // just a parent
              width: some_width,
              height: some_height,
              child: SizedBox(
              width: width, // final width of cropped portion
              height: width, // final height of cropped portion
              child: OverflowBox(
              alignment: Alignment(-1,-1), // gives you top left portion of the size above, (1,1) gives bottom right, right direction is positive x, downward direction is positive y, see about Alignment on flutter docs for more details
              maxWidth: double.infinity,
              maxHeight: double.infinity,
              child: Container(
              width: width,
              height: width,
              child: ClipRect(
              clipper: RectClipper(i, width / 4),// this is a custom clipper i made of type CustomClipper<Rect>
              child: CameraPreview(controller),
              ),
              ),
              ),
              ),
              ),
              ),
              );





              share|improve this answer

























                0












                0








                0







                Nevermind i managed to solve it on my own,
                It felt like flutter framework works in mysterious ways until i figured this out



                return Container( // just a parent
                child: Align( // important
                alignment: Alignment.center,
                child: Container( // just a parent
                width: some_width,
                height: some_height,
                child: SizedBox(
                width: width, // final width of cropped portion
                height: width, // final height of cropped portion
                child: OverflowBox(
                alignment: Alignment(-1,-1), // gives you top left portion of the size above, (1,1) gives bottom right, right direction is positive x, downward direction is positive y, see about Alignment on flutter docs for more details
                maxWidth: double.infinity,
                maxHeight: double.infinity,
                child: Container(
                width: width,
                height: width,
                child: ClipRect(
                clipper: RectClipper(i, width / 4),// this is a custom clipper i made of type CustomClipper<Rect>
                child: CameraPreview(controller),
                ),
                ),
                ),
                ),
                ),
                ),
                );





                share|improve this answer













                Nevermind i managed to solve it on my own,
                It felt like flutter framework works in mysterious ways until i figured this out



                return Container( // just a parent
                child: Align( // important
                alignment: Alignment.center,
                child: Container( // just a parent
                width: some_width,
                height: some_height,
                child: SizedBox(
                width: width, // final width of cropped portion
                height: width, // final height of cropped portion
                child: OverflowBox(
                alignment: Alignment(-1,-1), // gives you top left portion of the size above, (1,1) gives bottom right, right direction is positive x, downward direction is positive y, see about Alignment on flutter docs for more details
                maxWidth: double.infinity,
                maxHeight: double.infinity,
                child: Container(
                width: width,
                height: width,
                child: ClipRect(
                clipper: RectClipper(i, width / 4),// this is a custom clipper i made of type CustomClipper<Rect>
                child: CameraPreview(controller),
                ),
                ),
                ),
                ),
                ),
                ),
                );






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 19:22









                Prerak MannPrerak Mann

                11




                11



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55327339%2fhow-do-i-crop-a-widget-or-cut-out-a-square-portion-of-a-widget-of-that-particul%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해