Curved Shape Background Header in Flutter












3















I have a list view with "Hero" icons on the left. When I click a list item, it loads the next screen with the article text and the Hero image (which animates nicely/automatically to the correct spot on the 2nd screen).



I would have thought that was the "tough" part, but I'm now trying to get a curved shape as the top background of the 2nd screen. I would love to make it a drawn vector shape, as opposed to a bitmap and even have it drip/bounce onto the page, but at the moment...



I'm just trying to figure out how to:




  1. draw a vector shape

  2. have it as the background of a screen with other widgets on top (see purple curve on 2nd screen below)


goal










share|improve this question























  • This might help you.

    – Jerome Escalante
    Jan 2 at 1:34













  • @JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

    – Dave
    Jan 2 at 1:38











  • Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

    – Ajay Beniwal
    Jan 2 at 6:29






  • 1





    "I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

    – pskink
    Jan 2 at 9:03













  • @pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

    – Dave
    Jan 2 at 15:52
















3















I have a list view with "Hero" icons on the left. When I click a list item, it loads the next screen with the article text and the Hero image (which animates nicely/automatically to the correct spot on the 2nd screen).



I would have thought that was the "tough" part, but I'm now trying to get a curved shape as the top background of the 2nd screen. I would love to make it a drawn vector shape, as opposed to a bitmap and even have it drip/bounce onto the page, but at the moment...



I'm just trying to figure out how to:




  1. draw a vector shape

  2. have it as the background of a screen with other widgets on top (see purple curve on 2nd screen below)


goal










share|improve this question























  • This might help you.

    – Jerome Escalante
    Jan 2 at 1:34













  • @JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

    – Dave
    Jan 2 at 1:38











  • Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

    – Ajay Beniwal
    Jan 2 at 6:29






  • 1





    "I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

    – pskink
    Jan 2 at 9:03













  • @pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

    – Dave
    Jan 2 at 15:52














3












3








3


1






I have a list view with "Hero" icons on the left. When I click a list item, it loads the next screen with the article text and the Hero image (which animates nicely/automatically to the correct spot on the 2nd screen).



I would have thought that was the "tough" part, but I'm now trying to get a curved shape as the top background of the 2nd screen. I would love to make it a drawn vector shape, as opposed to a bitmap and even have it drip/bounce onto the page, but at the moment...



I'm just trying to figure out how to:




  1. draw a vector shape

  2. have it as the background of a screen with other widgets on top (see purple curve on 2nd screen below)


goal










share|improve this question














I have a list view with "Hero" icons on the left. When I click a list item, it loads the next screen with the article text and the Hero image (which animates nicely/automatically to the correct spot on the 2nd screen).



I would have thought that was the "tough" part, but I'm now trying to get a curved shape as the top background of the 2nd screen. I would love to make it a drawn vector shape, as opposed to a bitmap and even have it drip/bounce onto the page, but at the moment...



I'm just trying to figure out how to:




  1. draw a vector shape

  2. have it as the background of a screen with other widgets on top (see purple curve on 2nd screen below)


goal







dart flutter






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 0:59









DaveDave

22.8k1487151




22.8k1487151













  • This might help you.

    – Jerome Escalante
    Jan 2 at 1:34













  • @JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

    – Dave
    Jan 2 at 1:38











  • Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

    – Ajay Beniwal
    Jan 2 at 6:29






  • 1





    "I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

    – pskink
    Jan 2 at 9:03













  • @pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

    – Dave
    Jan 2 at 15:52



















  • This might help you.

    – Jerome Escalante
    Jan 2 at 1:34













  • @JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

    – Dave
    Jan 2 at 1:38











  • Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

    – Ajay Beniwal
    Jan 2 at 6:29






  • 1





    "I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

    – pskink
    Jan 2 at 9:03













  • @pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

    – Dave
    Jan 2 at 15:52

















This might help you.

– Jerome Escalante
Jan 2 at 1:34







This might help you.

– Jerome Escalante
Jan 2 at 1:34















@JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

– Dave
Jan 2 at 1:38





@JeromeEscalante I don't think it should require masking off an image or a block of color. (should it?) I think there's a way to create a shape with flutter.

– Dave
Jan 2 at 1:38













Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

– Ajay Beniwal
Jan 2 at 6:29





Flutter has full blown Canvas, and Path classes if you want a lower level control instead of ClipPath solution

– Ajay Beniwal
Jan 2 at 6:29




1




1





"I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

– pskink
Jan 2 at 9:03







"I think there's a way to create a shape with flutter." - see ShapeBorder class (or use CustomPaint to have the full control on what you want to draw)

– pskink
Jan 2 at 9:03















@pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

– Dave
Jan 2 at 15:52





@pskink I saw this class, but couldn't find any reasonable examples to follow or learn. :/

– Dave
Jan 2 at 15:52












1 Answer
1






active

oldest

votes


















7














I made a full sample for your curved shape in a gist here



I used CustomPainter to draw on a canvas then, with some geometric calculations, I achieved the curved shape.



Final result



Flutter curved shape with a circle inside



How I draw it?



enter image description here



