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

loading_btn 封面
套件詳情v1.0.3

loading_btn

一個動畫加載按鈕套件,可讓您創建具有多種自定義屬性的美觀加載按鈕。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
308
喜歡數
28
Pub 分數
140

安裝套件

flutter pub add loading_btn

套件介紹

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

loading_btn 是一個 Flutter 套件,提供可自訂樣式與行為的動畫載入按鈕。它讓開發者能夠建立在正常狀態與載入狀態之間順暢過渡的視覺吸引力按鈕,非常適合需要使用者回饋的表單或動作。透過廣泛的自訂選項(包含顏色、形狀、動畫與文字),提升跨平台的使用者體驗。此套件支援所有主要的 Flutter 平台,使其適用於跨平台應用。

適用情境

  • 表單提交
  • 使用者驗證流程
  • 資料擷取動作
  • 互動式 UI 元素
  • 載入狀態指示器

主要特色

  • 可自訂的動畫持續時間
  • 支援多種載入樣式
  • 可設定的按鈕顏色和形狀
  • 響應式設計支援
  • 與現有組件的輕鬆整合
  • 跨平台相容性

適合對象

  • 開發互動式應用的開發者
  • 注重設計的UI實作
  • 需要明確加載反饋的應用程式
  • 重視使用者體驗的團隊
  • 頻繁表單互動的專案

使用建議

  • 可能需要額外的樣式設定以實現複雜設計
  • 大量實例帶來的效能影響
  • 有限的內建錯誤處理
  • 依賴外部動畫庫
  • 不適用於非互動式按鈕使用案例

原始 README

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

Loading Btn

Create animated loading button using loading_btn package with lots of properties.

Getting started

Loading Btn package helps you create beautiful loading animation in your buttons with customized loader. Loading Btn is basically an ElevatedButton widget that means you can use the usual parameters with a few extra functionalities.

Demo

Usage

Loading Button with CircularProgress widget
LoadingBtn(
    height: 50,
    borderRadius: 8,
    animate: true,
    color: Colors.green,
    width: MediaQuery.of(context).size.width * 0.45,
    loader: Container(
        padding: const EdgeInsets.all(10),
        width: 40,
        height: 40,
        child: const CircularProgressIndicator(
            valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
        ),
    ),
    child: const Text("Login"),
    onTap: (startLoading, stopLoading, btnState) async {
        if (btnState == ButtonState.idle) {
            startLoading();
            // call your network api
            await Future.delayed(const Duration(seconds: 5));
            stopLoading();
        }
    },
),
Loading Button with custom Text
LoadingBtn(
    height: 50,
    borderRadius: 8,
    roundLoadingShape: false,
    color: Colors.blueAccent,
    width: MediaQuery.of(context).size.width * 0.45,
    minWidth: MediaQuery.of(context).size.width * 0.30,
    loader: const Text("Loading..."),
    child: const Text("Login"),
    onTap: (startLoading, stopLoading, btnState) async {
        if (btnState == ButtonState.idle) {
            startLoading();
            // call your network api
            await Future.delayed(const Duration(seconds: 5));
            stopLoading();
        }
    },
),
Loading Button with custom loading
LoadingBtn(
    height: 50,
    borderRadius: 8,
    animate: true,
    color: Colors.deepOrange,
    width: MediaQuery.of(context).size.width * 0.45,
    loader: Container(
      padding: const EdgeInsets.all(10),
      child: const Center(
          child: SpinKitDoubleBounce(
            color: Colors.white,
          ),
      ),
    ),
    child: const Text("Login"),
    onTap: (startLoading, stopLoading, btnState) async {
        if (btnState == ButtonState.idle) {
            startLoading();
            // call your network api
            await Future.delayed(const Duration(seconds: 5));
            stopLoading();
        }
    },
),

Properties

  • animate(Default false) : It uses width to animate while click on button
  • roundLoadingShape(Default true) : It uses borderRadius to creates a round button while in Busy/Loading state
  • width : Width of the button when in Idle state
  • minWidth : Width of the button when in Busy/Loading state. Default value is equal to height in order to create a completely round loading button
  • borderRadius : Border Radius of the button
  • borderSide : BorderSide in order to give border color and width to the button
  • child : Contents of button when in Idle state
  • loader : Contents of button when in Busy/Loading state
  • onTap : (startLoading, stopLoading, btnState) : Function that is called when you click on the button
  • duration : Duration of the animation
  • curve : Curve of animation
  • reverseCurve : Curve of reverse animation

MIT License

Copyright (c) 2022 Yasin Mohammadi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。