s_container 0.0.1

s_container #

一个简单的布局容器

示例 #

import 'package:s_container/s_container.dart';

class Example extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SContainer(
      child: Text("center"),
      child_alignment: Alignment.center,
      width: 700,
      height: 1100,
      x_space: 100,
      y_space: 100,
      right_space: 300,
      top: Container(
        color: Colors.red,
        child: Text("top"),
      ),
      bottom: Container(
        color: Colors.red,
        child: Text("bottom"),
      ),
      left: Container(
        color: Colors.blue,
        child: Text("left"),
      ),
      right: Container(
        color: Colors.blue,
        child: Text("right"),
      ),
    );
}
参数名默认值解释
child子组件(中间)
top子组件(上)
bottom子组件(下)
left子组件(左)
right子组件(右)
child_alignment中间组件对齐方式
top_alignment上组件对齐方式
bottom_alignment下组件对齐方式
left_alignment左组件对齐方式
right_alignment右组件对齐方式
width100容器宽
height100容器高
space0统一配置左右容器宽,上下组件高
x_space单独配置左右组件宽
y_space单独配置上下组件高
top_space单独配置上组件高
bottom_space单独配置下组件高
left_space单独配置左组件宽
right_space单独配置右组件宽

优先级 #

top_space> bottom_space

left_space> right_space

如:

height = 100;

top_space = 70;

bottom_space = 70;

则 bottom_space 将自动处理为 height(100) - top_space(70) =30

实际结果为

height = 100;

top_space = 70;

bottom_space = 30;

注意 #

当配置了在四周的子组件时,

则必须配置 该方向组件的 宽/高

0.0.1 #

  • TODO: Describe initial release.

example/README.md

s_container_example #

Demonstrates how to use the s_container plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Health issues and suggestions

Document public APIs. (-0.36 points)

45 out of 46 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/s_container.dart. (-11.78 points)

Analysis of lib/s_container.dart reported 25 hints, including:

line 3 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: SContainer.width, SContainer.height, SContainer.space, SContainer.x_space, SContainer.y_space, SContainer.top, SContainer.top_space, SContainer.top_alignment, SContainer.bottom, SContainer.bottom_space, SContainer.bottom_alignment, SContainer.left, SContainer.left_space, SContainer.left_alignment, SContainer.right, SContainer.right_space, SContainer.right_alignment, SContainer.child, SContainer.child_alignment, SContainer.child_x, SContainer.child_y

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

line 8 col 10: Name non-constant identifiers using lowerCamelCase.

line 10 col 10: Name non-constant identifiers using lowerCamelCase.

line 11 col 13: Name non-constant identifiers using lowerCamelCase.

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.

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