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;
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
add a comment |
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
add a comment |
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
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
dart
edited Mar 24 at 22:07
cipli onat
554313
554313
asked Mar 24 at 18:54
Prerak MannPrerak Mann
11
11
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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)
)
)
)
);
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
add a comment |
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),
),
),
),
),
),
),
);
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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)
)
)
)
);
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
add a comment |
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)
)
)
)
);
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
add a comment |
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)
)
)
)
);
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)
)
)
)
);
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
add a comment |
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
add a comment |
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),
),
),
),
),
),
),
);
add a comment |
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),
),
),
),
),
),
),
);
add a comment |
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),
),
),
),
),
),
),
);
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),
),
),
),
),
),
),
);
answered Mar 26 at 19:22
Prerak MannPrerak Mann
11
11
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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