flutter - 无法摆脱 Sliver 身体周围的浅灰色边框
问题描述
有谁知道为什么我的身体顶部和底部仍然有一条灰色的细横线?我正在使用SliverAppBar
它SliverFillRemaining
下面。我已经将elevation
值设置SliverAppBar
为0.0
。
import 'package:flutter/material.dart';
import 'package:curved_navigation_bar/curved_navigation_bar.dart';
class AccountPage extends StatefulWidget {
@override
_AccountPageState createState() => _AccountPageState();
}
class _AccountPageState extends State<AccountPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).primaryColor,
bottomNavigationBar: CurvedNavigationBar(
backgroundColor: Theme.of(context).backgroundColor,
items: <Widget>[
Icon(Icons.add, size: 30),
Icon(Icons.list, size: 30),
Icon(Icons.compare_arrows, size: 30),
],
onTap: (index) {
//Handle button tap
},
),
body: CustomScrollView(
slivers: [
SliverAppBar(
elevation: 0.0,
backgroundColor: Theme.of(context).primaryColor,
expandedHeight: 220.0,
collapsedHeight: 125.0,
pinned: true,
flexibleSpace: Stack(
children: [
Positioned.fill(
child: Image(
image: AssetImage('assets/images/Red_Polygon.jpg'),
fit: BoxFit.cover,
),
),
SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: double.infinity,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 32.0,
vertical: 16.0,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Hello, \nFIRST_NAME!",
style: TextStyle(
color: Colors.white,
fontSize: 32.0,
),
),
],
),
),
),
Container(
height: 16.0,
width: double.infinity,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
),
),
),
],
),
),
],
),
),
SliverFillRemaining(
child: Container(
color: Theme.of(context).backgroundColor,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Column(
children: [
],
),
),
),
),
],
),
);
}
}
解决方案
使这个容器具有白色的装饰颜色
Container(
height: 16.0,
width: double.infinity,
decoration: BoxDecoration(
color:Colors.white,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(40.0),
topRight: const Radius.circular(40.0),
),
),
),
对于底部导航,也给它一个白色的背景颜色。
默认背景颜色为“灰色”,您可以在主题中进行编辑
推荐阅读
- android - 无法在 Android Studio 中添加其他平台/构建工具
- javascript - SVG:如何绘制多个半圆(弧)路径
- templates - 如何在 SharePoint Online 中应用自定义网站模板?
- r - R中重叠二值图像的调色板
- android - 键盘窗口使用一个活动调整不同片段的大小/无
- android - 我正在尝试制作井字游戏应用程序
- python-3.x - 不和谐机器人贴纸
- linux - CLPPLUS 登录失败
- jquery - 在同一应用程序中显示用于 jQuery 的 Kendo UI PDFViewer 以及用于 Angular 的 Kendo UI 组件
- reactjs - 设置相机角度 react-three-fiber