flutter_collapse 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

flutter_collapse #

flutter_collapse折叠面板

目录 #

预览 #

使用说明 #

Collapse(
  title: Container(
    child: Text('折叠面板 - 默认')
  ),
  body: Text('这就是一个demo'),
  value: true,
),

参数说明 #

参数说明
title<Widget>标题,
icon<Widget>右侧图标。默认值:Icon(Icons.expand_more, size: 24,)
value<bool>是否展开。 默认值:true
body<Widget>内容
onChange<Function(bool)>状态改变 返回当前value
showBorder<bool>是否显示border 默认:true
padding<EdgeInsets>内边距 默认值:EdgeInsets.symmetric(vertical: 10, horizontal: 15),

维护者 #

@meetqy.

欢迎PR #

非常欢迎你的加入! 提一个Issue 或者提交一个 Pull Request.

使用许可 #

MIT © MEETQY

[0.1.1] - 优化注释

  • 优化注释

[0.1.0] - 修改example

  • 修改example
  • 修改desc

[0.0.1] - first push

  • first push

example/main.dart

/*
 * @Author: meetqy
 * @since: 2019-10-22 09:59:58
 * @lastTime: 2019-11-05 17:51:08
 * @LastEditors: meetqy
 */
import 'package:flutter/material.dart';
import 'package:flutter_collapse/flutter_collapse.dart';

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

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

class _ExampleCollapseState extends State<ExampleCollapse> {
  bool status1 = true;
  bool status2 = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color.fromRGBO(245, 245, 245, 1),
      appBar: AppBar(
        title: Text('collapse'),
      ),
      body: Container(
        margin: EdgeInsets.only(top: 20),
        child: SingleChildScrollView(
          child: Column(
            children: <Widget>[
              Collapse(
                title: Container(
                  child: Text('折叠面板 - 默认')
                ),
                body: Text('这就是一个demo'),
                value: status1,
                onChange: (bool value) {
                  setState(() {
                    status1 = value;
                  });
                },
              ),

              Container(
                margin: EdgeInsets.only(top: 20),
                child: Collapse(
                  padding: EdgeInsets.all(0),
                  title: Text('折叠面板 - 自定义'),
                  body: Container(
                    color: Colors.blue,
                    padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Text('这就是一个demo这就是一个demo这就是一个demo这就是一个demo这就是一个demo'),
                        Text('这就是一个demo这就是一个demo这就是一个demo'),
                        Text('这就是一个demo这就是一个demo'),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            CircularProgressIndicator(
                              backgroundColor: Colors.yellow,
                            ),
                            CircularProgressIndicator(
                              backgroundColor: Colors.green,
                            ),
                            CircularProgressIndicator(
                              backgroundColor: Colors.red,
                            )
                          ],
                        ),
                      ],
                    ),
                  ),
                  value: status2,
                  onChange: (bool value) {
                    setState(() {
                      status2 = value;
                    });
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_collapse: ^0.1.1

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:flutter_collapse/flutter_collapse.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
46
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]
73
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Dependencies

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