jomtek / AbcQuran

A lightweight, fast multi-platform Quran reader
BSD 3-Clause "New" or "Revised" License
36 stars 7 forks source link

web app #2

Open aminsedghi2 opened 10 months ago

aminsedghi2 commented 10 months ago

سلام علیکم بنده ایرانی هستم آیا طبق رسم الخط عثمان طه و 15 خطی هست؟ پروژه خروجی وب نداره؟ اجرکم عندالله

aminsedghi2 commented 10 months ago

آیا آنلاین هست؟ چطوری باید اینو به پروژه خودم اضافه کنم؟

jomtek commented 9 months ago

Assalam u alaykoum The app should be convertible into a web-app with a tiny bit of work! Mostly, the caching system should be rewritten. However, it's not part of my plan right now, but you are free to fork it and try to make it web compatible on your own though. -> First, you might wanna try to build it for the web, and fix errors one by one. I can assist you further.

aminsedghi2 commented 9 months ago

من ساختار مصحف و فهرست سوره ها را برای اندروید میخوام یک کد هم دارم ولی به خوبی کار نمکینه `import 'dart:ffi'; import 'package:app/defaultColors.dart'; import 'package:flutter/material.dart'; import 'dart:io'; import 'package:flutter/services.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sqflite/sqflite.dart'; import 'package:sqflite_common_ffi/sqflite_ffi.dart';

class Quran extends StatefulWidget { @override _QuranState createState() => _QuranState(); }

class _QuranState extends State { late Future _database; late PageController _pageController; int pageNumber = 4;

@override void initState() { super.initState(); _pageController = PageController(initialPage: 4); _database = initDatabase(); }

final DynamicLibrary sqlite3 = Platform.isWindows ? DynamicLibrary.open('assets/SQLite3.dll') : DynamicLibrary.process();

Future initDatabase() async { Directory directory = await getApplicationDocumentsDirectory(); String databasesPath = directory.path;

var path = join(databasesPath, "moshaf15.db");

var exists = await databaseExists(path);

if (!exists) {
  try {
    await Directory(dirname(path)).create(recursive: true);
  } catch (_) {}
  ByteData data = await rootBundle.load(join("assets/db/moshaf15.db"));
  List<int> bytes =
      data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes);
  await File(path).writeAsBytes(bytes, flush: true);
}

return await openDatabase(path);

}

Future<List<List>> fetchPage(int pageNumber) async { final Database db = await _database; final List<Map<String, dynamic>> result = await db.rawQuery( 'SELECT code, line_number FROM glyph WHERE page_number = $pageNumber ORDER BY line_number', );

List<List<String>> lines = List.generate(15, (index) => []);
for (var row in result) {
  int lineNumber = row['line_number'];
  if (lineNumber >= 0 && lineNumber < lines.length) {
    lines[lineNumber].add(row['code'].toString());
  }
}

return lines;

}

@override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; double heightSunWidth = (height + width); double fontSize = (height * width) / 11000;

return Scaffold(
  appBar: AppBar(
    actions: [IconButton(icon: Icon(Icons.abc),onPressed: () {
      pageNumber++;
      initDatabase();
    }),],
    title: Text(
      pageNumber.toString(),
      style: TextStyle(
        fontSize: heightSunWidth / 60,
        fontFamily: "Vazir-semibold",
      ),
    ),
    centerTitle: true,
    backgroundColor: DefaultColor.successGreen,
  ),
  body: Padding(
    padding: const EdgeInsets.all(8.0),
    child: PageView.builder(
      controller: _pageController,
      itemCount: 604,
      onPageChanged: (value) {
        setState(() {
          pageNumber = _pageController.page?.round() ?? 1;
        });
      },
      itemBuilder: (context, index) {
        return FutureBuilder<List<List<String>>>(
          future: fetchPage(index + 1),
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) {
              return Center(child: CircularProgressIndicator());
            } else if (snapshot.hasError) {
              return Center(child: Text('Error: ${snapshot.error}'));
            } else {
              return GridView.builder(
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                  crossAxisCount: 1,
                  childAspectRatio: MediaQuery.of(context).size.width /
                      (MediaQuery.of(context).size.height / 15),
                ),
                itemCount: snapshot.data!.length,
                itemBuilder: (BuildContext context, int index) {
                  return FittedBox(
                    child: Center(
                      child: Text(
                        snapshot.data![index]
                            .map((code) =>
                                String.fromCharCode(int.parse(code)))
                            .join(''),
                        style: TextStyle(
                            fontFamily: "p$pageNumber", fontSize: 24),
                      ),
                    ),
                  );
                },
              );
            }
          },
        );
      },
    ),
  ),
);

photo_2024-01-23_10-30-27 photo_2024-01-23_10-30-31 } }`