Git Product home page Git Product logo

flutter_telegram_web_app's Introduction

Medium Github Badge Linkedin Badge Gmail Badge Instagram Badge

Hello! Welcome to my profile :octocat:

  • ๐Ÿ”ญ Iโ€™m currently working on Mobile & Web development
  • ๐ŸŒฑ Dart, ๐Ÿ’™ Flutter, Java, Kotlin, Javascript, Python, Swift, PHP, HTML
  • ๐Ÿ‘ฏ Looking to contribute with the organization and Opensource Flutter Apps/Libraries and Web projects ,
  • ๐Ÿ“ซ How to reach me : Telegram
  • โšก Passionate about new mobile technologies.



flutter_telegram_web_app's People

Contributors

rohitsangwan01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

flutter_telegram_web_app's Issues

JsCallback of showScanQrPopup returns [object Object] instead of QR string result

How to get QR string from data param in JsCallback?
As deep as I could dive - data is minified Q object and have no thoughts how to get string from it

The code below (which has taken from example and a little bit modified) leads to this:
telegram-cloud-photo-size-2-5348490884032877701-y


import 'package:flutter/material.dart';

import 'common_widgets.dart';
import 'package:flutter_telegram_web_app/flutter_telegram_web_app.dart' as tg;
import 'package:flutter_telegram_web_app/flutter_telegram_web_app.dart';
import 'main.dart';

class HomeView extends StatefulWidget {
  const HomeView({super.key});

  @override
  State<HomeView> createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
  String? qrText = "No QR yet...";
  bool isStateStable = true;

  @override
  void initState() {
    onEvent(TelegramWebEventType.qrTextReceived, JsCallback<dynamic>((data) {
      String text = '';
      try {
        text = "${data?.toString() ?? 'data is null'} of type  ${data
            ?.runtimeType ?? ''}";
      } catch (e) {
        text = "Error: $e {$data}";
      }
      showAlert(text);
      qrText = text;
      setState(() {});
      tg.closeScanQrPopup();
    }));

    TelegramWebEvent.setThemeChangeListener(
        (bool isDarkMode, ThemeParams themeParams) {
      setState(() {});
      updateThemeMode();
    });

    TelegramWebEvent.setViewPortChangeListener(
        (bool isStable, height, stableHeight) {
      setState(() {
        isStateStable = isStable;
      });
    });

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body:
        Center(
            child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(qrText ?? 'No QR yet...'),
                  KButton(
                      text: "Open QR Scanner",
                      onTap: () => tg.showScanQrPopup((
                                  text: "Scan QR",
                                  JsCallback<dynamic>((data) {
                              showAlert("${data?.toString() ?? 'data is null'} of type  ${data?.runtimeType ?? ''}");
                              qrText = "${data?.toString() ?? 'data is null'} of type  ${data?.runtimeType ?? ''}";
                              tg.closeScanQrPopup();
                              })
                          ))
                  )
                  ])
      )
    );
  }
}

Any ideas could help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.