full_calender 1.0.0 copy "full_calender: ^1.0.0" to clipboard
full_calender: ^1.0.0 copied to clipboard

The Full Calendar Flutter Library facilitates seamless conversion between solar and lunar calendars, with a focus on the Vietnamese lunar calendar system. Developed by Louis Vu, the library supports a [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:full_calender/enums/branch.dart';
import 'package:full_calender/enums/language_name.dart';
import 'package:full_calender/enums/time_zone.dart';
import 'package:full_calender/full_calender.dart';
import 'package:full_calender/full_calender_extension.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<StatefulWidget> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    final lunarDate = FullCalender.now(TimeZone.vietnamese.timezone).lunarDate;
    final solarDate =
        FullCalenderExtension.convertLunarDateToSolarDate(lunarDate);
    final lstLuckyHour = lunarDate.listLuckyHours;
    final lstHour = lunarDate.listStemBranchOfHour;
    return Scaffold(
      appBar: AppBar(
        title: const Text('Full Calendar Example'),
      ),
      body: Center(
        child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
          Text(
            'Solar Date: $solarDate',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          Text(
            'Julian Day: ${FullCalenderExtension.convertLunarDateToJulianDay(lunarDate)}',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          const SizedBox(height: 20),
          Text(
            'Lunar Date: $lunarDate',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          Text(
            'Year: ${lunarDate.stemBranchOfYear.name(LanguageName.vietNam)}',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          Text(
            'Month: ${lunarDate.stemBranchOfMonth.name(LanguageName.vietNam)}',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          Text(
            'Day: ${lunarDate.stemBranchOfDay.name(LanguageName.vietNam)}',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          Text(
            'First hour: ${lunarDate.listStemBranchOfHour[0].name(LanguageName.vietNam)}',
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
          ListView.builder(
            itemBuilder: (context, index) {
              var str = lstHour[index].name(LanguageName.vietNam);
              str +=
                  '(${lstHour[index].branch.hourRange[0]}-${lstHour[index].branch.hourRange[1]})';
              str += ': ${lstLuckyHour[index] ? 'Lucky' : 'Unlucky'}';
              return ListTile(title: Text(str));
            },
            itemCount: lstHour.length,
          )
        ]),
      ),
    );
  }
}
43
likes
0
points
267
downloads

Publisher

unverified uploader

Weekly Downloads

The Full Calendar Flutter Library facilitates seamless conversion between solar and lunar calendars, with a focus on the Vietnamese lunar calendar system. Developed by Louis Vu, the library supports additional lunar calendar systems, including Chinese, Japanese, and Korean. Explore detailed lunar date properties such as Stem-Branch (Can-Chi/ganzhi) representations.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on full_calender