Base pages implementation

This commit is contained in:
Igor Kulikov
2021-05-06 14:51:26 +03:00
parent 7bec80ef15
commit 64a7cdf167
80 changed files with 2878 additions and 380 deletions

View File

@@ -13,6 +13,8 @@ class TbAppBar extends TbContextWidget<TbAppBar, _TbAppBarState> implements Pref
final Widget? title;
final bool? showProfile;
final bool? showLogout;
final double? elevation;
final bool showLoadingIndicator;
final ValueNotifier<bool>? searchModeNotifier;
final String? searchHint;
final void Function(String searchText)? onSearch;
@@ -21,8 +23,9 @@ class TbAppBar extends TbContextWidget<TbAppBar, _TbAppBarState> implements Pref
@override
final Size preferredSize;
TbAppBar(TbContext tbContext, {this.title, this.showProfile = true, this.showLogout = false, this.searchModeNotifier, this.searchHint, this.onSearch, this.onSearchClosed}) :
preferredSize = Size.fromHeight(kToolbarHeight + 4),
TbAppBar(TbContext tbContext, {this.title, this.elevation, this.showProfile = true, this.showLogout = false,
this.showLoadingIndicator = true, this.searchModeNotifier, this.searchHint, this.onSearch, this.onSearchClosed}) :
preferredSize = Size.fromHeight(kToolbarHeight + (showLoadingIndicator ? 4 : 0)),
super(tbContext);
@override
@@ -70,18 +73,20 @@ class _TbAppBarState extends TbContextState<TbAppBar, _TbAppBarState> {
} else {
children.add(buildDefaultBar());
}
children.add(
ValueListenableBuilder(
valueListenable: loadingNotifier,
builder: (context, bool loading, child) {
if (loading) {
return LinearProgressIndicator();
} else {
return Container(height: 4);
if (widget.showLoadingIndicator) {
children.add(
ValueListenableBuilder(
valueListenable: loadingNotifier,
builder: (context, bool loading, child) {
if (loading) {
return LinearProgressIndicator();
} else {
return Container(height: 4);
}
}
}
)
);
)
);
}
return Column(
children: children,
);
@@ -135,7 +140,7 @@ class _TbAppBarState extends TbContextState<TbAppBar, _TbAppBarState> {
),
),
onPressed: () {
tbContext.tbClient.logout(
tbClient.logout(
requestConfig: RequestConfig(ignoreErrors: true));
}
)
@@ -144,6 +149,7 @@ class _TbAppBarState extends TbContextState<TbAppBar, _TbAppBarState> {
return AppBar(
title: widget.title,
actions: actions,
elevation: widget.elevation,
);
}
}