Skip to content

ggalambas/smart_space

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartSpace ensures that layouts are visually balanced. Spacings are sized in constant increments, ensuring a consistent visual rhythm across each screen.

8dp-4dp-units

Features

  • Defines a constant for consistent spacing
  • Automatically apply the spacing to the right axis direction

Getting started

Define a spacing base

kSpace = yourSpace; // default: 8.0

Usage

Use kSpace as a constant for spacings

Padding(
  padding: EdgeInsets.symmetric(
    horizontal: kSpace * 2,
    vertical: kSpace,
  ),
  child: ...
)

Use Space on Flex and ScrollView children

Space(multiplier) // creates a space of kSpace * multiplier

Examples

Column(
  children: [
    ...
    Space(),
    ...
  ],
)
Row(
  children: [
    ...
    Space(),
    ...
  ],
)
ListView(
  children: [
    ...
    Space(),
    ...
  ],
)
ListView.separated(
  itemCount: ...
  separatorBuilder: (_, __) => Space(),
  itemBuilder: ...
)

Additional information

If you notice any bugs not present in issues, please file a new issue. If you are willing to fix or enhance things yourself, your are very welcome to make a pull request.