shamsi_date 0.10.0-nullsafety.0
shamsi_date: ^0.10.0-nullsafety.0 copied to clipboard
A Flutter package for using Jalali (Shamsi, Solar, Persian or Jalaali) calendar. You can convert, format and manipulate Jalali and Gregorian (Miladi) dates.
example/lib/main.dart
// Copyright 2018 - 2020, Amirreza Madani. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:shamsi_date/shamsi_date.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'shamsi_date example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
String _format(Date date) {
final f = date.formatter;
return '${f.wN} ${f.d} ${f.mN} ${f.yy}';
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('shamsi_date example'),
),
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
_format(Gregorian.now()),
style: Theme.of(context).textTheme.headline5,
),
SizedBox(
height: 16.0,
),
Text(
_format(Jalali.now()),
style: Theme.of(context).textTheme.headline5,
),
],
),
),
),
);
}
}