meadow 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new66

meadow

A selection of easy to use form field widgets to be used within Flutter forms:

  • Row of Buttons
  • Date Picker
  • Drop Down List
  • Row of Radio Buttons
  • Switch
  • Checkbox

Getting Started

For help getting started with Flutter, view the online documentation.

For help on editing package code, view the documentation.

Example

There is an example that demonstrates an example use of each form field widget in the example project

https://imgur.com/a/9miJ93a

[0.0.1] - 08 October 2018:

  • Initial Release

[0.0.2] - 08 October 2018:

  • Documentation Updates

[0.1.0] - 08 October 2018:

  • Added example project

[0.1.1] - 08 October 2018:

  • Moved example project to one file

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:meadow/meadow.dart';

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

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

class ExampleMeadowFormPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: SafeArea(
            minimum: EdgeInsets.only(
                left: MediaQuery.of(context).size.width * 0.025),
            child: SizedBox(
                width: MediaQuery.of(context).size.width * 0.95,
                child: ListView(children: [ExampleMeadowForm()]))));
  }
}

class _ExampleModel {
  String mButtonRowTwoString;
  int mButtonRowTwoInt;
  String mButtonRowThree;
  String mRadio;
  DateTime mDatePicker;
  bool mSwitch;
  bool mCheckBox;

  @override
  String toString() {
    return "Two Button String: " +
        mButtonRowTwoString +
        ", "
        "Two Button Int: " +
        mButtonRowTwoInt.toString() +
        ", "
        "Three Button: " +
        mButtonRowThree +
        ", "
        "Radio: " +
        mRadio +
        ", "
        "Date: " +
        mDatePicker.toString() +
        ", "
        "Switch: " +
        mSwitch.toString() +
        ", "
        "Check Box: " +
        mCheckBox.toString() +
        ", ";
  }
}

class ExampleMeadowForm extends StatefulWidget {
  @override
  createState() => _ExampleMeadowFormState();
}

class _ExampleMeadowFormState extends State<ExampleMeadowForm> {
  final _formKey = GlobalKey<FormState>();
  final TextStyle _style = TextStyle(fontSize: 14.0, letterSpacing: 1.4);
  final _ExampleModel _formData = _ExampleModel();

  void _submitForm() {
    if (_formKey.currentState.validate()) {
      _formKey.currentState.save();
      Scaffold.of(context)
          .showSnackBar(SnackBar(content: Text(_formData.toString())));
    }
  }

  Widget _header(String text) {
    return Padding(
        padding: EdgeInsets.symmetric(vertical: 20.0),
        child: Text(text, style: _style));
  }

  @override
  Widget build(BuildContext context) {
    final double _maxWidth = MediaQuery.of(context).size.width * 0.95;

    return Form(
      key: _formKey,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          _header("Button Row - 2 Buttons, Strings"),
          ButtonRowFormField(
            rowWidth: _maxWidth,
            buttonValues: ["One", "Two"],
            selectedColor: Colors.lightGreen,
            selectedBorderColor: Colors.green,
            onSaved: (value) => _formData.mButtonRowTwoString = value,
          ),
          _header("Button Row - 2 Buttons, Integers"),
          ButtonRowFormField(
            rowWidth: _maxWidth,
            buttonValues: [1, 2],
            selectedColor: Colors.lightGreen,
            selectedBorderColor: Colors.green,
            onSaved: (value) => _formData.mButtonRowTwoInt = value,
          ),
          _header("Button Row - 3 Buttons"),
          ButtonRowFormField(
            rowWidth: _maxWidth,
            buttonValues: ["One", "Two", "Three"],
            selectedColor: Colors.lightGreen,
            selectedBorderColor: Colors.green,
            onSaved: (value) => _formData.mButtonRowThree = value,
          ),
          _header("Radio Buttons"),
          RadioButtonsFormField(
            rowWidth: _maxWidth,
            values: ["a", "b"],
            onSaved: (value) => _formData.mRadio = value,
          ),
          _header("Date Picker"),
          DateFormField(
            firstDate: DateTime(2018, 2),
            onSaved: (value) => _formData.mDatePicker = value,
          ),
          _header("Switch"),
          SwitchFormField(
              title: Text("This is a Switch"),
              onSaved: (value) => _formData.mSwitch = value),
          _header("Checkbox"),
          CheckBoxFormField(
              title: Text("This is a Checkbox "),
              onSaved: (value) => _formData.mCheckBox = value),
          SizedBox(height: 20.0),
          FlatButton(
            child: Text("Submit"),
            onPressed: () => _submitForm(),
          )
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  meadow: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:meadow/meadow.dart';
  
Version Uploaded Documentation Archive
0.1.1 Oct 8, 2018 Go to the documentation of meadow 0.1.1 Download meadow 0.1.1 archive
0.1.0 Oct 8, 2018 Go to the documentation of meadow 0.1.0 Download meadow 0.1.0 archive
0.0.2 Oct 8, 2018 Go to the documentation of meadow 0.0.2 Download meadow 0.0.2 archive
0.0.1 Oct 8, 2018 Go to the documentation of meadow 0.0.1 Download meadow 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
31
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
intl ^0.15.7 0.15.7
Transitive dependencies
collection 1.14.11
meta 1.1.6
path 1.6.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8