A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

24 lines
686 B

part of '../../settings.dart';
class OptionBuilder<T> extends StatelessWidget {
const OptionBuilder({
required this.option,
required this.builder,
super.key,
});
final Option<T> option;
final Widget Function(BuildContext context, T? data) builder;
@override
Widget build(final BuildContext context) => StreamBuilder<T?>(
stream: option.defaultValue,
builder: (final context, final defaultValueSnapshot) => StreamBuilder<T?>(
stream: option.stream,
builder: (final context, final valueSnapshot) => builder(
context,
valueSnapshot.data ?? defaultValueSnapshot.data,
),
),
);
}