date_strip_report 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 60

Flutter DateTime Strip Report

Easy to use and beautiful datetime strip control for Flutter.

If this project has helped you out, please support us with a star. 🌟 #

Install #

dependencies:
          ...
          date_strip_report: ^1.0.0

Usage Example #


    Container(
        child: DateStripReport(
          onDateSelected: onSelect,
          isShowMonth: true,
          isShowHalfYear: true,
          isShowQuarter: true,
          isShowYear: true,
          startDate: new DateTime(2020,1,1),
          endDate: new DateTime(2021,1,1),
          selectedColor: Colors.green,
          unSelectedColor: Colors.white,
          locale: LocaleType.en,
        )
      )

Full Example #

import 'package:date_strip_report/date_strip_report.dart';
import 'package:date_strip_report/i18n_calendar_strip.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
            primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
     });
  }

  @override
  Widget build(BuildContext context) {

    onSelect(data) {
      print("Selected Date -> $data");
    }

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Container(
        padding: EdgeInsets.all(20),
        child: DateStripReport(
          startDate: new DateTime(2020,1,1),
          endDate: new DateTime(2021,1,1),
          isShowMonth: true,
          isShowHalfYear: true,
          isShowQuarter: true,
          isShowYear: true,
          textColor: Colors.green,
          leftIcon: Icon(Icons.arrow_back_ios),
          rightIcon: Icon(Icons.arrow_forward_ios),
          selectedColor: Colors.green,
          unSelectedColor: Colors.white,
          locale: LocaleType.en,
          onDateSelected: onSelect,
        )
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Widget Properties #

Initial data and onDateSelected handler #

PropDescriptionTypeDefault
startDateDate to be used for setting starting date in a date range.DateTime-
endDateDate to be used for setting ending date in a date range.DateTime-
isShowMonthShow or Hide DateTime type month.booltrue
isShowHalfYearShow or Hide DateTime type half yearbooltrue
isShowQuarterShow or Hide DateTime type quarterbooltrue
isShowYearShow or Hide DateTime type yearbooltrue
textColorColor of text info control.Color-
rightIconIcon for next navigationIconIcon(Icons.arrow_back_ios)
leftIconIcon for previous navigationIconIcon(Icons.arrow_forward_ios)
selectedColorColor of button round selected.ColorColors.blue
unSelectedColorColor of button round unselected.ColorColors.white
navigationColorColor of navigation iconColorColors.black
navigationDisableColorColor of navigation icon is disableColorColors.black12
localelocalization of languageLocaleTypeLocaleType.en
onDateSelectedFunction that is called on selection of a date. (Required)FunctionRequired

[1.0.0] - TODO: Add release date. #

  • TODO: Describe initial release.

[1.0.1] - TODO: Add localization. #

  • TODO: Add localization.

example/lib/main.dart

import 'package:date_strip_report/date_strip_report.dart';
import 'package:date_strip_report/i18n_calendar_strip.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      // This call to setState tells the Flutter framework that something has
      // changed in this State, which causes it to rerun the build method below
      // so that the display can reflect the updated values. If we changed
      // _counter without calling setState(), then the build method would not be
      // called again, and so nothing would appear to happen.
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    //
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.

    onSelect(data) {
      print("Selected Date -> $data");
    }

    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      ),
      body: Container(
        padding: EdgeInsets.all(20),
        // Center is a layout widget. It takes a single child and positions it
        // in the middle of the parent.
        child: DateStripReport(
          startDate: new DateTime(2020,1,1),
          endDate: new DateTime(2021,1,1),
          isShowMonth: true,
          isShowHalfYear: true,
          isShowQuarter: true,
          isShowYear: true,
          textColor: Colors.green,
          leftIcon: Icon(Icons.arrow_back_ios),
          rightIcon: Icon(Icons.arrow_forward_ios),
          selectedColor: Colors.green,
          unSelectedColor: Colors.white,
          locale: LocaleType.en,
          onDateSelected: onSelect,
        )
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  date_strip_report: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:date_strip_report/date_strip_report.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
22
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
60
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • date_strip_report that is a package requiring null.

Health suggestions

Fix lib/date_strip_report.dart. (-3.93 points)

Analysis of lib/date_strip_report.dart reported 8 hints, including:

line 322 col 53: Avoid using unnecessary statements.

line 341 col 45: Avoid using unnecessary statements.

line 365 col 52: Avoid using unnecessary statements.

line 384 col 45: Avoid using unnecessary statements.

line 408 col 55: Avoid using unnecessary statements.

Format lib/date-utils.dart.

Run flutter format to format lib/date-utils.dart.

Format lib/i18n_calendar_strip.dart.

Run flutter format to format lib/i18n_calendar_strip.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
jiffy ^3.0.1 3.0.1
Transitive dependencies
collection 1.14.12 1.14.13
intl 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test