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

solid_bottom_sheet 封面
套件詳情v0.1.13

solid_bottom_sheet

一個完全可自訂的底部彈出式面板,輕鬆實現。只需將其放在 Scaffold 小部件的 bottomSheet 屬性上,就能看到神奇效果。詳細資訊請參閱 README.md。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3040
喜歡數
210
Pub 分數
120

安裝套件

flutter pub add solid_bottom_sheet

套件介紹

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

SolidBottomSheet 是一個高度可自訂的底部抽屜小部件,專為無縫整合到 Scaffold 的 bottomSheet 屬性而設計。它提供流暢的動畫效果,完全控制外觀與行為,並支援所有主要平台,包括行動裝置、網頁和桌面端。透過最少的設定,開發者可以快速實現響應式且視覺上吸引人的底部抽屜,以符合其應用程式的設計。該套件強調易用性,同時不犧牲彈性。

適用情境

  • 實現可摺疊的內容面板
  • 使用拖曳手勢建立互動式浮層
  • 建構動態表單或篩選器
  • 設計自定義導航抽屜
  • 新增可展開的資訊卡片

主要特色

  • 完全可自訂的外觀
  • 平滑的拖動展開動畫
  • 跨平台支援
  • 與 Scaffold 的簡單整合
  • 可設定的高度與吸附點
  • 支援巢狀滾動

適合對象

  • 尋求快速底部表單實現的開發者
  • 在跨平台應用中需要一致的底部抽屜使用者體驗
  • 希望對工作表樣式進行細粒度控制的設計人員
  • 具有複雜底部表單互動的項目

使用建議

  • 可能需要額外的樣式來適應複雜佈局
  • 使用大量內容時的效能影響
  • 有限的內建主題選項
  • 不適合非常大或密集的內容區域

原始 README

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

Solid bottom sheet

Pub

A full customizable bottom sheet easy to implement. Just put it on your bottomSheet property on your Scaffold widget and see the magic. For more details see the README.md. Feel free to contribute. This package is open to recieve pull request on github. Enjoy! :D

Screenshots

Usage

SolidBottomSheet(
        headerBar: Container(), // Your header here
        body: Container(), // Your body here
      ),

Properties

  // This controls the minimum height of the body. Must be greater or equal of 0.
  // By default is 0
  final double minHeight;

  // This controls the minimum height of the body. By default is 500
  final double maxHeight;

  // This is the content that will be hided of your bottomSheet. You can fit any
  // widget. This parameter is required
  final Widget body;

  // This is the header of your bottomSheet. This widget is the swipeable area
  // where user will interact. This parameter is required
  final Widget headerBar;

  // This flag is used to enable the automatic swipe of the bar. If it's true
  // the bottomSheet will automatically appear or disappear when user stops
  // swiping, but if it's false, it will stay at the last user finger position.
  // By default is true
  final bool autoSwiped;

  // This flag enable that the user can toggle the visibility with just tapping on
  // the header bar. By default is false
  final bool toggleVisibilityOnTap;

  // This flag enable that users can swipe the body and hide or show the
  // solid bottom sheet. Turn on false if you don't want to let the user
  // interact with the solid bottom sheet. By default is false.
  final bool draggableBody;
  
  // This flag enable that users can swipe the header and hide or show the 
  // solid bottom sheet. Turn on false if you don't want to let the user 
  // interact with the solid bottom sheet. By default is true. 
  final bool canUserSwipe;

  // This property defines how 'smooth' or fast will be the animation. Low is
  // the slowest velocity and high is the fastest. By default is medium.
  final Smoothness smoothness;

  // This property is the elevation of the bottomSheet. Must be greater or equal
  // to 0. By default is 0.
  final double elevation;

  // This flag controls if the body is shown to the user by default. If it's
  // true, the body will be shown. If it's false the body will be hided. By
  // default it's false.
  final bool showOnAppear;

  // This object used to control behavior internally
  // from the app and don't depend of user's interaction.
  // can hide and show  methods plus have isOpened variable
  // to check widget visibility on a screen
  final SolidController controller;

  // This method will be executed when the solid bottom sheet is completely
  // opened.
  final Function onShow;

  // This method will be executed when the solid bottom sheet is completely
  // closed.
  final Function onHide;

Controller

  // This is the current smoothness of the bottomSheet
  Smoothness smoothness;

  // Returns the value of the height as stream
  Stream<double> heightStream;

  // Returns the value of the visibility as stream
  Stream<bool> isOpenStream;

  // Returns the value of the height
  double height;

  //  Returns if the solid bottom sheet is opened or not
  bool isOpened;

  // This method sets the value of the height using streams
  void height(double value);

  // Updates the visibility value to false
  void hide();

  // Updates the visibility value to true
  void show();

Example

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Solid bottom sheet example"),
      ),
      body: Center(
      child: FlutterLogo(),
      ),
      bottomSheet: SolidBottomSheet(
        headerBar: Container(
          color: Theme.of(context).primaryColor,
          height: 50,
          child: Center(
            child: Text("Swipe me!"),
          ),
        ),
        body: Container(
          color: Colors.white,
          height: 30,
          child: Center(
            child: Text(
              "Hello! I'm a bottom sheet :D",
              style: Theme.of(context).textTheme.display1,
            ),
          ),
        ),
      ),
    );
  }
}

Contribute

Feel free to fork and make pull request to enhance the package.

Github here.

Special Thanks

Viktor Goltstein - Github Nicolei Esperida - Github

Posible incoming features

  • A Shadow that covers the back of the bottom sheet to feel more native.
  • Full view option that displays the bottom sheet like a new navigated page.
  • Controller callbacks to execute when show() and hide() methods are invoked.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。