搜尋套件、儲存庫與 APP 分類

flutter_custom_carousel_slider 封面
套件詳情v1.2.0

flutter_custom_carousel_slider

一個輪播圖滑塊組件,支援自訂裝飾,適用於新聞和部落格。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
50
喜歡數
36
Pub 分數
150

安裝套件

flutter pub add flutter_custom_carousel_slider

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個可自訂的輪播滑塊小組件,專為顯示新聞和部落格內容而設計,並提供靈活的裝飾選項。基於 Flutter 建構,支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。此套件讓開發者能夠建立視覺吸引人、互動性高的滑塊,具備客製化外觀與行為。非常適合以可滾動格式展示精選文章、產品亮點或動態內容。該小組件輕巧,並能順暢整合至現有的 Flutter 專案中。

適用情境

  • 顯示精選新聞文章
  • 展示部落格文章
  • 突出顯示產品促銷
  • 建立互動式內容輪播
  • 使用自定樣式展示圖片畫廊

主要特色

  • 可客製化的滑動裝飾
  • 對多個平台的支援
  • 與 Flutter 的輕鬆整合
  • 響應式設計功能
  • 平滑滾動動畫
  • 可設定的滑動過渡效果

適合對象

  • 新聞和部落格應用
  • 電子商務產品展示
  • 內容豐富的行動與網頁應用
  • 互動式 UI 組件
  • 尋求視覺靈活性的設計人員

使用建議

  • 需要手動處理簡報資料管理
  • 除了基本的滑動操作外,內建的手勢控制功能有限
  • 可能需要額外的狀態管理來處理複雜用例
  • 未針對沒有分頁的超大資料集進行優化
  • 依賴外部依賴項以實現進階功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Developer Challenge

flutter_custom_carousel_slider

A carousel slider Flutter widget, supports custom decoration suitable for news and blog.

Table of contents

Demo

Supported Platforms

  • Flutter Android
  • Flutter iOS
  • Flutter web
  • Flutter desktop

Installation

dependencies:
  flutter_custom_carousel_slider: ^1.0.0

Using

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Custom Carousel Slider Demo'),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<CarouselItem> itemList = [
    CarouselItem(
      image: const NetworkImage(
        'https://miro.medium.com/max/1400/1*RpaR1pTpRa0PUdNdfv4njA.png',
      ),
      boxDecoration: BoxDecoration(
        gradient: LinearGradient(
          begin: FractionalOffset.bottomCenter,
          end: FractionalOffset.topCenter,
          colors: [
            Colors.blueAccent.withOpacity(1),
            Colors.black.withOpacity(.3),
          ],
          stops: const [0.0, 1.0],
        ),
      ),
      title:
          'Push your creativity to its limits by reimagining this classic puzzle!',
      titleTextStyle: const TextStyle(
        fontSize: 12,
        color: Colors.white,
      ),
      leftSubtitle: '\$51,046 in prizes',
      rightSubtitle: '4882 participants',
      rightSubtitleTextStyle: const TextStyle(
        fontSize: 12,
        color: Colors.black,
      ),
      onImageTap: (i) {},
    ),
    CarouselItem(
      image: const NetworkImage(
        'https://pbs.twimg.com/profile_banners/1444928438331224069/1633448972/600x200',
      ),
      title: '@coskuncay published flutter_custom_carousel_slider!',
      titleTextStyle: const TextStyle(
        fontSize: 12,
        color: Colors.white,
      ),
      leftSubtitle: '11 Feb 2022',
      rightSubtitle: 'v1.0.0',
      onImageTap: (i) {},
    ),
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Center(
          child: Column(
            children: [
              const SizedBox(height: 20),
              Column(
                children: [
                  const Text('Custom BoxDecoration and Autoplay'),
                  CustomCarouselSlider(
                    items: itemList,
                    height: 150,
                    subHeight: 50,
                    width: MediaQuery.of(context).size.width * .9,
                    autoplay: true,
                  ),
                ],
              ),
              const SizedBox(height: 20),
              Column(
                children: [
                  const Text('Show Only Customize Indicators'),
                  CustomCarouselSlider(
                    items: itemList,
                    height: 150,
                    subHeight: 50,
                    width: MediaQuery.of(context).size.width * .9,
                    autoplay: false,
                    showText: false,
                    showSubBackground: false,
                    indicatorShape: BoxShape.rectangle,
                    selectedDotColor: Colors.red,
                    unselectedDotColor: Colors.white,
                  ),
                ],
              ),
              const SizedBox(height: 20),
              Column(
                children: [
                  const Text('Show only images and Autoplay'),
                  CustomCarouselSlider(
                    items: itemList,
                    height: 150,
                    subHeight: 50,
                    width: MediaQuery.of(context).size.width * .9,
                    autoplay: true,
                    showSubBackground: false,
                    showIndicator: false,
                    showText: false,
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

CustomCarouselSlider

Name Type Default
items List *required
height double 200.0
subHeight double height*.4
width double 200.0
showIndicator bool true
showSubBackground bool true
showText bool true
autoplay bool true
animationCurve Curve Curves.ease
animationDuration Duration 300ms
autoplayDuration Duration 3s
indicatorShape BoxShape BoxShape.circle
dotSpacing double 5.0
selectedDotColor Color Colors.white
selectedDotHeight double 8.0
selectedDotWidth double 8.0
unselectedDotColor Color Color(0XFFACAEBA)
unselectedDotHeight double 6.0
unselectedDotWidth double 6.0
boxPaddingHorizontal double 10.0
boxPaddingVertical double 2.0

CarouselItem

Name Type
image NetworkImage
title String
titleTextStyle TextStyle
leftSubtitle String
leftSubtitleTextStyle TextStyle
rightSubtitle String
rightSubtitleTextStyle TextStyle
onImageTap Function(int)
boxDecoration BoxDecoration

License

MIT Copyright (c) 2022, Emre Coşkunçay

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。