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

url_textformfield 封面
套件詳情v1.0.0

url_textformfield

專為輸入 URL 設計的文本框,支援在輸入內容的開頭和結尾添加前置和後置文字

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
11
喜歡數
1
Pub 分數
150

安裝套件

flutter pub add url_textformfield

套件介紹

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

一個專門用於 URL 輸入的 Flutter TextFormField,提供內建驗證功能,並支援在使用者輸入前後附加自訂文字。它透過自動加入常見的 URL 前綴(如 'https://')或結尾斜線來提升使用便利性,減少使用者錯誤。適用於需要結構化網址的表單,支援多個平台,包括行動裝置、Web 與桌面。此套件簡化 URL 格式化,同時透過可自訂的前置與後置內容維持彈性。

適用情境

  • 表單中的網址輸入
  • 自動格式化帶有 HTTPS 前綴的 URL
  • 向不完整的URL添加尾部斜杠
  • 自定義 URL 模式強制執行
  • 多平台URL輸入
  • 減少手動輸入錯誤

主要特色

  • 自動新增 URL 前綴
  • 支援前置與後置文字
  • 內建的 URL 驗證
  • 跨平台相容性
  • 可設定的輸入格式化
  • 與現有表單的簡單整合

適合對象

  • 使用 URL 輸入欄位建構表單的開發者
  • 需要一致 URL 格式的應用
  • 針對 Android、iOS、Web、macOS、Windows 與 Linux 的專案
  • 重視使用者體驗的資料輸入
  • 尋求最小樣板程式碼的前端開發人員

使用建議

  • 可能需要針對邊緣情況進行額外驗證
  • 僅限特定於URL的格式化
  • 依賴於前綴/尾端文字的正確設定
  • 不適用於非URL文字輸入
  • 假設標準 URL 結構
  • 不處理超出基本格式的複雜URL解析

原始 README

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

url_textformfield

Textformfield designed for inputing urls, with options to add leading and trailing text, appended at begining and end of input

Getting Started

Add this to your package's pubspec.yaml file


dependencies:
  url_textformfield: ^1.0.0

Usage

First, you just have to import the package using:

import 'package:url_textformfield/url_textformfield.dart';

Then , use the widget as below,


  @override
  Widget build(BuildContext context) {
    return UrlTextFormField(
      focusNode: ctrlFocusNode,  
      padding: const EdgeInsets.all(10),
      onChanged: (val) {},
      leadingText: 'https://',
      suffixIcon: const Icon(
        Icons.check,
        color: Colors.green,
      ),
      trailingText: ".com",
    );

Example

screenshot

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。