big_bird 0.0.5 copy "big_bird: ^0.0.5" to clipboard
big_bird: ^0.0.5 copied to clipboard

Библиотека для работы с документами

example/lib/main.dart

import 'dart:io';

import 'package:big_bird/widgets/pdf_viewer.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart' show kIsWeb;

import 'package:flutter/services.dart';
import 'package:big_bird/big_bird.dart';

import 'package:http/http.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  String u = "https://s128vlx.storage.yandex.net/rdisk/5f9a3e2a8bc1b55da2ad54f99121c73a0ee01a708cf26148b6d0e3f34fd686e0/64c6edd3/sCGpPATvdgHiU_Y1g3zCSCX8aZ3EmpY3HpUTbffIMdXB85DF8aj0IUsb-tXk6B1OivelLPu1ivq_d3VB_45ayg==?uid=0&filename=%D0%9B%D0%B0%D0%B1%20%D1%80%D0%B0%D0%B1%20%E2%84%961%20%D0%96%D0%B8%D0%BB%D1%8C%D1%86%D0%BE%D0%B2%20%D0%9D%D0%B8%D0%BA%D0%B8%D1%82%D0%B0%20%D0%98%D0%92%D0%A2-20-1.pdf&disposition=attachment&hash=fGoBQ0AzX1mdm7RmMivoWbL%2BGLdqwbQJqOzRoz0dCXKrMnHzZ3WERb76tAptBDVPq/J6bpmRyOJonT3VoXnDag%3D%3D&limit=0&content_type=application%2Fpdf&owner_uid=611191694&fsize=522667&hid=d439dc5121cea6d8d79c1fda75a3a11a&media_type=document&tknv=v2&rtoken=Jb7cVGbe746j&force_default=no&ycrid=na-bbde1ccbc3496f013dc09bc1fb2b35c5-downloader4f&ts=601bc6a68dac0&s=6a3742134fc27496fc13cd29a52605a3ad2c15bc7d95d3a29ff21f249384fa1c&pb=U2FsdGVkX19Asxr26fQH0HRQ2b0MCRMSoFQrkN7G-Z4mN0TnecJj7w8sQ_CmGaWKLQnkKbn_h85Y5K17U5jq8RNG5og8n5FSSsEvf5ZJwY4";

  final _bigBirdPlugin = BigBird();

  Image? img;

  String? filePath;

  void printDocument() async {

    var url = Uri.parse(u);
    var response = await get(url);

    var bytes = Uint8List.fromList(response.bodyBytes);

    await _bigBirdPlugin.printData(bytes);
  }

  @override
  void initState() {
    super.initState();

    if (!kIsWeb && Platform.isAndroid) {
      initPdfData();
    }

  }

  void initPdfData() async {
    var url = Uri.parse(u);
    var response = await get(url);

    var bytes = Uint8List.fromList(response.bodyBytes);

    filePath = await _bigBirdPlugin.createFile(bytes);

    setState(() {
    });


  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.lightGreen,
          title: Text('BIG BIRD :>'),
        ),
        body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                TextButton(onPressed: printDocument, child: Text("Печать")),

                if (!kIsWeb && Platform.isAndroid && filePath != null)
                  PdfViewer(
                    filePath: filePath!,
                    pdfWidth: 800,
                    pdfHeight: 1000,
                    width: 300,
                    height: 400,
                  )
              ]
          )
        ),
      ),
    );
  }

}
0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Библиотека для работы с документами

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on big_bird