패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.3.3

telegram_web_app

텔레그램 웹/미니 앱 API의 표현 및 구현

Web
30일 다운로드
4.9천
좋아요
67
Pub 점수
150

패키지 설치

flutter pub add telegram_web_app

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Flutter 패키지로, Telegram 웹 앱 및 미니 앱 API의 표현과 구현을 제공하여 Telegram의 웹 기반 애플리케이션과 원활하게 통합할 수 있게 해줍니다. 개발자가 Flutter 웹 앱 내에서 사용자 데이터, 테마 설정, 딥링크와 같은 Telegram 전용 기능에 접근할 수 있도록 합니다. 이 패키지는 웹 환경용으로 설계되었으며 Dart 인터페이스를 통해 Telegram 미니 앱의 모든 기능을 지원합니다.

사용 사례

  • Flutter 웹 앱을 Telegram과 통합하기
  • Telegram 미니 앱 만들기
  • Telegram 사용자 및 테마 데이터에 액세스
  • 텔레그램에서 딥 링크 활성화
  • 텔레그램 내에서 상호작용 웹 경험 만들기

주요 기능

  • 텔레그램 웹 앱 API 바인딩
  • 테마 및 사용자 데이터 액세스
  • 딥 링크 지원
  • 웹 플랫폼 전용
  • 간단한 Dart 인터페이스

적합한 대상

  • 텔레그램 미니 앱을 개발하는 플러터 개발자
  • 텔레그램 사용자를 대상으로 하는 웹 앱 제작자
  • 텔레그램 전용 통합이 필요한 앱

고려 사항

  • 웹 플랫폼에 제한됨
  • 텔레그램 환경이 필요합니다
  • 모바일 또는 데스크톱 지원 없음
  • Telegram 웹 앱 컨텍스트에 따라 다릅니다
  • 독립형 웹 앱에는 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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());
}

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.