Elevation not working on flutter material
I want to do an app that looks like this with that slice on the corner. I can make that slide but my app doesn't have that shadow.
I have my front layer wraped inside a material wideget with elevation like in the example MDC-104.
Here is my code to make that cut
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 60.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I use it like this:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
And it looks like this:
As you can see it looks flat, with no elevation at all.
How can I fix this?
Thanks!
EDIT: as @SnakeyHips suggests, this is my app with elevation 16.0
dart flutter material-design flutter-layout scaffold
add a comment |
I want to do an app that looks like this with that slice on the corner. I can make that slide but my app doesn't have that shadow.
I have my front layer wraped inside a material wideget with elevation like in the example MDC-104.
Here is my code to make that cut
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 60.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I use it like this:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
And it looks like this:
As you can see it looks flat, with no elevation at all.
How can I fix this?
Thanks!
EDIT: as @SnakeyHips suggests, this is my app with elevation 16.0
dart flutter material-design flutter-layout scaffold
add a comment |
I want to do an app that looks like this with that slice on the corner. I can make that slide but my app doesn't have that shadow.
I have my front layer wraped inside a material wideget with elevation like in the example MDC-104.
Here is my code to make that cut
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 60.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I use it like this:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
And it looks like this:
As you can see it looks flat, with no elevation at all.
How can I fix this?
Thanks!
EDIT: as @SnakeyHips suggests, this is my app with elevation 16.0
dart flutter material-design flutter-layout scaffold
I want to do an app that looks like this with that slice on the corner. I can make that slide but my app doesn't have that shadow.
I have my front layer wraped inside a material wideget with elevation like in the example MDC-104.
Here is my code to make that cut
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 60.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I use it like this:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
And it looks like this:
As you can see it looks flat, with no elevation at all.
How can I fix this?
Thanks!
EDIT: as @SnakeyHips suggests, this is my app with elevation 16.0
dart flutter material-design flutter-layout scaffold
dart flutter material-design flutter-layout scaffold
edited Nov 14 '18 at 18:53
Isaac
asked Nov 14 '18 at 11:32
IsaacIsaac
139216
139216
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Change your elevation from 60.0
to 16.0
should do it:
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 16.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
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%2f53299232%2felevation-not-working-on-flutter-material%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
Change your elevation from 60.0
to 16.0
should do it:
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 16.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
add a comment |
Change your elevation from 60.0
to 16.0
should do it:
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 16.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
add a comment |
Change your elevation from 60.0
to 16.0
should do it:
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 16.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
Change your elevation from 60.0
to 16.0
should do it:
import 'package:flutter/material.dart';
class ShapeLayer extends StatelessWidget
final Widget frontLayer;
final Widget backLayer = Container(
color: Colors.green,
);
ShapeLayer(Key key, this.frontLayer) : super(key: key);
@override
Widget build(BuildContext context)
return Stack(
children: <Widget>[
backLayer,
Material(
elevation: 16.0,
shape: BeveledRectangleBorder(
borderRadius: BorderRadius.only(topLeft: Radius.circular(46.0)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Expanded(child: frontLayer),
],
),
),
],
);
answered Nov 14 '18 at 15:40
SnakeyHipsSnakeyHips
626116
626116
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
add a comment |
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
I tried, it's hard to tell, but I would say that it looks pretty much the same. See my edit
– Isaac
Nov 14 '18 at 18:55
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
It's there it's just that it's hard to tell with that shade of green. If you were to change the colour to something lighter it'll be more pronounced.
– SnakeyHips
Nov 15 '18 at 9:10
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
You're right, I see it if I put a light green background but it's something super subtle. Do you know of any way of making the shadow stronger?
– Isaac
Nov 15 '18 at 11:40
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
The amount of elevation determines how "strong" the shadow and is determined by Material Design guidelines so if any elevation value isn't getting the strength that you want then I'm not sure what else to suggest. The idea of elevation is to be a subtle shadow as shown in the Shrine app and anything darker than that would be against Material Design. As I said, a light colour choice for the back layer would be my recommendation.
– SnakeyHips
Nov 15 '18 at 13:12
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%2f53299232%2felevation-not-working-on-flutter-material%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