basic_components 0.0.4+5

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

Custom Basic Components #

A bundle that contains our custom components, mostly just override the default Flutter widgets and custom its style and some of its functional.

Note: This plugin is still under development, and some Components might not be available yet or still has so many bugs.

  • The date picker components inspired by flutter_calendar_carousel, I clone it and override some of its functional and add selection types (single, multi or range)

Installation #

First, add basic_components as a dependency in your pubspec.yaml file.

basic_components: ^0.0.18

Example #

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  AdvTextFieldController controller = AdvTextFieldController();
  AdvIncrementController incrementController = AdvIncrementController(amount: 10);

  AdvGroupRadioController groupRadioController = AdvGroupRadioController(text: "Test1", items: {
    "Test1": Icon(Icons.edit_attributes),
    "Test2": Icon(Icons.speaker_notes),
    "Test3": Icon(Icons.speaker_notes_off),
  });

  AdvGroupCheckController groupCheckController = AdvGroupCheckController(items: [
    AdvGroupCheckItem(value: "Test1", display: Icon(Icons.edit_attributes), isChecked: false),
    AdvGroupCheckItem(value: "Test2", display: Icon(Icons.speaker_notes), isChecked: false),
    AdvGroupCheckItem(value: "Test3", display: Icon(Icons.speaker_notes_off), isChecked: false),
  ]);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Container(
          color: Color(0xffffedd8),
          child: AdvColumn(
            padding: EdgeInsets.symmetric(horizontal: 16.0),
            divider: ColumnDivider(16.0),
            children: [
              AdvTextField(
                controller: controller,
                minLines: 3,
                maxLines: 4,
                decoration: InputDecoration(
                  hintText: "Text \n lalala",
                  prefix: Text("Prefix"),
                  prefixIcon: Material(
                      child: InkWell(
                        child: Icon(Icons.add),
                        onTap: () {
                          print("makan siang");
                        },
                      )),
                  isDense: true,
                  helperText: "This is Helper Text",
                ),
              ),
              TextField(
                minLines: 3,
                maxLines: 4,
                decoration: InputDecoration(
                  hintText: "Text \n lalala",
                  labelText: "Latex",
                  prefix: Text("Prefix"),
                  prefixIcon: Icon(Icons.add),
                  helperText: "This is Helper Text",
                  contentPadding: EdgeInsets.all(8.0),
                  focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.green)),
                  filled: true,
                  enabledBorder:
                  OutlineInputBorder(borderSide: BorderSide(width: 5.0, color: Colors.red)),
                  errorBorder: InputBorder.none,
                  focusedErrorBorder: InputBorder.none,
                  fillColor: Colors.white,
                  focusColor: Colors.green,
                  hoverColor: Colors.orange,
                ),
//                scrollPadding: EdgeInsets.all(16.0),
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Hide Password!"),
                    onPressed: () {
                      controller.obscureText = true;
                    },
                  ),
                  FlatButton(
                    child: Text("Unhide Password!"),
                    onPressed: () {
                      controller.obscureText = false;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Set Error!"),
                    onPressed: () {
                      controller.error = "Error!";
                    },
                  ),
                  FlatButton(
                    child: Text("Unset Error!"),
                    onPressed: () {
                      controller.error = null;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Disable!"),
                    onPressed: () {
                      controller.enabled = false;
                    },
                  ),
                  FlatButton(
                    child: Text("Enable!"),
                    onPressed: () {
                      controller.enabled = true;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Set Text!"),
                    onPressed: () {
                      controller.text = "Date Time = ${DateTime.now()}";
                    },
                  ),
                ],
              ),
              Container(
                color: Colors.white,
                child: AdvChooser(
                    style: TextStyle(fontSize: 32.0),
                    textAlign: TextAlign.center,
                    items: {
                      "test1": "Satu",
                      "test2": "Dua",
                      "test3": "Tiga",
                      "test4": "Empat",
                    }),
              ),
              Container(
                color: Colors.white,
                child: AdvIncrement(
                  style: TextStyle(fontSize: 24.0),
                  textAlign: TextAlign.center,
                  controller: incrementController,
                ),
              ),
              Container(
                color: Colors.white,
                child: AdvDatePicker(
                  style: TextStyle(fontSize: 24.0),
                  textAlign: TextAlign.center,
                ),
              ),
              AdvGroupRadio(
                controller: groupRadioController,
                callback: (itemSelected) async {
                  Navigator.of(context).pop(itemSelected);
                },
              ),
              AdvGroupCheck(
                controller: groupCheckController,
                callback: (itemSelected) async {
                  Navigator.of(context).pop(itemSelected);
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

[0.0.4+5] - 6 Nov 2019.

  • List Tile add default padding 16.0
  • Fix Adv Button typo
  • Fix Adv Radio Group when stringChildren is null
  • Fix Adv Increment without controller set amount to 0 instead of ""

[0.0.4+4] - 6 Nov 2019.

  • Button Padding now is customizable from the outside

[0.0.4+3] - 5 Nov 2019.

  • Fix textfield to set text editing controller's text on initstate

[0.0.4+2] - 30 Oct 2019.

  • Fix textfield controller

[0.0.4+1] - 27 Oct 2019.

  • Fix textfield controller

[0.0.4] - 26 Oct 2019.

  • Fix textfield controller handling that causes the selection always on the start

[0.0.3+2] - 18 Oct 2019.

  • Fix more bugs

[0.0.3+1] - 18 Oct 2019.

  • Fix some bugs

[0.0.3] - 18 Oct 2019.

  • Add AdvLoadingWithBarrier

[0.0.2] - 18 Oct 2019.

  • Add measure text functionality for AdvIncrement and AdvDatePicker
  • Add padding and margin for AdvTextField, AdvIncrement, and AdvDatePicker
  • Add minDate and maxDate for AdvDatePicker

[0.0.1+1] - 18 Oct 2019.

  • Change dart file name that fixes import problem.

[0.0.1] - 17 Oct 2019.

  • Initial release.

example/README.md


import 'package:basic_components/components/chooser.dart';
import 'package:basic_components/components/column.dart';
import 'package:basic_components/components/date_picker.dart';
import 'package:basic_components/components/group_check.dart';
import 'package:basic_components/components/group_radio.dart';
import 'package:basic_components/components/increment.dart';
import 'package:basic_components/components/row.dart';
import 'package:basic_components/components/text_field.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PIT Components Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'PIT Components 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> {
  AdvTextFieldController controller = AdvTextFieldController();
  AdvIncrementController incrementController = AdvIncrementController(amount: 10);

  AdvGroupRadioController groupRadioController = AdvGroupRadioController(text: "Test1", items: {
    "Test1": Icon(Icons.edit_attributes),
    "Test2": Icon(Icons.speaker_notes),
    "Test3": Icon(Icons.speaker_notes_off),
  });

  AdvGroupCheckController groupCheckController = AdvGroupCheckController(items: [
    AdvGroupCheckItem(value: "Test1", display: Icon(Icons.edit_attributes), isChecked: false),
    AdvGroupCheckItem(value: "Test2", display: Icon(Icons.speaker_notes), isChecked: false),
    AdvGroupCheckItem(value: "Test3", display: Icon(Icons.speaker_notes_off), isChecked: false),
  ]);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Container(
          color: Color(0xffffedd8),
          child: AdvColumn(
            padding: EdgeInsets.symmetric(horizontal: 16.0),
            divider: ColumnDivider(16.0),
            children: [
              AdvTextField(
                controller: controller,
                minLines: 3,
                maxLines: 4,
                decoration: InputDecoration(
                  hintText: "Text \n lalala",
                  prefix: Text("Prefix"),
                  prefixIcon: Material(
                      child: InkWell(
                        child: Icon(Icons.add),
                        onTap: () {
                          print("makan siang");
                        },
                      )),
                  isDense: true,
                  helperText: "This is Helper Text",
                ),
              ),
              TextField(
                minLines: 3,
                maxLines: 4,
                decoration: InputDecoration(
                  hintText: "Text \n lalala",
                  labelText: "Latex",
                  prefix: Text("Prefix"),
                  prefixIcon: Icon(Icons.add),
                  helperText: "This is Helper Text",
                  contentPadding: EdgeInsets.all(8.0),
                  focusedBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.green)),
                  filled: true,
                  enabledBorder:
                  OutlineInputBorder(borderSide: BorderSide(width: 5.0, color: Colors.red)),
                  errorBorder: InputBorder.none,
                  focusedErrorBorder: InputBorder.none,
                  fillColor: Colors.white,
                  focusColor: Colors.green,
                  hoverColor: Colors.orange,
                ),
//                scrollPadding: EdgeInsets.all(16.0),
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Hide Password!"),
                    onPressed: () {
                      controller.obscureText = true;
                    },
                  ),
                  FlatButton(
                    child: Text("Unhide Password!"),
                    onPressed: () {
                      controller.obscureText = false;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Set Error!"),
                    onPressed: () {
                      controller.error = "Error!";
                    },
                  ),
                  FlatButton(
                    child: Text("Unset Error!"),
                    onPressed: () {
                      controller.error = null;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Disable!"),
                    onPressed: () {
                      controller.enabled = false;
                    },
                  ),
                  FlatButton(
                    child: Text("Enable!"),
                    onPressed: () {
                      controller.enabled = true;
                    },
                  ),
                ],
              ),
              AdvRow(
                padding: EdgeInsets.symmetric(horizontal: 16.0),
                divider: RowDivider(16.0),
                children: [
                  FlatButton(
                    child: Text("Set Text!"),
                    onPressed: () {
                      controller.text = "Date Time = ${DateTime.now()}";
                    },
                  ),
                ],
              ),
              Container(
                color: Colors.white,
                child: AdvChooser(
                    style: TextStyle(fontSize: 32.0),
                    textAlign: TextAlign.center,
                    items: {
                      "test1": "Satu",
                      "test2": "Dua",
                      "test3": "Tiga",
                      "test4": "Empat",
                    }),
              ),
              Container(
                color: Colors.white,
                child: AdvIncrement(
                  style: TextStyle(fontSize: 24.0),
                  textAlign: TextAlign.center,
                  controller: incrementController,
                ),
              ),
              Container(
                color: Colors.white,
                child: AdvDatePicker(
                  style: TextStyle(fontSize: 24.0),
                  textAlign: TextAlign.center,
                ),
              ),
              AdvGroupRadio(
                controller: groupRadioController,
                callback: (itemSelected) async {
                  Navigator.of(context).pop(itemSelected);
                },
              ),
              AdvGroupCheck(
                controller: groupCheckController,
                callback: (itemSelected) async {
                  Navigator.of(context).pop(itemSelected);
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  basic_components: ^0.0.4+5

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:basic_components/basic_components.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
47
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/components/adv_date_picker.dart. (-0.50 points)

Analysis of lib/components/adv_date_picker.dart reported 1 hint:

line 4 col 8: Unused import: 'dart:math'.

Fix lib/components/adv_increment.dart. (-0.50 points)

Analysis of lib/components/adv_increment.dart reported 1 hint:

line 5 col 8: Unused import: 'package:basic_components/components/adv_row.dart'.

Format lib/basic_components.dart.

Run flutter format to format lib/basic_components.dart.

Fix additional 20 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/components/adv_button.dart (Run flutter format to format lib/components/adv_button.dart.)
  • lib/components/adv_check_box.dart (Run flutter format to format lib/components/adv_check_box.dart.)
  • lib/components/adv_chooser.dart (Run flutter format to format lib/components/adv_chooser.dart.)
  • lib/components/adv_chooser_controller.dart (Run flutter format to format lib/components/adv_chooser_controller.dart.)
  • lib/components/adv_column.dart (Run flutter format to format lib/components/adv_column.dart.)
  • lib/components/adv_date_picker_controller.dart (Run flutter format to format lib/components/adv_date_picker_controller.dart.)
  • lib/components/adv_group_check.dart (Run flutter format to format lib/components/adv_group_check.dart.)
  • lib/components/adv_group_check_controller.dart (Run flutter format to format lib/components/adv_group_check_controller.dart.)
  • lib/components/adv_group_radio_controller.dart (Run flutter format to format lib/components/adv_group_radio_controller.dart.)
  • lib/components/adv_increment_controller.dart (Run flutter format to format lib/components/adv_increment_controller.dart.)
  • lib/components/adv_loading_with_barrier.dart (Run flutter format to format lib/components/adv_loading_with_barrier.dart.)
  • lib/components/adv_row.dart (Run flutter format to format lib/components/adv_row.dart.)
  • lib/components/adv_text_field.dart (Run flutter format to format lib/components/adv_text_field.dart.)
  • lib/components/adv_text_field_controller.dart (Run flutter format to format lib/components/adv_text_field_controller.dart.)
  • lib/components/calendar_carousel.dart (Run flutter format to format lib/components/calendar_carousel.dart.)
  • lib/components/calendar_day.dart (Run flutter format to format lib/components/calendar_day.dart.)
  • lib/components/calendar_month.dart (Run flutter format to format lib/components/calendar_month.dart.)
  • lib/components/calendar_page.dart (Run flutter format to format lib/components/calendar_page.dart.)
  • lib/components/calendar_year.dart (Run flutter format to format lib/components/calendar_year.dart.)
  • lib/utilities/string_helper.dart (Run flutter format to format lib/utilities/string_helper.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (intl).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
intl ^0.15.7 0.15.8 0.16.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test