bible_core 0.1.1 copy "bible_core: ^0.1.1" to clipboard
bible_core: ^0.1.1 copied to clipboard

Core Bible controller, parsing, sources, and offline cache.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:bible_core/bible_core.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late final BibleController controller;

  @override
  void initState() {
    super.initState();
    controller = BibleController(
      sources: {
        'it': 'https://api.getbible.net/v2/riveduta.json',
        'ar':
            'https://www.mediafire.com/file_premium/a289dh7f2b8nqmc/Arabic_Bible.json/file',
      },
      initialLanguage: 'ar',
    );
    controller.loadBible();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('bible_core example')),
        body: AnimatedBuilder(
          animation: controller,
          builder: (context, _) {
            if (controller.loading) {
              return const Center(child: CircularProgressIndicator());
            }
            if (controller.hasError || controller.books.isEmpty) {
              return const Center(child: Text('Error loading'));
            }
            final book = controller.books.first;
            final verses = controller.chapterVerses(book, 1);
            return ListView.builder(
              itemCount: verses.length,
              itemBuilder: (context, index) {
                final v = verses[index];
                return ListTile(
                  title: Text(v.text),
                  leading: Text('${v.verse}'),
                );
              },
            );
          },
        ),
      ),
    );
  }
}
0
likes
135
points
30
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Core Bible controller, parsing, sources, and offline cache.

License

MIT (license)

Dependencies

flutter, http, shared_preferences

More

Packages that depend on bible_core