import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:prasule/pw/platformbutton.dart';
import 'package:url_launcher/url_launcher_string.dart';

/// Shows an [AboutDialog] with all the data filled,
/// so I don't have to copypaste the same function everywhere
void showAbout(BuildContext context) {
  showAboutDialog(
    context: context,
    applicationLegalese: AppLocalizations.of(context).license,
    applicationName: "Prašule",
    applicationVersion: "1.1.1",
    applicationIcon: const CircleAvatar(
      backgroundImage: AssetImage("assets/icon/full_ico.png"),
    ),
    children: [
      PlatformButton(
        text: "Tessdata",
        onPressed: () {
          unawaited(
            launchUrlString(
              "https://github.com/tesseract-ocr/tessdata_fast",
            ),
          );
        },
      ),
      PlatformButton(
        text: AppLocalizations.of(context).sourceCode,
        onPressed: () {
          unawaited(launchUrlString("https://git.mnau.xyz/hernik/prasule"));
        },
      ),
    ],
  );
}
