Friday, 16 August 2019

A flutter widget like iOS UITableview



flutter_tableview

A flutter widget like iOS UITableview. let listView with section header and each section header will hover at the top.

Installing:

Add the following to your pubspec.yaml file:
dependencies:
  flutter_tableview: ^1.0.1

How to use

class SimpleDemoPageBody extends StatefulWidget {
  @override
  _SimpleDemoPageBodyState createState() => _SimpleDemoPageBodyState();
}

class _SimpleDemoPageBodyState extends State<SimpleDemoPageBody> {
  // How many section.
  int sectionCount = 3;

  // Get row count.
  int _rowCountAtSection(int section) {
    if (section == 0) {
      return 5;
    } else if (section == 1) {
      return 10;
    } else {
      return 20;
    }
  }

  // Section header widget builder.
  Widget _sectionHeaderBuilder(BuildContext context, int section) {
    return InkWell(
      onTap: () {
        print('click section header. -> section:$section');
      },
      child: Container(
        alignment: Alignment.centerLeft,
        padding: EdgeInsets.only(left: 16.0),
        color: Color.fromRGBO(220, 220, 220, 1),
        height: 100,
        child: Text('I am section header -> section:$section'),
      ),
    );
  }

  // cell item widget builder.
  Widget _cellBuilder(BuildContext context, int section, int row) {
    return InkWell(
      onTap: () {
        print('click cell item. -> section:$section row:$row');
      },
      child: Container(
        padding: EdgeInsets.only(left: 16.0),
        alignment: Alignment.centerLeft,
        decoration: BoxDecoration(
            border: Border(
                bottom: BorderSide(
          color: Color.fromRGBO(240, 240, 240, 1),
        ))),
        height: 50.0,
        child: Text('I am cell -> section:$section  row$row'),
      ),
    );
  }

  // Each section header height;
  double _sectionHeaderHeight(BuildContext context, int section) {
    return 50.0;
  }

  // Each cell item widget height.
  double _cellHeight(BuildContext context, int section, int row) {
    return 50.0;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      //FlutterTableView
      child: FlutterTableView(
        sectionCount: sectionCount,
        rowCountAtSection: _rowCountAtSection,
        sectionHeaderBuilder: _sectionHeaderBuilder,
        cellBuilder: _cellBuilder,
        sectionHeaderHeight: _sectionHeaderHeight,
        cellHeight: _cellHeight,
      ),
    );
  }
}



If you want to wrap listView with other widget (such as flutter_easyrefresh)
FlutterTableView(
        sectionCount: this.dataSourceList.length,
        rowCountAtSection: _rowCountAtSection,
        sectionHeaderBuilder: _sectionHeaderBuilder,
        cellBuilder: _cellBuilder,
        sectionHeaderHeight: _sectionHeaderHeight,
        cellHeight: _cellHeight,
        listViewFatherWidgetBuilder: (BuildContext context, Widget listView) {
          return EasyRefresh(
            key: _easyRefreshKey,
            limitScroll: true,
            refreshHeader: MaterialHeader(key: _headerKey),
            refreshFooter: MaterialFooter(key: _footerKey),
            onRefresh: () async {},
            loadMore: () async {},
            child: listView,
          );
        },
      ),
      
// detail usage please download demo
Dart

GitHub

A flutter widget like iOS UITableview. let listView with section header and each section header will hover at the top. — Read More
Latest commit to the master branch on 8-15-2019
Download as zip


Calendar widget library for Flutter apps


Calendarro

Calendar widget library for Flutter apps. Offers multiple ways to customize the widget.

Getting Started

Installation

Add dependency to your pubspec.yaml:
calendarro: ^1.0.0
Dart

Basic use

First, add an import to your code:
import 'package:calendarro/calendarro.dart';
Dart
Add a widget to your code:
Calendarro(
  startDate: DateUtils.getFirstDayOfCurrentMonth(),
  endDate: DateUtils.getLastDayOfCurrentMonth()
  )

Customization

1. Display Mode - If you prefer to operate on multiple rows to see whole month, use:
Calendarro(
  displayMode: DisplayMode.MONTHS,
  ...
  )
Dart
2. Selection Mode - If you want to select multiple dates, use:
Calendarro(
  selectionMode: SelectionMode.MULTI,
  ...
  )
Dart
3. Weekday Labels - If you want to provide your own row widget for displaying weekday names, use:
Calendarro(
  weekdayLabelsRow: CustomWeekdayLabelsRow()
  ...
  )
Dart
you can create your CustomWeekdayLabelsRow by looking at default CalendarroWeekdayLabelsView.
4. Day Tile Builder - If you want to build day tiles your own way, you can use:
Calendarro(
  dayTileBuilder: CustomDayTileBuilder()
  ...
  )
Dart
you can create your CustomDayTileBuilder looking upon DefaultDayTileBuilder.
5. Initial selected dates - When you want some dates to be selected from the scratch, use selectedDate (SelectionMode.SINGLE) or selectedDates (SelectionMode.MULTI) arguments:
Calendarro(
  selectedDate: DateTime(2018, 8, 1)
  //or
  selectedDates: [DateTime(2018, 8, 1), DateTime(2018, 8, 8)]
  ...
  )
Dart
you can create your CustomDayTileBuilder looking upon DefaultDayTileBuilder.

Selecting date callback

If you want to get a callback when a date tile is clicked, there is onTap param:
Calendarro(
  onTap: (date) {
      //your code
  }
  ...
  )
Dart

GitHub

Calendar widget library for Flutter apps. — Read More
Latest commit to the master branch on 8-14-2019
Download as zip

A powerful and easy-to-use alerting library for Flutter



Flash

A highly customizable, powerful and easy-to-use alerting library for Flutter.

Specs

This library allows you to show messages or alerts in your app quickly
and easily
. It can be used as an alternative to Snackbar or Toast
or Dialog and offers a plethora of useful features and customization
options for you to play with.
It has been written 100% in Dart. ❤️

Getting started

In the pubspec.yaml of your flutter project, add the following
dependency:
dependencies:
  ...
  flash: "^1.1.0"
YAML
In your library add the following import:
import 'package:flash/flash.dart';
Dart

Sample Project

We have an exhaustive sample project demonstrating almost
every feature of the library.

Usage

It is recommended to check the sample project to get a complete
understanding of all the features offered by the library.













Roadmap

These are some of the prioritized features in the pipeline awaiting to
be implemented in the near future

Contribution

I highly encourage the community to step forward and improve this
library further. You can fix any reported bug, propose or implement new
features, write tests, etc.
Here is a quick list of things to remember
  • Check the open issues before creating a new one,
  • Help me in reducing the number of open issues by fixing any existing
    bugs,
  • Check the roadmap to see if you can help in implementing any new
    feature,
  • You can contribute by writing unit and integration tests for this
    library,
  • If you have any new idea that aligns with the goal of this library,
    feel free to raise a feature request and discuss it.

GitHub

⚡️A highly customizable, powerful and easy-to-use alerting library for Flutter. — Read More
Latest commit to the master branch on 8-14-2019
Download as zip