offline_zen_stories 0.0.211 copy "offline_zen_stories: ^0.0.211" to clipboard
offline_zen_stories: ^0.0.211 copied to clipboard

A Flutter package that provides calming Zen stories when offline.

Offline Zen Stories #

A Flutter package that provides randomized calming short stories or motivational quotes when the app detects no internet connection. Turn frustrating offline moments into peaceful, uplifting ones.


Features #

  • Offline Stories & Quotes: A collection of inspiring and calming stories to reduce stress.
  • Network Detection: Automatically detects when the device goes offline.
  • Beautiful UI: Display story cards with smooth animations using Lottie.
  • Simple Integration: Easy to add to any Flutter app.

Installation #

  1. Add the package to your pubspec.yaml:

    dependencies:
      offline_zen_stories:
        git: https://github.com/Suneel-DK/Offline-Zen-Stories
    
  2. Run flutter pub get to fetch the package.

  3. Ensure you add the required connectivity_plus and lottie dependencies:

    dependencies:
      connectivity_plus: ^4.0.1
      lottie: ^2.2.0
    
  4. Add your custom Lottie animation file if needed in the assets/ directory.


Usage #

Basic Example #

import 'package:flutter/material.dart';
import 'package:offline_zen_stories/zen_helper.dart';
import 'package:offline_zen_stories/zen_story_card.dart';

void main() => runApp(ZenApp());

class ZenApp extends StatefulWidget {
  @override
  _ZenAppState createState() => _ZenAppState();
}

class _ZenAppState extends State<ZenApp> {
  final ZenHelper _zenHelper = ZenHelper();
  String _story = "Check your internet to get calm vibes.";

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

  Future<void> checkOfflineMode() async {
    if (await _zenHelper.isOffline()) {
      setState(() {
        _story = _zenHelper.getRandomZenStory();
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text("Offline Zen Stories")),
        body: Center(child: ZenStoryCard(text: _story)),
      ),
    );
  }
}

API Reference #

ZenHelper #

  • Future<bool> isOffline() — Checks whether the device is currently offline.
  • String getRandomZenStory() — Returns a random Zen story.
  • String getRandomQuote() — Returns a random motivational quote.

ZenStoryCard #

  • A widget to display beautiful animated story cards.
  • Constructor: ZenStoryCard({required String text})

Customization #

  • Replace or extend the story and quote collections in zen_stories_data.dart.
  • Use your custom Lottie animation by replacing meditation.json.

License #

MIT License

1
likes
0
points
18
downloads

Publisher

verified publishersuneeldk.in

Weekly Downloads

A Flutter package that provides calming Zen stories when offline.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

connectivity_plus, flutter, http, lottie

More

Packages that depend on offline_zen_stories