king011_flutter 0.1.4+3

  • Readme
  • Changelog
  • Example
  • Installing
  • 66

flutter #

General package for Flutter.validator for form validate.widget for some diy widget.

validator #

validator autovalidate carrying dirty state

validator 提供了 表單驗證的 封裝 主要解決 flutter 設置 autovalidate 是 沒有爲 Field 記錄 dirty 狀態

widget #

widget some widget

  • SliderField/SliderFormField Slider on form
  • SwitchField/SwitchFormField Switch on form
  • TreeView tree view and controller

TreeView #

TreeView

0.1.4+2 #

  • TreeView support sort
  • TreeView support set children left padding

0.1.4 #

  • TreeView
  • fix some bug for [SwitchFormField SliderFormField]

0.1.0 #

  • validator
  • widget

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import './validator/validator_auto.dart';
import './validator/validator_manual.dart';
import './widget/tree_view.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
      routes: {
        "/validator/auto": (_) => MyValidatorAutoPage(),
        "/validator/manual": (_) => MyValidatorManualPage(),
        "/widget/treeview": (_) => MyTreeView(),
      },
    );
  }
}

class MyHomePage extends StatelessWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("king011_flutter Example"),
      ),
      body: SingleChildScrollView(
        child: Padding(
          padding: EdgeInsets.all(12),
          child: MyExpansionPanelList(),
        ),
      ),
    );
  }
}

/// 派生 一個 StatefulWidget 來 管理 面板展開
class MyExpansionPanelList extends StatefulWidget {
  MyExpansionPanelList({Key key}) : super(key: key);
  @override
  _MyExpansionPanelListState createState() => _MyExpansionPanelListState();
}

class _MyExpansionPanelListState extends State<MyExpansionPanelList> {
  /// 定義 當前展開的 面板
  final List<Panel> _panels = panels;
  @override
  Widget build(BuildContext context) {
    return ExpansionPanelList(
      /// 每當 面板 展開 關閉時 會回調此 函數
      expansionCallback: (panelIndex, isExpanded) {
        final expanded = !isExpanded;
        if (expanded != _panels[panelIndex].expanded) {
          setState(() {
            _panels[panelIndex].expanded = expanded;
          });
        }
      },

      /// 子面板 數組
      children: _panels.map((Panel paenl) {
        return ExpansionPanel(
          isExpanded: paenl.expanded,
          headerBuilder: (context, isExpanded) => ListTile(
                dense: true,
                title: Text('${paenl.title}'),
              ),
          body: Container(
            height: 160,
            child: ListView(
              children: paenl.items.map((Item item) {
                return ListTile(
                  dense: true,
                  leading: Icon(Icons.event),
                  title: Text(item.title),
                  onTap: () => Navigator.of(context).pushNamed(item.path),
                );
              }).toList(),
            ),
          ),
        );
      }).toList(),
    );
  }
}

/// 定義面板 數據
class Panel {
  String title;
  bool expanded;
  List<Item> items;
  Panel({
    this.title,
    this.expanded = false,
    @required this.items,
  }) : assert(items != null);
}

class Item {
  String title;
  String path;
  Item(this.title, this.path);
}

final List<Panel> panels = <Panel>[
  Panel(
    title: 'validator',
    expanded: true,
    items: <Item>[
      Item("validator auto ", "/validator/auto"),
      Item("validator manual", "/validator/manual"),
    ],
  ),
  Panel(
    title: 'widget',
    items: <Item>[
      Item("tree view ", "/widget/treeview"),
    ],
  )
];

Use this package as a library

1. Depend on it

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


dependencies:
  king011_flutter: ^0.1.4+3

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

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

  • Dart: 2.8.4
  • pana: 0.13.9+1
  • Flutter: 1.17.3

Analysis suggestions

Package not compatible with SDK dart

because of import path [king011_flutter]

Maintenance suggestions

Package is getting outdated. (-20.55 points)

The package was last published 62 weeks ago.

Dependencies

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