mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-03 21:30:15 +00:00
Added sliverappbar to more screens
This commit is contained in:
parent
a3c63ffd9a
commit
b270ca2b8c
4 changed files with 331 additions and 210 deletions
|
@ -85,8 +85,16 @@ class _BlockedServicesScreenStateWidget extends State<BlockedServicesScreen> {
|
||||||
|
|
||||||
if (widget.fullScreen == true) {
|
if (widget.fullScreen == true) {
|
||||||
return Dialog.fullscreen(
|
return Dialog.fullscreen(
|
||||||
child: Scaffold(
|
child: Material(
|
||||||
appBar: AppBar(
|
child: NestedScrollView(
|
||||||
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
|
SliverOverlapAbsorber(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
sliver: SliverAppBar.large(
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
|
centerTitle: false,
|
||||||
|
forceElevated: innerBoxIsScrolled,
|
||||||
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
||||||
title: Text(AppLocalizations.of(context)!.blockedServices),
|
title: Text(AppLocalizations.of(context)!.blockedServices),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -99,24 +107,108 @@ class _BlockedServicesScreenStateWidget extends State<BlockedServicesScreen> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 10)
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: RefreshIndicator(
|
top: false,
|
||||||
onRefresh: () async {
|
bottom: true,
|
||||||
final result = await filteringProvider.loadBlockedServices();
|
child: Builder(
|
||||||
if (result == false) {
|
builder: (context) => CustomScrollView(
|
||||||
showSnacbkar(
|
slivers: [
|
||||||
appConfigProvider: appConfigProvider,
|
SliverOverlapInjector(
|
||||||
label: AppLocalizations.of(context)!.blockedServicesListNotLoaded,
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
color: Colors.red
|
),
|
||||||
);
|
if (filteringProvider.blockedServicesLoadStatus == LoadStatus.loading) Container(
|
||||||
}
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
},
|
width: double.maxFinite,
|
||||||
child: _Content(
|
child: Column(
|
||||||
values: values,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
updateValues: updateValues,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const CircularProgressIndicator(),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.loadingBlockedServicesList,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (filteringProvider.blockedServicesLoadStatus == LoadStatus.loaded) SliverList.builder(
|
||||||
|
itemCount: filteringProvider.blockedServices!.services.length,
|
||||||
|
itemBuilder: (context, index) => Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => updateValues(
|
||||||
|
values.contains(filteringProvider.blockedServices!.services[index].id),
|
||||||
|
filteringProvider.blockedServices!.services[index]
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 6,
|
||||||
|
bottom: 6,
|
||||||
|
right: 12,
|
||||||
|
left: 24
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
filteringProvider.blockedServices!.services[index].name,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Checkbox(
|
||||||
|
value: values.contains(filteringProvider.blockedServices!.services[index].id),
|
||||||
|
onChanged: (value) => updateValues(
|
||||||
|
value!,
|
||||||
|
filteringProvider.blockedServices!.services[index]
|
||||||
|
),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(5)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
if (filteringProvider.blockedServicesLoadStatus == LoadStatus.error) Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||||
|
width: double.maxFinite,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.red,
|
||||||
|
size: 50,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
Text(
|
||||||
|
AppLocalizations.of(context)!.blockedServicesListNotLoaded,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 22,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -162,32 +254,8 @@ class _BlockedServicesScreenStateWidget extends State<BlockedServicesScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _Content(
|
child: Builder(
|
||||||
values: values,
|
builder: (ctx) {
|
||||||
updateValues: updateValues,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _Content extends StatelessWidget {
|
|
||||||
final List<String> values;
|
|
||||||
final void Function(bool value, BlockedService item) updateValues;
|
|
||||||
|
|
||||||
const _Content({
|
|
||||||
required this.values,
|
|
||||||
required this.updateValues,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final filteringProvider = Provider.of<FilteringProvider>(context);
|
|
||||||
|
|
||||||
switch (filteringProvider.blockedServicesLoadStatus) {
|
switch (filteringProvider.blockedServicesLoadStatus) {
|
||||||
case LoadStatus.loading:
|
case LoadStatus.loading:
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -284,8 +352,17 @@ class _Content extends StatelessWidget {
|
||||||
default:
|
default:
|
||||||
return const SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void openBlockedServicesModal({
|
void openBlockedServicesModal({
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
|
|
|
@ -55,8 +55,16 @@ class _AddCustomRuleState extends State<AddCustomRule> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.fullScreen == true) {
|
if (widget.fullScreen == true) {
|
||||||
return Dialog.fullscreen(
|
return Dialog.fullscreen(
|
||||||
child: Scaffold(
|
child: Material(
|
||||||
appBar: AppBar(
|
child: NestedScrollView(
|
||||||
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
|
SliverOverlapAbsorber(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
sliver: SliverAppBar.large(
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
|
centerTitle: false,
|
||||||
|
forceElevated: innerBoxIsScrolled,
|
||||||
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
||||||
title: Text(AppLocalizations.of(context)!.addCustomRule),
|
title: Text(AppLocalizations.of(context)!.addCustomRule),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -77,9 +85,19 @@ class _AddCustomRuleState extends State<AddCustomRule> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 10)
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: ListView(
|
top: false,
|
||||||
|
bottom: true,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverList.list(
|
||||||
children: [
|
children: [
|
||||||
_CustomRuleEditor(
|
_CustomRuleEditor(
|
||||||
domainController: _domainController,
|
domainController: _domainController,
|
||||||
|
@ -91,8 +109,12 @@ class _AddCustomRuleState extends State<AddCustomRule> {
|
||||||
validateDomain: validateDomain
|
validateDomain: validateDomain
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,16 @@ class _EditCustomRulesState extends State<EditCustomRules> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (widget.fullScreen == true) {
|
if (widget.fullScreen == true) {
|
||||||
return Dialog.fullscreen(
|
return Dialog.fullscreen(
|
||||||
child: Scaffold(
|
child: Material(
|
||||||
appBar: AppBar(
|
child: NestedScrollView(
|
||||||
|
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
||||||
|
SliverOverlapAbsorber(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
sliver: SliverAppBar.large(
|
||||||
|
pinned: true,
|
||||||
|
floating: true,
|
||||||
|
centerTitle: false,
|
||||||
|
forceElevated: innerBoxIsScrolled,
|
||||||
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
leading: CloseButton(onPressed: () => Navigator.pop(context)),
|
||||||
title: Text(AppLocalizations.of(context)!.editCustomRules),
|
title: Text(AppLocalizations.of(context)!.editCustomRules),
|
||||||
actions: [
|
actions: [
|
||||||
|
@ -52,14 +60,28 @@ class _EditCustomRulesState extends State<EditCustomRules> {
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10)
|
const SizedBox(width: 10)
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: ListView(
|
top: false,
|
||||||
|
bottom: true,
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => CustomScrollView(
|
||||||
|
slivers: [
|
||||||
|
SliverOverlapInjector(
|
||||||
|
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
||||||
|
),
|
||||||
|
SliverList.list(
|
||||||
children: [
|
children: [
|
||||||
_CustomRulesRawEditor(fieldController: _fieldController)
|
_CustomRulesRawEditor(fieldController: _fieldController)
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,13 @@ PODS:
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
- package_info_plus (0.0.1):
|
- package_info_plus (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- Sentry/HybridSDK (8.20.0):
|
- Sentry/HybridSDK (8.21.0):
|
||||||
- SentryPrivate (= 8.20.0)
|
- SentryPrivate (= 8.21.0)
|
||||||
- sentry_flutter (0.0.1):
|
- sentry_flutter (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- Sentry/HybridSDK (= 8.20.0)
|
- Sentry/HybridSDK (= 8.21.0)
|
||||||
- SentryPrivate (8.20.0)
|
- SentryPrivate (8.21.0)
|
||||||
- shared_preferences_foundation (0.0.1):
|
- shared_preferences_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
@ -84,9 +84,9 @@ SPEC CHECKSUMS:
|
||||||
dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f
|
dynamic_color: 2eaa27267de1ca20d879fbd6e01259773fb1670f
|
||||||
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||||
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
|
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
|
||||||
Sentry: a8d7b373b9f9868442b02a0c425192f693103cbf
|
Sentry: ebc12276bd17613a114ab359074096b6b3725203
|
||||||
sentry_flutter: 03e7660857a8cdb236e71456a7e8447b65c8a788
|
sentry_flutter: dff1df05dc39c83d04f9330b36360fc374574c5e
|
||||||
SentryPrivate: 006b24af16828441f70e2ab6adf241bd0a8ad130
|
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
|
||||||
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
||||||
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
||||||
sqlite3: 73b7fc691fdc43277614250e04d183740cb15078
|
sqlite3: 73b7fc691fdc43277614250e04d183740cb15078
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue