Code Monkey home page Code Monkey logo

tform's Introduction

tform

A easy, extensible and dynamic flutter form framework. Support for custom selectors, validators and widgets. Support form verification, insert, delete and so on.

Installing

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

dependencies:
  tform: ^1.0.1

Example

avatar

Build Form Rows

avatar

Build Form

avatar

tform's People

Contributors

goosejar avatar yichahucha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tform's Issues

TFormOptionModel没有空值情况的处理

image

      `    if (row.options == null || row.options.isEmpty) return;`

代码中当options长度为0的时候,可以加一个当前无可选项的提示吗
我还是初学者,有什么不对请指出,另外调试是不是直接打开example中的程序就可以了。
ps: 我提交了一个PR

使用 TAB键 不能移动焦点

════════ Exception caught by services library ══════════════════════════════════
Tried to get the bounds of a focus node that didn't have its context set yet.
The context needs to be set before trying to evaluate traversal policies. Setting the context is typically done with the attach method.
'package:flutter/src/widgets/focus_manager.dart':
Failed assertion: line 748 pos 9: 'context != null'

为什么不允许rows更改,当我修改rows的内容,无论如何TForm都不会重新更新内部的rows变量

问题如题,你的reload方法也只是刷新第一次传入的rows变量,你没有在改变的时候重新修改rows变量。
这样的话,比如我有一个需求是当A行改变时候会,将B,C行的value也改变;这样的需求将无法实现。
最后,这是你最初设计时的预想吗,求解惑!

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

class PartForm {
  String partNum;
  String partSpecification;
  String weight;
  PartForm({this.partNum, this.partSpecification, this.weight});
}

class TabResourcePage extends StatefulWidget {
  const TabResourcePage({Key key}) : super(key: key);

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

class _TabResourcePageState extends State<TabResourcePage> {
  final GlobalKey _formKey = GlobalKey<TFormState>();

  var form = PartForm(partNum: "1", partSpecification: "2*2", weight: "100");
  var options = ["10", '2'];

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Text("form.partSpecification:${form.partSpecification}"),
            TextButton(
                onPressed: () {
                  setState(() {
                    form.partSpecification = "";
                  });
                },
                child: Text("clear")),
            TextButton(
                onPressed: () {
                  setState(() {
                    form.partSpecification += "123";
                  });
                },
                child: Text("add")),
            Expanded(
              child: TForm.builder(
                key: _formKey,
                rows: [
                  TFormRow.input(
                    title: "规格123",
                    placeholder: "规格",
                    value: form.partSpecification,
                    textAlign: TextAlign.right,
                    onChanged: (TFormRow row) {},
                  ),
                  // 我把这两列放开注释,hot Reload也不会将组件刷新
                  // TFormRow.input(
                  //   title: "数量",
                  //   placeholder: "数量",
                 //    value: form.partNum,
                 //    textAlign: TextAlign.right,
                 //    onChanged: (TFormRow row) {},
                 //  ),
                  // TFormRow.input(
                  //   title: "重量",
                  //   placeholder: "重量",
                  //   value: form.weight,
                  //   textAlign: TextAlign.right,
                  //   onChanged: (TFormRow row) {},
                  // ),
                ],
                divider: Divider(
                  height: .5,
                  thickness: .5,
                ),
              ),
            ),
          ],
        ),
      ),
      floatingActionButton: IconButton(
        onPressed: () {
          setState(() {
            form.partSpecification += "refresh";
            print(form.partSpecification);
            // TForm.of(context).reload();
            (_formKey.currentState as TFormState).reload();
          });
        },
        icon: Icon(Icons.refresh),
      ),
    );
  }
}

能否给TFormField中的Row增加backgroundColor选项

tform: ^0.9.3

设计稿给出的是背景为灰色,输入框为白色。我现在把Scaffold的background设置为灰色,但是TFormRow.input不支持传入color去自定义

TForm.builder(
                key: _formKey,
                rows: [ TFormRow.input(title: "姓名",)]
)

另外,能否支持输入框内容向右对齐,如web移动端框架Vant的截图
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.