mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-14 05:52:51 +00:00
Optimized access settings
This commit is contained in:
parent
ef43f8b5dd
commit
bc8e74be6d
4 changed files with 350 additions and 207 deletions
|
@ -15,6 +15,7 @@ class CustomTabContentList extends StatelessWidget {
|
|||
final double? refreshIndicatorOffset;
|
||||
final Widget? fab;
|
||||
final bool? fabVisible;
|
||||
final bool? noSliver;
|
||||
|
||||
const CustomTabContentList({
|
||||
Key? key,
|
||||
|
@ -27,7 +28,8 @@ class CustomTabContentList extends StatelessWidget {
|
|||
required this.onRefresh,
|
||||
this.refreshIndicatorOffset,
|
||||
this.fab,
|
||||
this.fabVisible
|
||||
this.fabVisible,
|
||||
this.noSliver
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
@ -36,95 +38,156 @@ class CustomTabContentList extends StatelessWidget {
|
|||
|
||||
switch (loadStatus) {
|
||||
case LoadStatus.loading:
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: loadingGenerator()
|
||||
if (noSliver == true) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: loadingGenerator()
|
||||
);
|
||||
}
|
||||
else {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
SliverFillRemaining(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: loadingGenerator()
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
case LoadStatus.loaded:
|
||||
return Stack(
|
||||
children: [
|
||||
SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: onRefresh,
|
||||
edgeOffset: refreshIndicatorOffset ?? 95,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
if (itemsCount > 0) SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) => contentWidget(index),
|
||||
childCount: itemsCount
|
||||
if (noSliver == true) {
|
||||
if (itemsCount > 0) {
|
||||
return Stack(
|
||||
children: [
|
||||
ListView.builder(
|
||||
itemCount: itemsCount,
|
||||
itemBuilder: (context, index) => contentWidget(index),
|
||||
),
|
||||
if (fab != null) AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: fabVisible != null && fabVisible == true ?
|
||||
appConfigProvider.showingSnackbar
|
||||
? 70 : 20
|
||||
: -70,
|
||||
right: 20,
|
||||
child: fab!
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
else {
|
||||
return Stack(
|
||||
children: [
|
||||
noData,
|
||||
if (fab != null) AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: fabVisible != null && fabVisible == true ?
|
||||
appConfigProvider.showingSnackbar
|
||||
? 70 : 20
|
||||
: -70,
|
||||
right: 20,
|
||||
child: fab!
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return Stack(
|
||||
children: [
|
||||
SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
return RefreshIndicator(
|
||||
onRefresh: onRefresh,
|
||||
edgeOffset: refreshIndicatorOffset ?? 95,
|
||||
child: CustomScrollView(
|
||||
slivers: <Widget>[
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
),
|
||||
if (itemsCount == 0) SliverFillRemaining(
|
||||
child: noData,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
if (itemsCount > 0) SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
(context, index) => contentWidget(index),
|
||||
childCount: itemsCount
|
||||
),
|
||||
),
|
||||
if (itemsCount == 0) SliverFillRemaining(
|
||||
child: noData,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
if (fab != null) AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: fabVisible != null && fabVisible == true ?
|
||||
appConfigProvider.showingSnackbar
|
||||
? 70 : 20
|
||||
: -70,
|
||||
right: 20,
|
||||
child: fab!
|
||||
),
|
||||
],
|
||||
);
|
||||
if (fab != null) AnimatedPositioned(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: fabVisible != null && fabVisible == true ?
|
||||
appConfigProvider.showingSnackbar
|
||||
? 70 : 20
|
||||
: -70,
|
||||
right: 20,
|
||||
child: fab!
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
case LoadStatus.error:
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 95,
|
||||
left: 16,
|
||||
right: 16
|
||||
),
|
||||
child: errorGenerator()
|
||||
),
|
||||
)
|
||||
],
|
||||
if (noSliver == true) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 95,
|
||||
left: 16,
|
||||
right: 16
|
||||
),
|
||||
)
|
||||
);
|
||||
child: errorGenerator()
|
||||
);
|
||||
}
|
||||
else {
|
||||
return SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: Builder(
|
||||
builder: (BuildContext context) => CustomScrollView(
|
||||
slivers: [
|
||||
SliverOverlapInjector(
|
||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||
),
|
||||
SliverFillRemaining(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 95,
|
||||
left: 16,
|
||||
right: 16
|
||||
),
|
||||
child: errorGenerator()
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue