mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-24 15:56:05 +00:00
Merge branch 'beta'
This commit is contained in:
commit
98f7ec6946
6 changed files with 273 additions and 274 deletions
|
@ -214,7 +214,7 @@ class _MainState extends State<Main> with WidgetsBindingObserver {
|
|||
isBeta: appConfigProvider.getAppInfo!.version.contains('beta'),
|
||||
);
|
||||
if (result != null && appConfigProvider.doNotRememberVersion != result.tagName && mounted) {
|
||||
await showDialog(
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => UpdateModal(
|
||||
gitHubRelease: result,
|
||||
|
|
|
@ -188,7 +188,6 @@ class _AddedListState extends State<AddedList> {
|
|||
: null,
|
||||
onDelete: openDeleteModal,
|
||||
splitView: widget.splitView,
|
||||
serverVersion: statusProvider.serverStatus!.serverVersion,
|
||||
),
|
||||
noData: SizedBox(
|
||||
width: double.maxFinite,
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||
|
||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||
|
||||
import 'package:adguard_home_manager/providers/status_provider.dart';
|
||||
import 'package:adguard_home_manager/functions/compare_versions.dart';
|
||||
import 'package:adguard_home_manager/functions/copy_clipboard.dart';
|
||||
import 'package:adguard_home_manager/models/clients.dart';
|
||||
|
@ -18,7 +19,6 @@ class AddedClientTile extends StatelessWidget {
|
|||
final void Function(Client) onDelete;
|
||||
final Client? selectedClient;
|
||||
final bool? splitView;
|
||||
final String serverVersion;
|
||||
|
||||
const AddedClientTile({
|
||||
Key? key,
|
||||
|
@ -29,11 +29,11 @@ class AddedClientTile extends StatelessWidget {
|
|||
required this.onDelete,
|
||||
this.selectedClient,
|
||||
required this.splitView,
|
||||
required this.serverVersion
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final statusProvider = Provider.of<StatusProvider>(context);
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
if (splitView == true) {
|
||||
|
@ -147,7 +147,7 @@ class AddedClientTile extends StatelessWidget {
|
|||
Icons.search_rounded,
|
||||
size: 19,
|
||||
color: serverVersionIsAhead(
|
||||
currentVersion: serverVersion,
|
||||
currentVersion: statusProvider.serverStatus!.serverVersion,
|
||||
referenceVersion: 'v0.107.28',
|
||||
referenceVersionBeta: 'v0.108.0-b.33'
|
||||
) == true
|
||||
|
@ -261,7 +261,7 @@ class AddedClientTile extends StatelessWidget {
|
|||
Icons.search_rounded,
|
||||
size: 19,
|
||||
color: serverVersionIsAhead(
|
||||
currentVersion: serverVersion,
|
||||
currentVersion: statusProvider.serverStatus!.serverVersion,
|
||||
referenceVersion: 'v0.107.28',
|
||||
referenceVersionBeta: 'v0.108.0-b.33'
|
||||
) == true
|
||||
|
|
|
@ -73,258 +73,7 @@ class FiltersTripleColumn extends StatelessWidget {
|
|||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Widget content() {
|
||||
switch (filteringProvider.loadStatus) {
|
||||
case LoadStatus.loading:
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingFilters,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
case LoadStatus.loaded:
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.whitelists,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: 'whitelist',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addWhitelist,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.whitelistFilters.length,
|
||||
itemBuilder: (context, index) => ListOptionsMenu(
|
||||
list: filteringProvider.filtering!.whitelistFilters[index],
|
||||
listType: 'whitelist',
|
||||
child: CustomListTile(
|
||||
title: filteringProvider.filtering!.whitelistFilters[index].name,
|
||||
subtitle: "${intFormat(filteringProvider.filtering!.whitelistFilters[index].rulesCount, Platform.localeName)} ${AppLocalizations.of(context)!.enabledRules}",
|
||||
trailing: Icon(
|
||||
filteringProvider.filtering!.whitelistFilters[index].enabled == true
|
||||
? Icons.check_circle_rounded
|
||||
: Icons.cancel,
|
||||
color: filteringProvider.filtering!.whitelistFilters[index].enabled == true
|
||||
? appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.green
|
||||
: appConfigProvider.useThemeColorForStatus == true
|
||||
? Colors.grey
|
||||
: Colors.red
|
||||
),
|
||||
onTap: () => onOpenDetailsModal(filteringProvider.filtering!.whitelistFilters[index], 'whitelist'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.blacklists,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: 'blacklist',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addBlacklist,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.filters.length,
|
||||
itemBuilder: (context, index) => ListOptionsMenu(
|
||||
list: filteringProvider.filtering!.filters[index],
|
||||
listType: 'blacklist',
|
||||
child: CustomListTile(
|
||||
title: filteringProvider.filtering!.filters[index].name,
|
||||
subtitle: "${intFormat(filteringProvider.filtering!.filters[index].rulesCount, Platform.localeName)} ${AppLocalizations.of(context)!.enabledRules}",
|
||||
trailing: Icon(
|
||||
filteringProvider.filtering!.filters[index].enabled == true
|
||||
? Icons.check_circle_rounded
|
||||
: Icons.cancel,
|
||||
color: filteringProvider.filtering!.filters[index].enabled == true
|
||||
? appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.green
|
||||
: appConfigProvider.useThemeColorForStatus == true
|
||||
? Colors.grey
|
||||
: Colors.red
|
||||
),
|
||||
onTap: () => onOpenDetailsModal(filteringProvider.filtering!.filters[index], 'blacklist'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.customRules,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: '',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addCustomRule,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.userRules.length,
|
||||
itemBuilder: (context, index) => ContextMenuArea(
|
||||
builder: (context) => [
|
||||
CustomListTile(
|
||||
title: AppLocalizations.of(context)!.copyClipboard,
|
||||
icon: Icons.copy_rounded,
|
||||
onTap: () {
|
||||
copyToClipboard(
|
||||
value: filteringProvider.filtering!.userRules[index],
|
||||
successMessage: AppLocalizations.of(context)!.copiedClipboard,
|
||||
);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
),
|
||||
],
|
||||
child: CustomListTile(
|
||||
onLongPress: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => OptionsModal(
|
||||
options: [
|
||||
MenuOption(
|
||||
title: AppLocalizations.of(context)!.copyClipboard,
|
||||
icon: Icons.copy_rounded,
|
||||
action: () => copyToClipboard(
|
||||
value: filteringProvider.filtering!.userRules[index],
|
||||
successMessage: AppLocalizations.of(context)!.copiedClipboard,
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
title: filteringProvider.filtering!.userRules[index],
|
||||
subtitleWidget: generateSubtitle(filteringProvider.filtering!.userRules[index]),
|
||||
trailing: IconButton(
|
||||
onPressed: () => onRemoveCustomRule(filteringProvider.filtering!.userRules[index]),
|
||||
icon: const Icon(Icons.delete),
|
||||
tooltip: AppLocalizations.of(context)!.delete,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
case LoadStatus.error:
|
||||
return SizedBox.expand(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
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)!.filtersNotLoaded,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
@ -334,7 +83,7 @@ class FiltersTripleColumn extends StatelessWidget {
|
|||
IconButton(
|
||||
onPressed: () async {
|
||||
final result = await filteringProvider.fetchFilters();
|
||||
if (result == false) {
|
||||
if (result == false && context.mounted) {
|
||||
showSnacbkar(
|
||||
appConfigProvider: appConfigProvider,
|
||||
label: AppLocalizations.of(context)!.errorLoadFilters,
|
||||
|
@ -348,7 +97,258 @@ class FiltersTripleColumn extends StatelessWidget {
|
|||
...actions
|
||||
],
|
||||
),
|
||||
body: content(),
|
||||
body: Builder(
|
||||
builder: (context) {
|
||||
switch (filteringProvider.loadStatus) {
|
||||
case LoadStatus.loading:
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.loadingFilters,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
case LoadStatus.loaded:
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.whitelists,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: 'whitelist',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addWhitelist,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.whitelistFilters.length,
|
||||
itemBuilder: (context, index) => ListOptionsMenu(
|
||||
list: filteringProvider.filtering!.whitelistFilters[index],
|
||||
listType: 'whitelist',
|
||||
child: CustomListTile(
|
||||
title: filteringProvider.filtering!.whitelistFilters[index].name,
|
||||
subtitle: "${intFormat(filteringProvider.filtering!.whitelistFilters[index].rulesCount, Platform.localeName)} ${AppLocalizations.of(context)!.enabledRules}",
|
||||
trailing: Icon(
|
||||
filteringProvider.filtering!.whitelistFilters[index].enabled == true
|
||||
? Icons.check_circle_rounded
|
||||
: Icons.cancel,
|
||||
color: filteringProvider.filtering!.whitelistFilters[index].enabled == true
|
||||
? appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.green
|
||||
: appConfigProvider.useThemeColorForStatus == true
|
||||
? Colors.grey
|
||||
: Colors.red
|
||||
),
|
||||
onTap: () => onOpenDetailsModal(filteringProvider.filtering!.whitelistFilters[index], 'whitelist'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.blacklists,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: 'blacklist',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addBlacklist,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.filters.length,
|
||||
itemBuilder: (context, index) => ListOptionsMenu(
|
||||
list: filteringProvider.filtering!.filters[index],
|
||||
listType: 'blacklist',
|
||||
child: CustomListTile(
|
||||
title: filteringProvider.filtering!.filters[index].name,
|
||||
subtitle: "${intFormat(filteringProvider.filtering!.filters[index].rulesCount, Platform.localeName)} ${AppLocalizations.of(context)!.enabledRules}",
|
||||
trailing: Icon(
|
||||
filteringProvider.filtering!.filters[index].enabled == true
|
||||
? Icons.check_circle_rounded
|
||||
: Icons.cancel,
|
||||
color: filteringProvider.filtering!.filters[index].enabled == true
|
||||
? appConfigProvider.useThemeColorForStatus == true
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.green
|
||||
: appConfigProvider.useThemeColorForStatus == true
|
||||
? Colors.grey
|
||||
: Colors.red
|
||||
),
|
||||
onTap: () => onOpenDetailsModal(filteringProvider.filtering!.filters[index], 'blacklist'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.customRules,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500
|
||||
),
|
||||
),
|
||||
AddFiltersButton(
|
||||
type: '',
|
||||
widget: (fn) => IconButton(
|
||||
onPressed: fn,
|
||||
icon: const Icon(Icons.add_rounded),
|
||||
tooltip: AppLocalizations.of(context)!.addCustomRule,
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteringProvider.filtering!.userRules.length,
|
||||
itemBuilder: (context, index) => ContextMenuArea(
|
||||
builder: (context) => [
|
||||
CustomListTile(
|
||||
title: AppLocalizations.of(context)!.copyClipboard,
|
||||
icon: Icons.copy_rounded,
|
||||
onTap: () {
|
||||
copyToClipboard(
|
||||
value: filteringProvider.filtering!.userRules[index],
|
||||
successMessage: AppLocalizations.of(context)!.copiedClipboard,
|
||||
);
|
||||
Navigator.pop(context);
|
||||
}
|
||||
),
|
||||
],
|
||||
child: CustomListTile(
|
||||
onLongPress: () => showDialog(
|
||||
context: context,
|
||||
builder: (context) => OptionsModal(
|
||||
options: [
|
||||
MenuOption(
|
||||
title: AppLocalizations.of(context)!.copyClipboard,
|
||||
icon: Icons.copy_rounded,
|
||||
action: () => copyToClipboard(
|
||||
value: filteringProvider.filtering!.userRules[index],
|
||||
successMessage: AppLocalizations.of(context)!.copiedClipboard,
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
title: filteringProvider.filtering!.userRules[index],
|
||||
subtitleWidget: generateSubtitle(filteringProvider.filtering!.userRules[index]),
|
||||
trailing: IconButton(
|
||||
onPressed: () => onRemoveCustomRule(filteringProvider.filtering!.userRules[index]),
|
||||
icon: const Icon(Icons.delete),
|
||||
tooltip: AppLocalizations.of(context)!.delete,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
case LoadStatus.error:
|
||||
return SizedBox.expand(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
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)!.filtersNotLoaded,
|
||||
style: TextStyle(
|
||||
fontSize: 22,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
default:
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -11,8 +11,8 @@ class LogsConfigOptions extends StatelessWidget {
|
|||
final bool anonymizeClientIp;
|
||||
final void Function(bool) updateAnonymizeClientIp;
|
||||
final List<RetentionItem> retentionItems;
|
||||
final String? retentionTime;
|
||||
final void Function(String?) updateRetentionTime;
|
||||
final double? retentionTime;
|
||||
final void Function(double?) updateRetentionTime;
|
||||
final void Function() onClear;
|
||||
final void Function() onConfirm;
|
||||
|
||||
|
@ -130,14 +130,12 @@ class LogsConfigOptions extends StatelessWidget {
|
|||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
child: DropdownButtonFormField(
|
||||
items: retentionItems.map<DropdownMenuItem<String>>((item) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: item.value.toString(),
|
||||
child: Text(item.label),
|
||||
);
|
||||
}).toList(),
|
||||
items: retentionItems.map((item) => DropdownMenuItem(
|
||||
value: item.value,
|
||||
child: Text(item.label),
|
||||
)).toList(),
|
||||
value: retentionTime,
|
||||
onChanged: (value) => updateRetentionTime(value),
|
||||
onChanged: (value) => updateRetentionTime(value as double),
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
|
|
|
@ -79,7 +79,7 @@ class LogsConfigModalWidget extends StatefulWidget {
|
|||
class _LogsConfigModalWidgetState extends State<LogsConfigModalWidget> {
|
||||
bool generalSwitch = false;
|
||||
bool anonymizeClientIp = false;
|
||||
String? retentionTime = "";
|
||||
double? retentionTime;
|
||||
|
||||
List<RetentionItem> retentionItems = [];
|
||||
|
||||
|
@ -101,8 +101,10 @@ class _LogsConfigModalWidgetState extends State<LogsConfigModalWidget> {
|
|||
setState(() {
|
||||
generalSwitch = result['data']['enabled'];
|
||||
anonymizeClientIp = result['data']['anonymize_client_ip'];
|
||||
retentionTime = result['data']['interval'].toString();
|
||||
loadStatus = LoadStatus.loading;
|
||||
retentionTime = result['data']['interval'] != null
|
||||
? double.parse(result['data']['interval'].toString())
|
||||
: null;
|
||||
loadStatus = LoadStatus.loaded;
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -191,7 +193,7 @@ class _LogsConfigModalWidgetState extends State<LogsConfigModalWidget> {
|
|||
onClear: () => widget.onClear(),
|
||||
onConfirm: () => widget.onConfirm({
|
||||
"enabled": generalSwitch,
|
||||
"interval": double.parse(retentionTime!),
|
||||
"interval": retentionTime,
|
||||
"anonymize_client_ip": anonymizeClientIp
|
||||
})
|
||||
);
|
||||
|
@ -235,7 +237,7 @@ class _LogsConfigModalWidgetState extends State<LogsConfigModalWidget> {
|
|||
onClear: () => widget.onClear(),
|
||||
onConfirm: () => widget.onConfirm({
|
||||
"enabled": generalSwitch,
|
||||
"interval": double.parse(retentionTime!),
|
||||
"interval": retentionTime,
|
||||
"anonymize_client_ip": anonymizeClientIp
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue