Giter Site home page Giter Site logo

web app about abcquran HOT 3 OPEN

aminsedghi2 avatar aminsedghi2 commented on May 31, 2024
web app

from abcquran.

Comments (3)

aminsedghi2 avatar aminsedghi2 commented on May 31, 2024

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

from abcquran.

jomtek avatar jomtek commented on May 31, 2024

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.

from abcquran.

aminsedghi2 avatar aminsedghi2 commented on May 31, 2024

من ساختار مصحف و فهرست سوره ها را برای اندروید میخوام
یک کد هم دارم ولی به خوبی کار نمکینه
`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
}
}`

from abcquran.

Related Issues (2)

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.