colorful_safe_area 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

ColorfulSafeArea #

Pub

A more customizable replacement for the SafeArea widget. It lets you set the color of your SafeArea without affecting the color of its child.

Example of ColorfulSafeArea

Use it just like a regular SafeArea widget

Scaffold(
    body: ColorfulSafeArea(
    child: SomeWidget(),
    ),
);

Setting Color #

The color of ColorfulSafeArea widgets are transparent by default. To change their color, set the color property.

Scaffold(
    body: ColorfulSafeArea(
    color: Colors.red,
    child: SomeWidget(),
    ),
);

Using Transparent Colors #

You can use any color that has transparency

Scaffold(
    body: ColorfulSafeArea(
    color: Colors.red.withOpacity(0.7),
    child: SomeWidget(),
    ),
);

Overflow Rules #

If you are using a transparent color and want the child of the ColorfulSafeArea to appear behind it, you can set overflowRules to define how the ColorfulSafeArea's child should appear. The default value is OverflowRules.all(false). The OverflowRules class works much like EdgeInsets

// allows the child to overflow behind all sides
overflowRules: OverflowRules.all(true)

// allows the child to overflow only on the left and bottom sides
overflowRules: OverflowRules.only(left: true, bottom: true)

// allows the child to overflow on the top and bottom
overflowRules: OverflowRules.symmetric(vertical: true)

Blurring Overflow Area #

If you want to apply a blur effect to the ColorfulSafeArea, you can apply a filter.

Scaffold(
    body: ColorfulSafeArea(
    overflowRules: OverflowRules.all(true),
    filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
    child: SomeWidget(),
    ),
);

Making Overflow Area Interactive #

When you set overflowRules and would like for the parts of the child that have overflowed to be interactable behind the ColorfulSafeArea, you can set overflowTappable to true.

Scaffold(
    body: ColorfulSafeArea(
    overflowRules: OverflowRules.all(true),
    overflowTappable: true
    child: SomeWidget(),
    ),
);

0.1.0 #

  • Initial release
  • Support for transparent safe area

0.1.1 #

  • Update package description

0.1.2 #

  • Add comments for padding calculations

0.2.0 #

  • Add blur effect

example/lib/main.dart

import 'dart:ui';

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'ColorfulSafeArea Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    int numberOfTiles = 100;

    return Scaffold(
      backgroundColor: Colors.blue,
      body: ColorfulSafeArea(
        color: Colors.white.withOpacity(0.7),
        overflowRules: OverflowRules.all(true),
        filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
        child: ListView.builder(
          itemBuilder: (context, index) {
            return Container(
              margin: EdgeInsets.all(10),
              width: 300,
              height: 200,
              color: Colors.red,
            );
          },
          itemCount: numberOfTiles,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  colorful_safe_area: ^0.2.0

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

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

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • colorful_safe_area that is a package requiring null.

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.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test