-
Thinking about the import 'package:flutter/widgets.dart';
import 'package:signals/signals_flutter.dart';
class SignalBuilder<T extends Widget> extends StatelessWidget {
SignalBuilder({super.key, required this.builder})
: signal = computed<T>(builder);
final T Function() builder;
final ReadonlySignal<T> signal;
@override
Widget build(BuildContext context) {
return signal.watch(context);
}
} This would have an internal computed signal that would only rebuild on signal changes and treat the computation as creating a widget. |
Beta Was this translation helpful? Give feedback.
Answered by
rodydavis
Nov 29, 2023
Replies: 1 comment 1 reply
-
I've been in a loop for days about this. I would rather gain experience without specific Signal's Widgets and then come with a global approach rather than pushing partials too early. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pushed
Watch
as a new widget due to limitations of reacting to changes with Theme and Media as inherited widgets. I think it is a clean approach and very efficient.It also fixes the issue when reading future/stream signals and using map