Before coding and on a Whiteboard I determined somethings:





  1. My Canvas Area:


    • The canvas dimensions I need to draw that shape (which equals to Flutter widget's dimensions).




  2. How and where my brush will move?


    • how means: what are the APIs I need to draw that shape on the canvas using the Path class.
      e.g. lineTo() for a straight line, quadraticBezierTo() for a curve.

    • where means: Where are the points (coordinates) I need to draw the whole shape. (see yellow and green dots in the image above)




  3. Points (coordinates) Calculations:


    • I used some geometric equations to calculate the coordinates. e.g. Point on a circle’s circumference

    • All of my calculations depend on the canvas size, that gives me a responsive shape.




Full sample here!






share|improve this answer





















  • 1





    Works wonderfully AND serves as a great example as a learning exercise! Thanks!

    – Dave
    Jan 3 at 1:35











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%2f54000161%2fcurved-shape-background-header-in-flutter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














I made a full sample for your curved shape in a gist here



I used CustomPainter to draw on a canvas then, with some geometric calculations, I achieved the curved shape.



Final result



Flutter curved shape with a circle inside



How I draw it?



enter image description here



Before coding and on a Whiteboard I determined somethings:





  1. My Canvas Area:


    • The canvas dimensions I need to draw that shape (which equals to Flutter widget's dimensions).




  2. How and where my brush will move?


    • how means: what are the APIs I need to draw that shape on the canvas using the Path class.
      e.g. lineTo() for a straight line, quadraticBezierTo() for a curve.

    • where means: Where are the points (coordinates) I need to draw the whole shape. (see yellow and green dots in the image above)




  3. Points (coordinates) Calculations:


    • I used some geometric equations to calculate the coordinates. e.g. Point on a circle’s circumference

    • All of my calculations depend on the canvas size, that gives me a responsive shape.




Full sample here!






share|improve this answer





















  • 1





    Works wonderfully AND serves as a great example as a learning exercise! Thanks!

    – Dave
    Jan 3 at 1:35
















7














I made a full sample for your curved shape in a gist here



I used CustomPainter to draw on a canvas then, with some geometric calculations, I achieved the curved shape.



Final result



Flutter curved shape with a circle inside



How I draw it?



enter image description here



Before coding and on a Whiteboard I determined somethings:





  1. My Canvas Area:


    • The canvas dimensions I need to draw that shape (which equals to Flutter widget's dimensions).




  2. How and where my brush will move?


    • how means: what are the APIs I need to draw that shape on the canvas using the Path class.
      e.g. lineTo() for a straight line, quadraticBezierTo() for a curve.

    • where means: Where are the points (coordinates) I need to draw the whole shape. (see yellow and green dots in the image above)




  3. Points (coordinates) Calculations:


    • I used some geometric equations to calculate the coordinates. e.g. Point on a circle’s circumference

    • All of my calculations depend on the canvas size, that gives me a responsive shape.




Full sample here!






share|improve this answer





















  • 1





    Works wonderfully AND serves as a great example as a learning exercise! Thanks!

    – Dave
    Jan 3 at 1:35














7












7








7







I made a full sample for your curved shape in a gist here



I used CustomPainter to draw on a canvas then, with some geometric calculations, I achieved the curved shape.



Final result



Flutter curved shape with a circle inside



How I draw it?



enter image description here



Before coding and on a Whiteboard I determined somethings:





  1. My Canvas Area:


    • The canvas dimensions I need to draw that shape (which equals to Flutter widget's dimensions).




  2. How and where my brush will move?


    • how means: what are the APIs I need to draw that shape on the canvas using the Path class.
      e.g. lineTo() for a straight line, quadraticBezierTo() for a curve.

    • where means: Where are the points (coordinates) I need to draw the whole shape. (see yellow and green dots in the image above)




  3. Points (coordinates) Calculations:


    • I used some geometric equations to calculate the coordinates. e.g. Point on a circle’s circumference

    • All of my calculations depend on the canvas size, that gives me a responsive shape.




Full sample here!






share|improve this answer















I made a full sample for your curved shape in a gist here



I used CustomPainter to draw on a canvas then, with some geometric calculations, I achieved the curved shape.



Final result



Flutter curved shape with a circle inside



How I draw it?



enter image description here



Before coding and on a Whiteboard I determined somethings:





  1. My Canvas Area:


    • The canvas dimensions I need to draw that shape (which equals to Flutter widget's dimensions).




  2. How and where my brush will move?


    • how means: what are the APIs I need to draw that shape on the canvas using the Path class.
      e.g. lineTo() for a straight line, quadraticBezierTo() for a curve.

    • where means: Where are the points (coordinates) I need to draw the whole shape. (see yellow and green dots in the image above)




  3. Points (coordinates) Calculations:


    • I used some geometric equations to calculate the coordinates. e.g. Point on a circle’s circumference

    • All of my calculations depend on the canvas size, that gives me a responsive shape.




Full sample here!







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 3 at 6:22

























answered Jan 2 at 10:17









Tarek360Tarek360

379312




379312








  • 1





    Works wonderfully AND serves as a great example as a learning exercise! Thanks!

    – Dave
    Jan 3 at 1:35














  • 1





    Works wonderfully AND serves as a great example as a learning exercise! Thanks!

    – Dave
    Jan 3 at 1:35








1




1





Works wonderfully AND serves as a great example as a learning exercise! Thanks!

– Dave
Jan 3 at 1:35





Works wonderfully AND serves as a great example as a learning exercise! Thanks!

– Dave
Jan 3 at 1:35




















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%2f54000161%2fcurved-shape-background-header-in-flutter%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

android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

SQL update select statement

WPF add header to Image with URL pettitions [duplicate]