show_if 0.0.2 copy "show_if: ^0.0.2" to clipboard
show_if: ^0.0.2 copied to clipboard

Showing/Hiding widgets has never been easier.

ShowIf is an easier way to check a condition before showing the widget Normally we write: condition ? Text("Complicated") : Container(); With ShowIf: ShowIf(condition: true, child: Text("Simple"));

Features #

  • bool condition
  • Widget child

Usage #

import 'package:show_if/show_if.dart';

ShowIf( condition: true, child: Text("Simple"), );

Example #

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

void main() { runApp(const Test()); }

class Test extends StatefulWidget { const Test({Key? key}) : super(key: key);

@override State

class _TestState extends State

@override void initState() { _show = false; super.initState(); }

@override Widget build(BuildContext context) { return ShowIf( condition: _show, child: const Text("test"), childIfFalse: const Text("test if false"), ); } }

...

0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Showing/Hiding widgets has never been easier.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on show_if