All Projects → letsar → nil

letsar / nil

Licence: MIT license
A simple Flutter widget to add in the widget tree when you want to show nothing, with minimal impact on performance.

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to nil

survey kit
Flutter library to create beautiful surveys (aligned with ResearchKit on iOS)
Stars: ✭ 68 (-47.69%)
Mutual labels:  flutter-widget, flutter-package
sliding panel
A Flutter slidable widget that provides an easy to use configuration. Highly customisable. Just as you want it!
Stars: ✭ 88 (-32.31%)
Mutual labels:  flutter-widget, flutter-package
juxtapose
A flutter widget for comparing two stacked widgets by dragging a slider thumb to reveal either sides of the slider horizontally or vertically.
Stars: ✭ 75 (-42.31%)
Mutual labels:  flutter-widget, flutter-package
buttons tabbar
A Flutter package that implements a TabBar where each label is a toggle button.
Stars: ✭ 49 (-62.31%)
Mutual labels:  flutter-widget, flutter-package
overflow view
A widget displaying children in a line until there is not enough space and showing a the number of children not rendered.
Stars: ✭ 136 (+4.62%)
Mutual labels:  flutter-widget, flutter-package
flex color scheme
A Flutter package to make and use beautiful color scheme based themes.
Stars: ✭ 370 (+184.62%)
Mutual labels:  flutter-widget, flutter-package
shimmer animation
This shimmer animation widget can help you bring simple yet beautiful skeleton loaders to your flutter app with ease.
Stars: ✭ 29 (-77.69%)
Mutual labels:  flutter-widget, flutter-package
FlutterLoadingGIFs
Loading indicator GIFs. Material and Cupertino (Android and iOS) loading indicators in assorted sizes. Use as placeholders for loading remote image assets. Demo: https://gallery.codelessly.com/flutterwebsites/loadinggifs/
Stars: ✭ 28 (-78.46%)
Mutual labels:  flutter-widget, flutter-package
progressive image
A flutter widget that progressively loads large images using Low-Quality Image Placeholders.
Stars: ✭ 28 (-78.46%)
Mutual labels:  flutter-widget, flutter-package
Flutter-Apps
🌀 This is mainly focus on a complete application for production
Stars: ✭ 18 (-86.15%)
Mutual labels:  flutter-widget, flutter-package
flutter link previewer
URL preview extracted from the provided text with basic customization and ability to render from cached data.
Stars: ✭ 35 (-73.08%)
Mutual labels:  flutter-widget, flutter-package
bottom animation
Bottom Navigation Mixed Animation
Stars: ✭ 32 (-75.38%)
Mutual labels:  flutter-widget, flutter-package
incrementally loading listview
An extension of the Flutter ListView widget for incrementally loading items upon scrolling
Stars: ✭ 172 (+32.31%)
Mutual labels:  flutter-widget, flutter-package
swipedetector
A Flutter package to detect up, down, left, right swipes.
Stars: ✭ 34 (-73.85%)
Mutual labels:  flutter-widget, flutter-package
rainbow container
🌈 A magical container which changes colors whenever its build method is called.
Stars: ✭ 21 (-83.85%)
Mutual labels:  flutter-widget, flutter-package
Interactive-Add-Button-Layout
Custom Layout with interactive add button to impove your UI and UX .
Stars: ✭ 20 (-84.62%)
Mutual labels:  flutter-widget, flutter-package
dough
This package provides some widgets you can use to create a smooshy UI.
Stars: ✭ 518 (+298.46%)
Mutual labels:  flutter-widget, flutter-package
liquid button
Liquify your buttons, web demo at website
Stars: ✭ 18 (-86.15%)
Mutual labels:  flutter-widget, flutter-package
CustomSwitch
Custom Switch package created in Flutter
Stars: ✭ 56 (-56.92%)
Mutual labels:  flutter-widget, flutter-package
flutter-UI
将Flutter各种Widget各种API📘都实现一次。喜欢请Star。
Stars: ✭ 67 (-48.46%)
Mutual labels:  flutter-widget, flutter-package

Build Pub Codecov

nil

A simple widget to add in the widget tree when you want to show nothing, with minimal impact on performance.

Why?

Sometimes, according to a condition, we want to display nothing. Usually when we can't return null, we would return something like const SizedBox() for example.

This is good, but it has some performance impacts since SizedBox creates a RenderObject. The RenderObject lives in the render tree and some computations are performed on it, even if it paints nothing on the screen.

We can do better, we can have a widget which does not create a RenderObject, while being still valid. The Nil widget is the minimal implementation for this use case. It only creates an Element and does nothing while it's building. Because the optimal way to use it, is to call const Nil(), it also comes with a nil constant that you can use everywhere (which is a const Nil()).

Usage

import 'package:nil/nil.dart';

return Builder(
  builder: (_) {
    if (condition) {
      return const MyWidget();
    } else {
      return nil;
    }
  },
);

Warning

This widget is not intended to be used in widgets accepting multiple children (e.g. Rows, Columns, etc.). The best option is to not add a widget in the list if you don't want it to be displayed. Moreover using a Nil widget in such a case, can have unexpected results.

Sponsoring

I'm working on my packages on my free-time, but I don't have as much time as I would. If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].