Тень карусели Flutter

Я хочу , чтобы сделать тень градиент на слайдер изображений так, чтобы текст не сливаться с картинками, но я не могу ... Я хочу , чтобы, как показано здесь - Carousel тень я наблюдал за инструкциями по этой ссылке инструкции , но я не могу понять, куда поместить код, куда бы я его ни положил, я не вижу той самой тени.

мой код карусели

      Stack(
                children: <Widget>[
                  CarouselSlider(
                    options: CarouselOptions(
                        enlargeStrategy: CenterPageEnlargeStrategy.height,
                        initialPage: 0,
                        viewportFraction: 0.90,
                        enlargeCenterPage: true,
                        enableInfiniteScroll: true,
                        autoPlay: true,
                        autoPlayCurve: Curves.linear,
                        //
                        reverse: false,
                        //
                        autoPlayInterval: Duration(seconds: 3),
                        //
                        autoPlayAnimationDuration: Duration(seconds: 1),
                        height: h * 0.70,
                        onPageChanged: (int index, reason) {
                          setState(() => listIndex = index);
                        }),
                    items: db.alldata.length == 0
                        ? [0, 1]
                            .take(1)
                            .map((f) => LoadingWidget())
                            .toList()
                        : db.alldata.map((i) {
                            return Builder(
                              builder: (BuildContext context) {
                                return Container(
                                    width:
                                        MediaQuery.of(context).size.width,
                                    margin:
                                        EdgeInsets.symmetric(horizontal: 0),
                                    child: InkWell(
                                      child: CachedNetworkImage(
                                        imageUrl: i['image url'],
                                        imageBuilder:
                                            (context, imageProvider) =>
                                                Hero(
                                          tag: i['timestamp'],
                                          child: Container(
                                            margin: EdgeInsets.only(
                                                left: 10,
                                                right: 10,
                                                top: 10,
                                                bottom: 50),
                                            decoration: BoxDecoration(
                                                color: Colors.grey[200],
                                                borderRadius:
                                                    BorderRadius.circular(
                                                        20),
                                                boxShadow: <BoxShadow>[
                                                  BoxShadow(
                                                      color:
                                                          Colors.grey[300]!,
                                                      blurRadius: 30,
                                                      offset: Offset(5, 20))
                                                ],
                                                image: DecorationImage(
                                                    image: imageProvider,
                                                    fit: BoxFit.cover)),
                                            child: Padding(
                                                padding:
                                                    const EdgeInsets.only(
                                                        left: 30,
                                                        bottom: 40),
                                                child: Row(
                                                  crossAxisAlignment:
                                                      CrossAxisAlignment
                                                          .end,
                                                  children: <Widget>[
                                                    Column(
                                                      mainAxisAlignment:
                                                          MainAxisAlignment
                                                              .end,
                                                      crossAxisAlignment:
                                                          CrossAxisAlignment
                                                              .start,
                                                      children: <Widget>[
                                                        
                                                        // Text(
                                                        //   Config().hashTag,
                                                        //   style: TextStyle(
                                                        //       decoration:
                                                        //           TextDecoration
                                                        //               .none,
                                                        //       color: Colors
                                                        //           .white,
                                                        //       fontSize: 14),
                                                        // ),
                                                        Text(
                                                          i['category'],
                                                          style: TextStyle(
                                                              decoration:
                                                                  TextDecoration
                                                                      .none,
                                                              color: Colors
                                                                  .white,
                                                              fontSize: 25),
                                                        )
                                                      ],
                                                    ),
                                                    Spacer(),
                                                    Icon(
                                                      Icons.favorite,
                                                      size: 25,
                                                      color: Colors.white
                                                          .withOpacity(0.5),
                                                    ),
                                                    SizedBox(width: 2),
                                                    Text(
                                                      i['loves'].toString(),
                                                      style: TextStyle(
                                                          decoration:
                                                              TextDecoration
                                                                  .none,
                                                          color: Colors
                                                              .white
                                                              .withOpacity(
                                                                  0.7),
                                                          fontSize: 18,
                                                          fontWeight:
                                                              FontWeight
                                                                  .w600),
                                                    ),
                                                    SizedBox(
                                                      width: 15,
                                                    )
                                                  ],
                                                )),
                                          ),
                                        ),
                                        placeholder: (context, url) =>
                                            LoadingWidget(),
                                        errorWidget:
                                            (context, url, error) => Icon(
                                          Icons.error,
                                          size: 40,
                                        ),
                                      ),
                                      onTap: () {
                                        Navigator.push(
                                            context,
                                            MaterialPageRoute(
                                                builder: (context) =>
                                                    DetailsPage(
                                                        tag: i['timestamp'],
                                                        imageUrl:
                                                            i['image url'],
                                                        catagory:
                                                            i['category'],
                                                        timestamp: i[
                                                            'timestamp'])));
                                      },
                                    ));
                              },
                            );
                          }).toList(),
                  ),

                  // Positioned(
                  //   top: 40,
                  //   right: w * 0,
                  //   child: new Image.asset('assets/images/favorite.png',width:50,height:50),
                  // ),

                  Positioned(
                    top: 40,
                    left: w * 0.15,
                    child: Text(
                      'ОБОИ ДНЯ',
                      style: TextStyle(
                          color: Colors.white,
                          fontSize: 25,
                          fontWeight: FontWeight.bold),
                    ),
                  ),

                  Positioned(
                    bottom: 9,
                    left: w * 0.36,
                    child: Container(
                        alignment: Alignment.center,
                        padding: EdgeInsets.all(12),
                        child: AnimatedSmoothIndicator(
                          activeIndex: listIndex,
                          count: 5,
                          effect: WormEffect(
                            dotHeight: 9,
                            dotWidth: 9,
                            dotColor: Colors.grey,
                            activeDotColor: Colors.lightBlue,
                            type: WormType.thin,
                          ),
                        )),
                  )
                ],
              ),

0 ответов

Другие вопросы по тегам