简体   繁体   English

如何去除appbar灰线抖动

[英]How to remove appbar grey line flutter

I was working with Flutter and saw this:我在使用 Flutter 时看到了这个:
a grey line appeared on my screen.我的屏幕上出现一条灰线。
maybe it is because the appbar is moved down by, for example, 5px and the background color is set to grey?也许是因为应用栏向下移动了,例如,5px 并且背景颜色设置为灰色?

BTW on iPhones, it works perfect, no lines顺便说一句,在 iPhone 上,它运行完美,没有线条https://imgur.com/jPyr01e

Container(
if I delete width but uncomment height it works but it sets a width of background around 200px I need double.infiniti
If I run the code it sets width to device.width but make the grey line visible
          // height: device.height * 390 / 812,
          width: double.infinity,
          child: BuildSvg('assets/svg/backgroundGradient.svg'),
        ),

buildsvg构建svg

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

class BuildSvg extends StatelessWidget {
  final url;
  BuildSvg(this.url);

  @override
  Widget build(BuildContext context) {
    final String assetName = url;
    final Widget svg = new SvgPicture.asset(assetName, semanticsLabel: '');
    return svg
  }
}

I change bgckcolor to red我将 bgckcolor 更改为红色
https://imgur.com/7C4yJ9E

This might help you :这可能会帮助你:

you can change the color of the status bar from scaffold so it can be transparent您可以从脚手架更改状态栏的颜色,使其变得透明

import 'package:flutter/services.dart';

class WelcomeScreen extends StatefulWidget {
  @override
  _WelcomeScreenState createState() => _WelcomeScreenState();
}

class _WelcomeScreenState extends State<WelcomeScreen> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      extendBodyBehindAppBar: true,
      appBar: AppBar(
        systemOverlayStyle: SystemUiOverlayStyle(statusBarColor: Colors.transparent),
        elevation: 0,
        backgroundColor: Colors.transparent,
      ),
    )
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM