Pakete, Repositories und App-Kategorien suchen

Paketdetailsv0.3.3

telegram_web_app

Darstellung und Implementierung der Telegram Web/Mini-Apps-APIs

Web
30-Tage-Downloads
4940
Likes
67
Pub-Punkte
150

Paket installieren

flutter pub add telegram_web_app

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Ein Flutter-Paket, das eine Darstellung und Implementierung der Telegram Web App- und Mini-Apps-APIs bereitstellt und eine nahtlose Integration mit Telegrams webbasierten Anwendungen ermöglicht. Es ermöglicht Entwicklern den Zugriff auf Telegram-spezifische Funktionen wie Benutzerdaten, Theme-Einstellungen und Tiefverknüpfungen innerhalb von Flutter-Web-Apps. Das Paket ist für den Einsatz in Web-Umgebungen konzipiert und unterstützt über Dart-Schnittstellen die gesamte Bandbreite an Telegram Mini-App-Funktionen.

Anwendungsfälle

  • Integration von Flutter-Web-Apps mit Telegram
  • Telegram-Mini-Apps erstellen
  • Zugriff auf Telegram-Nutzer- und Thema-Daten
  • Tiefes Linking in Telegram aktivieren
  • Interaktive Web-Erlebnisse innerhalb von Telegram erstellen

Hauptmerkmale

  • Telegram Web App API-Bindungen
  • Themen- und Benutzerdaten-Zugriff
  • Deep-Linking-Unterstützung
  • Nur Webplattform
  • Einfache Dart-Schnittstelle

Geeignet für

  • Flutter-Entwickler, die Telegram-Mini-Apps erstellen
  • Web-App-Entwickler, die auf Telegram-Nutzer abzielen
  • Apps, die Telegram-spezifische Integrationen erfordern

Hinweise

  • Beschränkt auf Webplattform
  • Erfordert Telegram-Umgebung
  • Keine Unterstützung für Mobil- oder Desktop-Geräte
  • Abhängig vom Telegram-Web-App-Kontext
  • Nicht geeignet für eigenständige Webanwendungen

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

Telegram Web App

telegram_web_app version

Build telegram web apps in flutter using telegram_web_app library

Getting Started

  1. Import Library in your pubspec.yaml
  2. And add this line in web/index.html
<head>
    <script src="https://telegram.org/js/telegram-web-app.js" defer=""></script>
</head>

Checkout details of available telegram_web apis here You can also find detailed examples in example project.

Setup for development

  1. Enable debugging in telegram web app. Checkout this post for more details
  2. Then navigate to \example folder
  3. Deploy the example app via firebase or any other hosting service. You can find firebase hosting documentation here
  4. Create web app in telegram
  5. Use the website url to load the webapp in telegram
  6. You can also inspect the app with Javascript logs via debugging as described here
  7. For more info and support, you can join telegram group flutter_telegram

Here is an article on how to deploy web to Firebase and link to Telegram web app 👉 Telegram Mini Apps

How to use

There is a class TelegramWebApp which contains all the telegram web apis. You can call the methods via TelegramWebApp.instance You can also mock TelegramWebApp by extending it if you are trying to test outside telegram platform. Alternatively, TelegramWebAppFake object can also be used for the same purpose.

Example
// current telegram version
Text(TelegramWebApp.instance.version)

// telegram colors associated with the user's app
Text(TelegramWebApp.instance.themeParams)

// Object containing user details and user validation hash
Text(TelegramWebApp.instance.initData.toString())

You can find full list of api examples in example folder. Please feel free to contribute for improvements and any updates.

Note
  1. All the apis are only available inside telegram web app. You can't use the apis outside the platform.

  2. In Android, Web App is sometimes not loading (only grey/white screen showing up). If this happens to you, there is a 'hacky' workaround. You can also find it in example app:

void main() async {
  try {
    if (TelegramWebApp.instance.isSupported) {
      TelegramWebApp.instance.ready();
      Future.delayed(const Duration(seconds: 1), TelegramWebApp.instance.expand);
    }
  } catch (e) {
    print("Error happened in Flutter while loading Telegram $e");
    // add delay for 'Telegram seldom not loading' bug
    await Future.delayed(const Duration(milliseconds: 200));
    main();
    return;
  }

  FlutterError.onError = (details) {
    print("Flutter error happened: $details");
  };

  runApp(const MyApp());
}

Kategorien

Quell-Repository

Projekte, die dieses Paket verwenden

Noch keine Daten verfügbar.