ift_form 0.0.1-alpha

  • Readme
  • Changelog
  • Example
  • Installing
  • 42

ift_form #

A new Flutter package project.

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1-alpha] #

  • Add base implementation

example/lib/main.dart

import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:ift_form/ift_form.dart';
import 'form_default.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ift-form',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'ift-form'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  final formKey = GlobalKey<FormBuilderState>();
  final ScrollController scrollController = ScrollController();

  @override
  void dispose() {
    scrollController.dispose();
    super.dispose();
  }

  String resultJson;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(widget.title),
        ),
        body: SingleChildScrollView(
          controller: scrollController,
          child: Column(
            children: <Widget>[
              DefaultForm(
                key: formKey,
                formExpression: '''
email        Email                email   > req,v-len(50)
userName    'User Name'           string  > req,len(2,35)
date        'Reg Date'    				date    >
''',
                onValueChanged: (Field field, dynamic value) {},
                initData: {'email': 'test@iflutter.cn'},
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  RaisedButton(
                    child: Text('check'),
                    onPressed: () {
                      formKey.currentState.validate();
                      final result = formKey.currentState.save();
                      setState(() {
                        resultJson = jsonEncode(result);
                      });
                    },
                  ),
                ],
              ),
              Visibility(
                visible: resultJson != null,
                child: Text(
                  'result:$resultJson',
                  style: TextStyle(color: Colors.green, fontSize: 21),
                ),
              ),
            ],
          ),
        ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  ift_form: ^0.0.1-alpha

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

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [ift_form] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-0.04 points)

264 out of 273 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/template/form_parse.dart. (-1.99 points)

Analysis of lib/src/template/form_parse.dart reported 4 hints:

line 62 col 16: The value of the field '_flagFunStartCode' isn't used.

line 109 col 9: Don't explicitly initialize variables to null.

line 111 col 9: The value of the local variable 'hintStartIndex' isn't used.

line 472 col 7: Name non-constant identifiers using lowerCamelCase.

Fix lib/src/field/options/widgets/options_widget.dart. (-1 points)

Analysis of lib/src/field/options/widgets/options_widget.dart reported 2 hints:

line 88 col 10: This function has a return type of 'Object', but doesn't end with a return statement.

line 125 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: _OptionsItem.value

Fix lib/src/field/date/widgets/date_widget.dart. (-0.50 points)

Analysis of lib/src/field/date/widgets/date_widget.dart reported 1 hint:

line 33 col 20: Unnecessary cast.

Fix additional 8 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/data/option_item.dart (Run flutter format to format lib/src/data/option_item.dart.)
  • lib/src/field/date/date.dart (Run flutter format to format lib/src/field/date/date.dart.)
  • lib/src/field/hint/hint.dart (Run flutter format to format lib/src/field/hint/hint.dart.)
  • lib/src/field/selector/selector.dart (Run flutter format to format lib/src/field/selector/selector.dart.)
  • lib/src/field/title/title.dart (Run flutter format to format lib/src/field/title/title.dart.)
  • lib/src/field/title/widgets/title_widget.dart (Run flutter format to format lib/src/field/title/widgets/title_widget.dart.)
  • lib/src/validator/not_null.dart (Run flutter format to format lib/src/validator/not_null.dart.)
  • lib/src/widget/field_widget.dart (Run flutter format to format lib/src/widget/field_widget.dart.)

Maintenance suggestions

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.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

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