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

套件詳情v0.1.1

dash_flags

一個用於顯示國家和語言旗幟的套件,包含一組小部件和列舉

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2440
喜歡數
72
Pub 分數
160

安裝套件

flutter pub add dash_flags

套件介紹

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

dash_flags 是一個 Flutter 套件,提供一組用於顯示國家和語言旗幟的元件和列舉。它透過提供跨平台一致且預先定義的旗幟表示,簡化了在應用程式中整合旗幟圖示的過程。該套件支援多種平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,確保廣泛的相容性。開發者可以使用直覺的列舉輕鬆選擇和顯示旗幟,非常適合用於本地化、使用者介面增強或區域功能。

適用情境

  • 在使用者個人檔案中顯示國家旗幟
  • 實現語言選擇介面
  • 增強本地化UI
  • 在應用中顯示區域指示符
  • 建立多語言應用程式介面

主要特色

  • 預建的旗幟小部件
  • 支援國家與語言旗幟
  • 平台無關設計
  • 直觀的基於列舉的旗標選擇
  • 輕量且易於整合

適合對象

  • 地區化功能
  • 多語言應用程式
  • 使用者檔案自訂
  • 基於區域的內容過濾
  • 透過視覺提示增強使用者介面/體驗

使用建議

  • 限於預定義的旗標集合
  • 不支援自定旗標
  • 依賴外部標誌資產
  • 可能需要為新的國家/語言代碼更新
  • 未針對大規模高性能量旗渲染進行優化

原始 README

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

Dash Flags Banner

Dash Flags

Platform Pub Package License: BSD-3-Clause
GitHub code size in bytes Star on GitHub GitHub Open Issues GitHub Last Commit Date


💡 Overview

A Flutter package for displaying Countries and Languages flags 🌍

This package provides a set of widgets and enums to display flags of countries and languages inspired by blade-flags package for Laravel by Mohamed Ashraf from Egypt.

The package uses flags from TwEmoji Countries & Languages Flags by Twitter

Animated Example
This GIF is taken from the Example Project

💻 Usage

Import the package:

import 'package:dash_flags/dash_flags.dart';

Display a flag of a country:

CountryFlag(
  country: Country.eg, // OR Country.fromCode('eg')
  height: 50,
)

Display a flag of a language:

LanguageFlag(
  language: Language.ar, // OR Language.fromCode('ar')
  height: 50,
)

Display a flag of a timezone:

TimezoneFlag(
  timezone: Timezone.africa_cairo, // OR Timezone.fromString('Africa/Cairo')
  height: 50,
)

📘 You can checkout the complete API Reference here

📃 Notes

Countries & Languages Codes:
  • If you have the Country Code or Language Code as Strings, then you can use Country.fromCode(countryCode) or Language.fromCode(languageCode).
  • If the the Country Code or Language Code consists of more than one part, then you will find it separated by an underscore, for example: sh_ac and en_au.
  • If the the Country Code or Language Code is a reserved keyword in Dart, then you will find it prefixed with c_ or l_ respectively, for example: c_as and l_as.
  • If an unknown Country Code or Language Code used with .fromCode(String) method, an unknown flag would be displayed.
Timezones Codes:
  • The forward slash sign / in the name of the timezone is replaced with an underscore _.
  • If the Timezone contains minus - sign, then you will find it replaced with _minus_, for example: US_East_minus_Indiana, US_Indiana_minus_Starke, and Asia_Ust_minus_Nera
  • If the Timezone contains plus + sign, then you will find it replaced _plus_, for example: Etc_GMT_plus_0, Etc_GMT_plus_1, and Etc_GMT_plus_10
  • If the Timezone is associated with more than one country, then you will find a default enum member for it and other enum members for each country, for example: Africa_Johannesburg, Africa_Johannesburg_ZA, Africa_Johannesburg_LS, and Africa_Johannesburg_SZ
  • If you have the Timezone as String and you want to get the corresponding Timezone enum member, then you can use .fromString() method.
  • If you want to use the Timezone with its original name without the above changes, then use .fromString() method, for example: Timezone.fromString('Africa/Cairo')

✅ Roadmap

  • [ ] Add Tests 🧪
  • [ ] Add a simple way to use the raw svg assets 🎨
  • [ ] Make an online Gallery with all the available flags 📘
  • [ ] Add the ability to use the flags from the internet, such as, CountryFlag.network(...) 🌐
  • [ ] Add the ability to automatically detect the current Country or Language, such as, Country.autoDetect & Language.autoDetect 🕵🏻‍♂️

💖 Laravel Version

If you are looking for a Laravel Version of this package, check blade-flags, the original parent package of this library which that provides a set of flags for all countries and languages by Mohamed Ashraf from Egypt.

Blade Flags Banner

💪🏻 Contribution Guide

I would be happy to have your contributions 💙

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an Issue.
If you fixed a bug or implemented a feature, please send a Pull Request.

Made with contrib.rocks.

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案