海拔不适用于颤振 material
Elevation not working on flutter material
我想做一个看起来像这样 的应用程序,在角落里有那个切片。我可以制作那张幻灯片,但我的应用程序没有那个影子。
我将我的前层包裹在一个 material wideget 中,像示例 MDC-104 中那样具有高度。
这是我用来进行切割的代码
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),
],
),
),
],
);
}
}
我是这样使用的:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
它看起来像这样:
如您所见,它看起来很平坦,根本没有高程。
我该如何解决这个问题?
谢谢!
编辑:正如@SnakeyHips 所建议的,这是我的应用程序,海拔高度为 16.0
将海拔高度从 60.0
更改为 16.0
应该可以:
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),
],
),
),
],
);
}
}
我想做一个看起来像这样
我将我的前层包裹在一个 material wideget 中,像示例 MDC-104 中那样具有高度。
这是我用来进行切割的代码
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),
],
),
),
],
);
}
}
我是这样使用的:
return Scaffold(
appBar: appBar,
body: ShapeLayer(frontLayer: Container(//Some stuff here)
它看起来像这样:
如您所见,它看起来很平坦,根本没有高程。
我该如何解决这个问题?
谢谢!
编辑:正如@SnakeyHips 所建议的,这是我的应用程序,海拔高度为 16.0
将海拔高度从 60.0
更改为 16.0
应该可以:
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),
],
),
),
],
);
}
}