telegram_web_app 0.3.1 copy "telegram_web_app: ^0.3.1" to clipboard
telegram_web_app: ^0.3.1 copied to clipboard

Platformweb

Representation and implementation of telegram web/mini apps apis

example/lib/main.dart

import 'package:example/screens/main_screen.dart';
import 'package:flutter/material.dart';
import 'package:telegram_web_app/telegram_web_app.dart';

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 not loading sometimes' bug
    await Future.delayed(const Duration(milliseconds: 200));
    main();
    return;
  }

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Telegram Web App Example',
      theme: TelegramThemeUtil.getTheme(TelegramWebApp.instance),
      home: const MainScreen(),
    );
  }
}
45
likes
150
points
1.8k
downloads

Publisher

unverified uploader

Weekly Downloads

Representation and implementation of telegram web/mini apps apis

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on telegram_web_app