Dashboard webview hybrid composition support

This commit is contained in:
Igor Kulikov
2021-06-04 15:35:59 +03:00
parent 125ecab009
commit 5be1d5491f
10 changed files with 108 additions and 21 deletions

View File

@@ -12,13 +12,14 @@ class TbAppBar extends TbContextWidget<TbAppBar, _TbAppBarState> implements Pref
final Widget? title;
final List<Widget>? actions;
final double? elevation;
final Color? shadowColor;
final bool showLoadingIndicator;
@override
final Size preferredSize;
TbAppBar(TbContext tbContext, {this.leading, this.title, this.actions, this.elevation = 8,
this.showLoadingIndicator = false}) :
this.shadowColor, this.showLoadingIndicator = false}) :
preferredSize = Size.fromHeight(kToolbarHeight + (showLoadingIndicator ? 4 : 0)),
super(tbContext);
@@ -68,7 +69,7 @@ class _TbAppBarState extends TbContextState<TbAppBar, _TbAppBarState> {
title: widget.title,
actions: widget.actions,
elevation: widget.elevation,
shadowColor: Color(0xFFFFFFFF).withAlpha(150),
shadowColor: widget.shadowColor ?? Color(0xFFFFFFFF).withAlpha(150),
);
}
}

View File

@@ -0,0 +1,33 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class TwoValueListenableBuilder<A, B> extends StatelessWidget {
TwoValueListenableBuilder(
{
Key? key,
required this.firstValueListenable,
required this.secondValueListenable,
required this.builder,
this.child,
}) : super(key: key);
final ValueListenable<A> firstValueListenable;
final ValueListenable<B> secondValueListenable;
final Widget? child;
final Widget Function(BuildContext context, A a, B b, Widget? child) builder;
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<A>(
valueListenable: firstValueListenable,
builder: (_, a, __) {
return ValueListenableBuilder<B>(
valueListenable: secondValueListenable,
builder: (context, b, __) {
return builder(context, a, b, child);
},
);
},
);
}
}