nank1ro / solidart

Signals in Dart and Flutter, inspired by SolidJS
https://docs.page/nank1ro/solidart
MIT License
155 stars 5 forks source link

[feat] show signal fn #24

Closed nank1ro closed 1 year ago

nank1ro commented 1 year ago

The Show widget now takes a functions that returns a bool. You easily convert any type to bool, for example:

final count = createSignal(0);

@override
Widget build(BuildContext context) {
  return Show(
    when: () => count() > 5,
    builder: (context) => const Text('Count is greater than 5'),
    fallback: (context) => const Text('Count is lower than 6'),
  );
}
codecov[bot] commented 1 year ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (dev@97804a5). Click here to learn what that means. The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##             dev      #24   +/-   ##
======================================
  Coverage       ?   98.84%           
======================================
  Files          ?       16           
  Lines          ?      690           
  Branches       ?        0           
======================================
  Hits           ?      682           
  Misses         ?        8           
  Partials       ?        0