我想制作一个看起来像的应用,并将该切片放在角落。我可以制作幻灯片,但我的应用程序没有阴影。
我将我的前层包裹在一个具有高程的材料杂物盒中,如示例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的应用程序
答案 0 :(得分: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),
],
),
),
],
);
}
}