将图像与容器的颜色完美融合

时间:2019-06-22 16:09:05

标签: android image flutter containers

This is what i get as my output

我想做的是完美地减小梯度,使图像与下面的容器完美融合

我尝试使用容器的颜色向图像添加渐变,并且渐变在一定程度上起作用。但是容器存在的事实很明显,而且不能完美融合

这是我的轮播滑块的代码,上面贴有叠加层颜色

Widget image_carousal = new Container(
  height: MediaQuery.of(context).size.width / 1.2,
  child: new Carousel(
    boxFit: BoxFit.cover,
    images: [
      AssetImage('assets/images/679554.jpg'),
      AssetImage('assets/images/img.jpg'),
      AssetImage('assets/images/sekiro-shadows-die-twice-2019-4k-5b.jpg'),
      AssetImage('assets/images/tom-clancys-ghost-recon-breakpoint- 
      9m.jpg'),
    ],
    autoplay: false,
    animationCurve: Curves.fastOutSlowIn,
    animationDuration: Duration(milliseconds: 1000),
    dotSize: 4.0,
    dotSpacing: 15.0,
    dotColor: Colors.lightGreenAccent,
    indicatorBgPadding: 5.0,
    dotBgColor: Colors.transparent,
    borderRadius: false,
    moveIndicatorFromBottom: 0.0,
    noRadiusForIndicator: true,
    overlayShadow: true,
    overlayShadowColors: Color(0xFF232D3B),
    overlayShadowSize: 10.0,
  ),

这是我的SliverAppBAr和带有容器的SliverList的代码

CustomScrollView(
      slivers: <Widget>[
            SliverAppBar(
              title: new Text("Home"),
              centerTitle: true,
              floating: true,
              pinned: true,
              actions: <Widget>[
                Icon(Icons.search),
                Padding(padding:
                  EdgeInsets.only(right: 20.0),),
                Icon(Icons.notifications)
              ],
              expandedHeight: MediaQuery.of(context).size.width / 1.2,
              flexibleSpace: FlexibleSpaceBar(
                  background: Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height / 1.2,
                child: new ListView(
                  children: <Widget>[image_carousal],
                ),
              )),
            ),
            SliverList(
                delegate: new SliverChildListDelegate([
                  Container(
                    height: MediaQuery.of(context).size.height / 0.2,
                    width: MediaQuery.of(context).size.width,
                    color: Color(0xFF232D3B),
                  )])
            )
      ],
    )

我希望图像与下面的容器颜色完美融合。让我知道这是否可行,或者是否尽我所能。感谢任何人的帮助

0 个答案:

没有答案