FLUTTER ECOSYSTEM

delwar36/overlapped_carousel

一個水平重疊的輪播圖組件。中心組件將位於堆疊的頂部

overlapped_carousel 專案封面
Stars
9
Forks
8
最近推送(UTC)
2024年2月3日
專案狀態
未封存
Md Delwar Hossain GitHub avatar
GITHUB User

Md Delwar Hossain ↗

Entrepreneur | Building Autonomous Workforce

InnovexITBangladesh官方網站 ↗
語言DartSwiftKotlinObjective-C

技術主題

此儲存庫發佈的套件

使用的依賴

依賴清單 2 項
  • flutter{"sdk":"flutter"}
  • flutter_test開發依賴{"sdk":"flutter"}

原始 README

以下為英文專案原文快照,最新內容請造訪 GitHub。

展開 / 收合專案 README

Overlapped Carousel

A horizontal overlapped carousel widget. The center widget will be at the top of the stack.

Demo

Demo 1 Demo 2
demo 1 demo 2

Installation

Add overlapped_carousel: ^1.1.0 to your pubspec.yaml dependencies. And import it:

import 'package:overlapped_carousel/overlapped_carousel.dart';

How to use

Simply add a OverlappedCarousel widget with required params.

  @override
  Widget build(BuildContext context) {
    var screenWidth = MediaQuery.of(context).size.width;
    var screenHeight = MediaQuery.of(context).size.height;
    return Scaffold(
      backgroundColor: Colors.blue,
      //Wrap with Center to place the carousel center of the screen
      body: Center(
        //Wrap the OverlappedCarousel widget with SizedBox to fix a height. No need to specify width.
        child: SizedBox(
          height: min(screenWidth / 3.3 * (16 / 9),screenHeight*.9),
          child: OverlappedCarousel(
            widgets: widgets, //List of widgets
            currentIndex: 2,
            onClicked: (index) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text("You clicked at $index"),
                ),
              );
            },
            // To obscure or blur cards not in focus use the obscure parameter.
            obscure: 0.4,
            // To control skew angle
            skewAngle: 0.25,
          ),
        ),
      ),
    );
  }