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

套件詳情v1.0.1

dashed_container

一個用於 Flutter 的虛線容器外掛程式,可輕鬆為您的元件加入虛線。

近 30 天下載
79
喜歡數
15
Pub 分數
25

安裝套件

flutter pub add dashed_container

套件介紹

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

dashed_container 套件是 Flutter 插件,可簡化在組件周圍建立虛線邊框的過程。它提供一個易於使用的容器,支援自訂虛線樣式,包括虛線長度、間距、顏色和筆畫寬度。非常適合需要視覺分隔或強調的 UI 元件,例如表單欄位、卡片或裝飾性輪廓。該套件利用 Flutter 的繪圖系統來渲染平滑且可縮放的虛線,無需複雜的自定義繪圖程式碼。透過簡單的 pub 依賴項,可順暢整合至現有的 Flutter 專案中。

適用情境

  • 為UI元件添加虛線邊框
  • 建立表單欄位強調
  • 設計裝飾性卡片輪廓
  • 佈局中的視覺分離
  • 自定邊框外觀

主要特色

  • 虛線邊框的簡單 API
  • 可設定的虛線長度與間距
  • 支援自訂顏色與描邊寬度
  • 輕量且高效
  • 適用於任何內部組件

適合對象

  • 尋求視覺多樣性的UI設計師
  • 開發表單或卡片的開發者
  • 需要輕量級裝飾的專案
  • Flutter 初學者探索自定邊框
  • 具有現代極簡設計的應用程式

使用建議

  • 僅限邊框裝飾
  • 不支援虛線填滿
  • 不處理複雜的裁剪
  • 最適合簡單的矩形形狀
  • 在複雜版面中可能需要手動對齊

原始 README

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

dashed_container

A Dashed Container plugin for Flutter, easy to implement dashed line for your widgets

Demo

Demo:

Usage

To use plugin, just import package import 'package:dashed_container/dashed_container.dart';

Example

You can check example directory to know how to use it like the demo image.

    import 'package:flutter/material.dart';
    import 'package:dashed_container/dashed_container.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(title: 'Flutter Demo Home Page'),
        );
      }
    }

    class MyHomePage extends StatefulWidget {
      MyHomePage({Key key, this.title}) : super(key: key);

      final String title;

      @override
      _MyHomePageState createState() => _MyHomePageState();
    }

    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(title: Text(widget.title)),
          body: SingleChildScrollView(
            child: Center(
              child: Column(
                mainAxisSize: MainAxisSize.max,
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Text('Line container - blankLength = 0'),
                  _buildSpace(),
                  DashedContainer(
                    child: Container(
                      height: 200.0,
                      width: 200.0,
                      decoration: BoxDecoration(color: Colors.blue, borderRadius: BorderRadius.circular(10.0)),
                    ),
                    dashColor: Colors.black,
                    borderRadius: 10.0,
                    dashedLength: 30.0,
                    blankLength: 0.0,
                    strokeWidth: 6.0,
                  ),
                  _buildSpace(),
                  Text('Dashed container - rectangle'),
                  _buildSpace(),
                  DashedContainer(
                    child: Container(
                      height: 100.0,
                      width: 200.0,
                      decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(20.0)),
                    ),
                    dashColor: Colors.black,
                    borderRadius: 20.0,
                    dashedLength: 30.0,
                    blankLength: 6.0,
                    strokeWidth: 6.0,
                  ),
                  _buildSpace(),
                  Text('Dashed container - circle'),
                  _buildSpace(),
                  DashedContainer(
                    child: Container(
                      height: 200.0,
                      width: 200.0,
                      decoration: BoxDecoration(color: Colors.orange, shape: BoxShape.circle),
                    ),
                    dashColor: Colors.black,
                    boxShape: BoxShape.circle,
                    dashedLength: 30.0,
                    blankLength: 6.0,
                    strokeWidth: 6.0,
                  ),
                  _buildSpace(),
                  Text('Dashed container - custom'),
                  _buildSpace(),
                  DashedContainer(
                    child: Padding(
                      padding: const EdgeInsets.all(20.0),
                      child: FlutterLogo(
                        size: 80,
                      ),
                    ),
                    dashColor: Colors.black,
                    boxShape: BoxShape.circle,
                    dashedLength: 30.0,
                    blankLength: 6.0,
                    strokeWidth: 6.0,
                  ),
                  _buildSpace(),
                ],
              ),
            ),
          ),
        );
      }

      Widget _buildSpace() {
        return SizedBox(height: 10.0);
      }
    }

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。