More UI changes

This commit is contained in:
Juan Gilsanz Polo 2022-11-04 22:56:00 +01:00
parent 55010f8896
commit 5067122344
36 changed files with 819 additions and 743 deletions

View file

@ -25,7 +25,12 @@ ThemeData lightTheme(ColorScheme? dynamicColorScheme) => ThemeData(
),
),
navigationBarTheme: NavigationBarThemeData(
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor,
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.secondaryContainer : adguardGreenColor,
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: dynamicColorScheme != null ? dynamicColorScheme.onSecondaryContainer : adguardGreenColor,
)
)
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
foregroundColor: Colors.white,
@ -79,7 +84,12 @@ ThemeData darkTheme(ColorScheme? dynamicColorScheme) => ThemeData(
scaffoldBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.background :const Color.fromRGBO(18, 18, 18, 1),
dialogBackgroundColor: dynamicColorScheme != null ? dynamicColorScheme.background : const Color.fromRGBO(44, 44, 44, 1),
navigationBarTheme: NavigationBarThemeData(
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.primaryContainer : adguardGreenColor,
indicatorColor: dynamicColorScheme != null ? dynamicColorScheme.secondaryContainer : adguardGreenColor,
iconTheme: MaterialStateProperty.all(
IconThemeData(
color: dynamicColorScheme != null ? dynamicColorScheme.onSecondaryContainer : adguardGreenColor,
)
)
),
snackBarTheme: SnackBarThemeData(
contentTextStyle: const TextStyle(

View file

@ -199,7 +199,7 @@ class _AddedListState extends State<AddedList> {
padding: const EdgeInsets.only(top: 0),
itemCount: widget.data.length,
itemBuilder: (context, index) => ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
contentPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
isThreeLine: true,
onLongPress: () => openOptionsModal(widget.data[index]),
onTap: () => openClientModal(widget.data[index]),
@ -207,16 +207,22 @@ class _AddedListState extends State<AddedList> {
padding: const EdgeInsets.only(bottom: 5),
child: Text(
widget.data[index].name,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.normal
fontWeight: FontWeight.normal,
color: Theme.of(context).colorScheme.onSurface
),
),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(widget.data[index].ids.toString().replaceAll(RegExp(r'^\[|\]$'), '')),
Text(
widget.data[index].ids.toString().replaceAll(RegExp(r'^\[|\]$'), ''),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
const SizedBox(height: 7),
Row(
children: [

View file

@ -121,26 +121,15 @@ class _ClientsWidgetState extends State<ClientsWidget> with TickerProviderStateM
],
bottom: TabBar(
controller: tabController,
unselectedLabelColor: Theme.of(context).colorScheme.onSurfaceVariant,
tabs: [
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.devices),
const SizedBox(width: 20),
Text(AppLocalizations.of(context)!.activeClients)
],
),
icon: const Icon(Icons.devices),
text: AppLocalizations.of(context)!.activeClients,
),
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.add),
const SizedBox(width: 20),
Text(AppLocalizations.of(context)!.added)
],
),
icon: const Icon(Icons.add_rounded),
text: AppLocalizations.of(context)!.added,
),
]
)
@ -154,9 +143,7 @@ class _ClientsWidgetState extends State<ClientsWidget> with TickerProviderStateM
color: Theme.of(context).scaffoldBackgroundColor,
border: Border(
top: BorderSide(
color: Theme.of(context).brightness == Brightness.light
? const Color.fromRGBO(220, 220, 220, 1)
: const Color.fromRGBO(50, 50, 50, 1)
color: Theme.of(context).colorScheme.surfaceVariant
)
)
),

View file

@ -56,7 +56,12 @@ class ClientsList extends StatelessWidget {
subtitle: data[index].name != ''
? data[index].ip
: null,
trailing: Text(data[index].source),
trailing: Text(
data[index].source,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
),
)
);
}

View file

@ -14,33 +14,35 @@ class OptionsModal extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AlertDialog(
contentPadding: const EdgeInsets.all(0),
contentPadding: const EdgeInsets.symmetric(
horizontal: 0,
vertical: 16
),
title: Column(
children: [
const Icon(Icons.more_horiz),
const SizedBox(height: 20),
const SizedBox(height: 16),
Text(AppLocalizations.of(context)!.options)
],
),
content: SizedBox(
height: 150,
width: double.minPositive,
child: ListView(
physics: const NeverScrollableScrollPhysics(),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 25),
const SizedBox(height: 24),
ListTile(
onTap: () {
Navigator.pop(context);
onEdit();
},
title: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(AppLocalizations.of(context)!.edit),
title: Text(
AppLocalizations.of(context)!.edit,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
leading: const Padding(
padding: EdgeInsets.only(left: 10),
child: Icon(Icons.edit),
),
leading: Icon(
Icons.edit,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
ListTile(
@ -48,18 +50,19 @@ class OptionsModal extends StatelessWidget {
Navigator.pop(context);
onDelete();
},
title: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(AppLocalizations.of(context)!.delete),
title: Text(
AppLocalizations.of(context)!.delete,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
leading: const Padding(
padding: EdgeInsets.only(left: 10),
child: Icon(Icons.delete),
),
leading: Icon(
Icons.delete,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),

View file

@ -14,15 +14,26 @@ class RemoveClientModal extends StatelessWidget {
return AlertDialog(
title: Column(
children: [
const Icon(
Icon(
Icons.delete_rounded,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary
),
const SizedBox(height: 20),
Text(AppLocalizations.of(context)!.removeClient)
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.removeClient,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
)
],
),
content: Text(AppLocalizations.of(context)!.removeClientMessage),
content: Text(
AppLocalizations.of(context)!.removeClientMessage,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),

View file

@ -1,18 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:material_segmented_control/material_segmented_control.dart';
import 'package:flutter_web_browser/flutter_web_browser.dart';
import 'package:adguard_home_manager/widgets/custom_radio_toggle.dart';
import 'package:adguard_home_manager/constants/urls.dart';
class AddCustomRule extends StatefulWidget {
final ScrollController scrollController;
final void Function(String) onConfirm;
const AddCustomRule({
Key? key,
required this.scrollController,
required this.onConfirm
}) : super(key: key);
@ -24,19 +21,14 @@ class _AddCustomRuleState extends State<AddCustomRule> {
final TextEditingController domainController = TextEditingController();
String? domainError;
String preset = "block";
int preset = 0;
bool addImportant = false;
bool checkValidValues() {
if (
domainController.text != '' &&
domainError == null &&
(
preset == 'block' ||
preset == 'unblock' ||
preset == 'custom'
)
domainError == null
) {
return true;
}
@ -61,10 +53,10 @@ class _AddCustomRuleState extends State<AddCustomRule> {
String fieldValue = value ?? domainController.text;
if (preset == 'block') {
if (preset == 0) {
rule = "||${fieldValue.trim()}^";
}
else if (preset == 'unblock') {
else if (preset == 1) {
rule = "@@||${fieldValue.trim()}^";
}
else {
@ -96,38 +88,40 @@ class _AddCustomRuleState extends State<AddCustomRule> {
@override
Widget build(BuildContext context) {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(28),
topRight: Radius.circular(28)
)
Map<int, Widget> presets = {
0: Text(
AppLocalizations.of(context)!.block,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w500
),
child: Column(
),
1: Text(
AppLocalizations.of(context)!.unblock,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w500
),
),
2: Text(
AppLocalizations.of(context)!.custom,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w500
),
),
};
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.addCustomRule),
),
body: ListView(
children: [
Expanded(
child: ListView(
controller: widget.scrollController,
children: [
const Padding(
padding: EdgeInsets.only(top: 28),
child: Icon(
Icons.shield_rounded,
size: 26,
),
),
const SizedBox(height: 20),
Text(
AppLocalizations.of(context)!.addCustomRule,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24
),
),
const SizedBox(height: 30),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
@ -157,7 +151,7 @@ class _AddCustomRuleState extends State<AddCustomRule> {
),
const SizedBox(height: 30),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 28),
padding: const EdgeInsets.symmetric(horizontal: 24),
child: TextFormField(
controller: domainController,
onChanged: (value) => setState(() => {}),
@ -174,28 +168,13 @@ class _AddCustomRuleState extends State<AddCustomRule> {
),
),
const SizedBox(height: 30),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomRadioToggle(
groupSelected: preset,
value: 'block',
label: AppLocalizations.of(context)!.block,
onTap: (value) => setState(() => preset = value)
),
CustomRadioToggle(
groupSelected: preset,
value: 'unblock',
label: AppLocalizations.of(context)!.unblock,
onTap: (value) => setState(() => preset = value)
),
CustomRadioToggle(
groupSelected: preset,
value: 'custom',
label: AppLocalizations.of(context)!.custom,
onTap: (value) => setState(() => preset = value)
),
],
MaterialSegmentedControl(
children: presets,
selectionIndex: preset,
onSegmentChosen: (value) => setState(() => preset = value),
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
unselectedColor: Colors.transparent,
borderColor: Theme.of(context).colorScheme.onSurface,
),
const SizedBox(height: 20),
Material(
@ -211,8 +190,9 @@ class _AddCustomRuleState extends State<AddCustomRule> {
padding: const EdgeInsets.only(left: 10),
child: Text(
AppLocalizations.of(context)!.addImportant,
style: const TextStyle(
fontSize: 16
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
),
),
),
@ -228,7 +208,7 @@ class _AddCustomRuleState extends State<AddCustomRule> {
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Card(
child: Padding(
padding: const EdgeInsets.all(20),
@ -236,12 +216,16 @@ class _AddCustomRuleState extends State<AddCustomRule> {
children: [
Row(
children: [
const Icon(Icons.info),
Icon(
Icons.info,
color: Theme.of(context).colorScheme.onSurface
),
const SizedBox(width: 20),
Text(
AppLocalizations.of(context)!.examples,
style: const TextStyle(
fontSize: 18
style: TextStyle(
fontSize: 18,
color: Theme.of(context).colorScheme.onSurface
),
)
],
@ -354,60 +338,61 @@ class _AddCustomRuleState extends State<AddCustomRule> {
padding: const EdgeInsets.only(left: 10),
child: Text(
AppLocalizations.of(context)!.moreInformation,
style: const TextStyle(
fontSize: 16
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
),
),
),
const Padding(
padding: EdgeInsets.only(right: 15),
child: Icon(Icons.open_in_new),
)
],
),
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(
left: 28,
right: 28,
top: 20,
bottom: 28
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.pop(context),
child: Text(AppLocalizations.of(context)!.cancel)
),
const SizedBox(width: 20),
TextButton(
onPressed: checkValidValues() == true
? () {
Navigator.pop(context);
widget.onConfirm(buildRule());
}
: null,
child: Text(
AppLocalizations.of(context)!.confirm,
style: TextStyle(
color: checkValidValues() == true
? Theme.of(context).primaryColor
: Colors.grey
),
)
),
],
padding: const EdgeInsets.only(right: 15),
child: Icon(
Icons.open_in_new,
color: Theme.of(context).colorScheme.onSurface
),
)
],
),
),
),
),
const SizedBox(height: 20)
],
),
);
}
}
// Padding(
// padding: const EdgeInsets.only(
// left: 28,
// right: 28,
// top: 20,
// bottom: 28
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// TextButton(
// onPressed: () => Navigator.pop(context),
// child: Text(AppLocalizations.of(context)!.cancel)
// ),
// const SizedBox(width: 20),
// TextButton(
// onPressed: checkValidValues() == true
// ? () {
// Navigator.pop(context);
// widget.onConfirm(buildRule());
// }
// : null,
// child: Text(
// AppLocalizations.of(context)!.confirm,
// style: TextStyle(
// color: checkValidValues() == true
// ? Theme.of(context).primaryColor
// : Colors.grey
// ),
// )
// ),
// ],
// ),
// )

View file

@ -71,19 +71,21 @@ class _BlockedServicesModalState extends State<BlockedServicesModal> {
child: ListView(
controller: widget.scrollController,
children: [
const Padding(
padding: EdgeInsets.only(top: 28),
Padding(
padding: const EdgeInsets.only(top: 24),
child: Icon(
Icons.block,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
const SizedBox(height: 20),
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.blockedServices,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 20),
@ -102,8 +104,9 @@ class _BlockedServicesModalState extends State<BlockedServicesModal> {
children: [
Text(
services[index]['label']!,
style: const TextStyle(
fontSize: 16
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
),
),
Checkbox(

View file

@ -120,7 +120,7 @@ class _CheckHostModalState extends State<CheckHostModal> {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
height: 350,
height: 330,
width: double.maxFinite,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
@ -138,24 +138,26 @@ class _CheckHostModalState extends State<CheckHostModal> {
? const NeverScrollableScrollPhysics()
: null,
children: [
const Padding(
padding: EdgeInsets.only(top: 24),
Padding(
padding: const EdgeInsets.only(top: 24),
child: Icon(
Icons.shield_rounded,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
const SizedBox(height: 20),
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.checkHostFiltered,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 30),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
padding: const EdgeInsets.symmetric(horizontal: 24),
child: TextFormField(
controller: domainController,
onChanged: validateDomain,
@ -202,8 +204,8 @@ class _CheckHostModalState extends State<CheckHostModal> {
children: [
Padding(
padding: const EdgeInsets.only(
bottom: 20,
right: 20
bottom: 24,
right: 24
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,

View file

@ -148,10 +148,8 @@ class _CustomRulesListState extends State<CustomRulesList> {
widget.data[index],
style: TextStyle(
color: checkIfComment(widget.data[index]) == true
? Theme.of(context).brightness == Brightness.light
? const Color.fromRGBO(100, 100, 100, 1)
: const Color.fromRGBO(200, 200, 200, 1)
: null,
? Theme.of(context).colorScheme.onSurface.withOpacity(0.6)
: Theme.of(context).colorScheme.onSurface,
fontWeight: FontWeight.normal,
),
),

View file

@ -64,20 +64,12 @@ class FiltersFab extends StatelessWidget {
}
void openAddCustomRule() {
ScaffoldMessenger.of(context).clearSnackBars();
showFlexibleBottomSheet(
minHeight: 0.7,
initHeight: 0.7,
maxHeight: 0.95,
isCollapsible: true,
duration: const Duration(milliseconds: 250),
anchors: [0.7, 0.95],
context: context,
builder: (ctx, controller, offset) => AddCustomRule(
scrollController: controller,
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => AddCustomRule(
onConfirm: confirmAddRule
),
bottomSheetColor: Colors.transparent
)
);
}

View file

@ -19,7 +19,7 @@ class FilterListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [

View file

@ -367,36 +367,19 @@ class _FiltersWidgetState extends State<FiltersWidget> with TickerProviderStateM
bottom: TabBar(
controller: tabController,
isScrollable: true,
unselectedLabelColor: Theme.of(context).colorScheme.onSurfaceVariant,
tabs: [
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.verified_user_rounded),
const SizedBox(width: 20),
Text(AppLocalizations.of(context)!.whitelists),
],
),
icon: const Icon(Icons.verified_user_rounded),
text: AppLocalizations.of(context)!.whitelists,
),
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.gpp_bad_rounded),
const SizedBox(width: 20),
Text(AppLocalizations.of(context)!.blacklist),
],
),
icon: const Icon(Icons.gpp_bad_rounded),
text: AppLocalizations.of(context)!.blacklist,
),
Tab(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.shield_rounded),
const SizedBox(width: 20),
Text(AppLocalizations.of(context)!.customRules),
],
),
icon: const Icon(Icons.shield_rounded),
text: AppLocalizations.of(context)!.customRules,
),
]
)
@ -410,9 +393,7 @@ class _FiltersWidgetState extends State<FiltersWidget> with TickerProviderStateM
color: Theme.of(context).scaffoldBackgroundColor,
border: Border(
top: BorderSide(
color: Theme.of(context).brightness == Brightness.light
? const Color.fromRGBO(220, 220, 220, 1)
: const Color.fromRGBO(50, 50, 50, 1)
color: Theme.of(context).colorScheme.surfaceVariant
)
)
),

View file

@ -14,18 +14,27 @@ class RemoveCustomRule extends StatelessWidget {
return AlertDialog(
title: Column(
children: [
const Icon(
Icon(
Icons.shield_rounded,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary
),
const SizedBox(height: 20),
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.removeCustomRule,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
)
],
),
content: Text(AppLocalizations.of(context)!.removeCustomRuleMessage),
content: Text(
AppLocalizations.of(context)!.removeCustomRuleMessage,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),

View file

@ -42,7 +42,7 @@ class _UpdateIntervalListsModalState extends State<UpdateIntervalListsModal> {
return Padding(
padding: mediaQueryData.viewInsets,
child: Container(
height: 410,
height: 390,
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
borderRadius: const BorderRadius.only(
@ -59,22 +59,27 @@ class _UpdateIntervalListsModalState extends State<UpdateIntervalListsModal> {
? const NeverScrollableScrollPhysics()
: null,
children: [
const Padding(
padding: EdgeInsets.only(top: 24),
Padding(
padding: const EdgeInsets.only(top: 24),
child: Icon(
Icons.update_rounded,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
Container(
padding: const EdgeInsets.all(24),
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 16
),
width: double.maxFinite,
child: Text(
AppLocalizations.of(context)!.updateFrequency,
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
),
),
),
@ -263,7 +268,7 @@ class _UpdateIntervalListsModalState extends State<UpdateIntervalListsModal> {
),
),
Padding(
padding: const EdgeInsets.all(20),
padding: const EdgeInsets.all(24),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [

View file

@ -50,9 +50,10 @@ class HomeChart extends StatelessWidget {
children: [
Text(
label,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface
),
),
!isEmpty
@ -110,10 +111,11 @@ class HomeChart extends StatelessWidget {
],
),
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Divider(
thickness: 1,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.2),
),
),
const SizedBox(height: 20),

View file

@ -83,10 +83,11 @@ class _HomeState extends State<Home> {
controller: scrollController,
children: [
ServerStatus(serverStatus: serversProvider.serverStatus.data!),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Divider(
thickness: 1,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.2),
),
),
const SizedBox(height: 20),
@ -128,10 +129,11 @@ class _HomeState extends State<Home> {
data: serversProvider.serverStatus.data!.stats.topQueriedDomains,
type: 'topQueriedDomains',
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Divider(
thickness: 1,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.2),
),
),
const SizedBox(height: 20),
@ -141,10 +143,11 @@ class _HomeState extends State<Home> {
data: serversProvider.serverStatus.data!.stats.topBlockedDomains,
type: 'topBlockedDomains',
),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Divider(
thickness: 1,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.2),
),
),
const SizedBox(height: 20),

View file

@ -144,7 +144,7 @@ class ManagementModal extends StatelessWidget {
child: Icon(
Icons.shield_rounded,
size: 24,
color: Theme.of(context).colorScheme.onSurface,
color: Theme.of(context).colorScheme.secondary,
),
),
Padding(

View file

@ -21,9 +21,10 @@ class ServerStatus extends StatelessWidget {
children: [
Text(
AppLocalizations.of(context)!.serverStatus,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 20),

View file

@ -48,8 +48,9 @@ class TopItems extends StatelessWidget {
Text(
item.keys.toList()[0],
overflow: TextOverflow.ellipsis,
style: const TextStyle(
fontSize: 16
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
),
),
if (name != null) ...[
@ -59,14 +60,19 @@ class TopItems extends StatelessWidget {
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).listTileTheme.iconColor
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
]
],
),
),
Text(item.values.toList()[0].toString())
Text(
item.values.toList()[0].toString(),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
)
],
),
);
@ -93,9 +99,10 @@ class TopItems extends StatelessWidget {
children: [
Text(
label,
style: const TextStyle(
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 20),

View file

@ -57,12 +57,14 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
Icon(
icon,
size: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
const SizedBox(width: 16),
Text(
label,
style: const TextStyle(
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurface
),
)
],
@ -92,21 +94,23 @@ class _FilterStatusModalState extends State<FilterStatusModal> {
),
child: Column(
children: [
const Padding(
padding: EdgeInsets.only(
Padding(
padding: const EdgeInsets.only(
top: 24,
bottom: 16,
),
child: Icon(
Icons.shield_rounded,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
Text(
AppLocalizations.of(context)!.responseStatus,
style: const TextStyle(
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w400
fontWeight: FontWeight.w400,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 16),

View file

@ -136,16 +136,19 @@ class LogDetailsScreen extends StatelessWidget {
subtitleWidget: getResult(),
trailing: log.cached == true
? Container(
padding: const EdgeInsets.all(5),
decoration: BoxDecoration(
color: Theme.of(context).listTileTheme.iconColor,
borderRadius: BorderRadius.circular(10)
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5
),
child: const Text(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(30)
),
child: Text(
"CACHE",
style: TextStyle(
fontSize: 12,
color: Colors.white,
color: Theme.of(context).colorScheme.onPrimaryContainer,
fontWeight: FontWeight.w500
),
),
@ -270,16 +273,19 @@ class LogDetailsScreen extends StatelessWidget {
title: a.value,
subtitle: "TTL: ${a.ttl.toString()}",
trailing: Container(
padding: const EdgeInsets.all(5),
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 5
),
decoration: BoxDecoration(
color: Theme.of(context).listTileTheme.iconColor,
borderRadius: BorderRadius.circular(10)
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(30)
),
child: Text(
a.type,
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: Colors.white,
color: Theme.of(context).colorScheme.onPrimaryContainer,
fontWeight: FontWeight.w500
),
),

View file

@ -19,7 +19,7 @@ class LogListTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View file

@ -72,7 +72,7 @@ class LogTile extends StatelessWidget {
)),
child: Container(
width: double.maxFinite,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View file

@ -126,19 +126,21 @@ class _LogsConfigModalWidgetState extends State<LogsConfigModalWidget> {
? const NeverScrollableScrollPhysics()
: null,
children: [
const Padding(
padding: EdgeInsets.only(top: 24),
Padding(
padding: const EdgeInsets.only(top: 24),
child: Icon(
Icons.settings,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.logsSettings,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 16),

View file

@ -171,7 +171,7 @@ class _LogsFiltersModalWidgetState extends State<LogsFiltersModalWidget> {
return Padding(
padding: MediaQuery.of(context).viewInsets,
child: Container(
height: 350,
height: 360,
decoration: BoxDecoration(
color: Theme.of(context).dialogBackgroundColor,
borderRadius: const BorderRadius.only(
@ -187,23 +187,25 @@ class _LogsFiltersModalWidgetState extends State<LogsFiltersModalWidget> {
? const NeverScrollableScrollPhysics()
: null,
children: [
const Padding(
padding: EdgeInsets.only(
Padding(
padding: const EdgeInsets.only(
top: 24,
bottom: 16,
),
child: Icon(
Icons.filter_list_rounded,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
),
Text(
AppLocalizations.of(context)!.filters,
textAlign: TextAlign.center,
style: const TextStyle(
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w400,
height: 1.3
height: 1.3,
color: Theme.of(context).colorScheme.onSurface
),
),
const SizedBox(height: 16),
@ -285,7 +287,7 @@ class _LogsFiltersModalWidgetState extends State<LogsFiltersModalWidget> {
subtitle: "${translatedString[logsProvider.selectedResultStatus]}",
onTap: openSelectFilterStatus,
icon: Icons.shield_rounded,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
),
],
),

View file

@ -196,7 +196,7 @@ class Settings extends StatelessWidget {
onPressed: () => openWeb(Urls.playStore),
icon: SvgPicture.asset(
'assets/resources/google-play.svg',
color: Theme.of(context).textTheme.bodyText2!.color,
color: Theme.of(context).colorScheme.onSurfaceVariant,
width: 30,
height: 30,
),
@ -206,7 +206,7 @@ class Settings extends StatelessWidget {
onPressed: () => openWeb(Urls.gitHub),
icon: SvgPicture.asset(
'assets/resources/github.svg',
color: Theme.of(context).textTheme.bodyText2!.color,
color: Theme.of(context).colorScheme.onSurfaceVariant,
width: 30,
height: 30,
),

View file

@ -3,10 +3,9 @@
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';
import 'package:material_segmented_control/material_segmented_control.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:adguard_home_manager/widgets/custom_radio_toggle.dart';
import 'package:adguard_home_manager/providers/app_config_provider.dart';
import 'package:adguard_home_manager/functions/encode_base64.dart';
import 'package:adguard_home_manager/services/http_requests.dart';
@ -249,6 +248,25 @@ class _AddServerModalState extends State<AddServerModal> {
final mediaQuery = MediaQuery.of(context);
Map<int, Widget> connectionTypes = {
0: Text(
'HTTP',
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w500
),
),
1: Text(
'HTTPS',
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
fontSize: 14,
fontWeight: FontWeight.w500
),
)
};
void connect() async {
Server serverObj = Server(
id: uuid.v4(),
@ -457,7 +475,7 @@ class _AddServerModalState extends State<AddServerModal> {
);
}
}
print(connectionType);
return Stack(
children: [
Scaffold(
@ -529,22 +547,23 @@ class _AddServerModalState extends State<AddServerModal> {
}
),
sectionLabel(AppLocalizations.of(context)!.connection),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CustomRadioToggle(
groupSelected: connectionType,
value: 'http',
label: 'HTTP',
onTap: (value) => setState(() => connectionType = value)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: MaterialSegmentedControl(
children: connectionTypes,
selectionIndex: connectionType == 'http' ? 0 : 1,
onSegmentChosen: (value) => setState(() {
if (value == 0) {
connectionType = 'http';
}
else if (value == 1) {
connectionType = 'https';
}
}),
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
unselectedColor: Colors.transparent,
borderColor: Theme.of(context).colorScheme.onSurface,
),
CustomRadioToggle(
groupSelected: connectionType,
value: 'https',
label: 'HTTPS',
onTap: (value) => setState(() => connectionType = value)
),
],
),
const SizedBox(height: 20),
textField(

View file

@ -52,13 +52,9 @@ class BottomNavBar extends StatelessWidget {
destinations: screens.map((screen) => NavigationDestination(
icon: Icon(
screen.icon,
color: screens.indexOf(screen) == appConfigProvider.selectedScreen
? Theme.of(context).navigationBarTheme.indicatorColor!.computeLuminance() > 0.5 ?
appConfigProvider.useDynamicColor == true
? Theme.of(context).primaryColor
: Colors.black
: Colors.white
: null,
color: screens[appConfigProvider.selectedScreen] == screen
? Theme.of(context).colorScheme.onSecondaryContainer
: Theme.of(context).colorScheme.onSurfaceVariant,
),
label: translatedName(screen.name)
)).toList(),

View file

@ -27,7 +27,7 @@ class CustomListTile extends StatelessWidget {
child: InkWell(
onTap: onTap,
child: Padding(
padding: padding ?? const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: padding ?? const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

View file

@ -23,7 +23,12 @@ class ProcessDialog extends StatelessWidget {
children: [
const CircularProgressIndicator(),
const SizedBox(width: 40),
Text(message)
Text(
message,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
),
)
],
),
),

View file

@ -49,7 +49,7 @@ class DeleteModal extends StatelessWidget {
Icon(
Icons.delete,
size: 24,
color: Theme.of(context).colorScheme.onSurfaceVariant
color: Theme.of(context).colorScheme.secondary
),
Padding(
padding: const EdgeInsets.only(top: 16),
@ -74,7 +74,7 @@ class DeleteModal extends StatelessWidget {
AppLocalizations.of(context)!.removeWarning,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
const SizedBox(height: 10),
@ -83,7 +83,7 @@ class DeleteModal extends StatelessWidget {
"${serverToDelete.connectionMethod}://${serverToDelete.domain}${serverToDelete.path ?? ""}${serverToDelete.port != null ? ':${serverToDelete.port}' : ""}",
style: TextStyle(
fontStyle: FontStyle.italic,
color: Theme.of(context).colorScheme.onSurface
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
),

View file

@ -190,9 +190,9 @@ class _ServersListState extends State<ServersList> with SingleTickerProviderStat
color: Theme.of(context).colorScheme.primaryContainer,
borderRadius: BorderRadius.circular(20)
),
child: const Icon(
child: Icon(
Icons.star,
color: Colors.white,
color: Theme.of(context).colorScheme.onPrimaryContainer,
size: 10,
),
),
@ -388,7 +388,7 @@ class _ServersListState extends State<ServersList> with SingleTickerProviderStat
child: InkWell(
onTap: () => widget.onChange(index),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: topRow(servers[index], index),
),
),
@ -398,7 +398,7 @@ class _ServersListState extends State<ServersList> with SingleTickerProviderStat
child: InkWell(
onTap: () => widget.onChange(index),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Column(
children: [
topRow(servers[index], index),

View file

@ -34,16 +34,18 @@ class _UpdateModalState extends State<UpdateModal> {
scrollable: true,
title: Column(
children: [
const Icon(
Icon(
Icons.system_update_rounded,
size: 26,
size: 24,
color: Theme.of(context).colorScheme.secondary,
),
const SizedBox(height: 20),
const SizedBox(height: 16),
Text(
AppLocalizations.of(context)!.updateAvailable,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 26
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
),
)
],
@ -51,11 +53,26 @@ class _UpdateModalState extends State<UpdateModal> {
content: Column(
children: [
const SizedBox(height: 10),
Text("${AppLocalizations.of(context)!.installedVersion}: ${appConfigProvider.getAppInfo!.version}"),
Text(
"${AppLocalizations.of(context)!.installedVersion}: ${appConfigProvider.getAppInfo!.version}",
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
const SizedBox(height: 10),
Text("${AppLocalizations.of(context)!.newVersion}: ${widget.gitHubRelease.tagName}"),
Text(
"${AppLocalizations.of(context)!.newVersion}: ${widget.gitHubRelease.tagName}",
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
const SizedBox(height: 10),
Text("${AppLocalizations.of(context)!.source}: GitHub"),
Text(
"${AppLocalizations.of(context)!.source}: GitHub",
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
),
const SizedBox(height: 20),
GestureDetector(
onTap: () => setState(() => doNotRemember = !doNotRemember),
@ -70,7 +87,14 @@ class _UpdateModalState extends State<UpdateModal> {
),
),
const SizedBox(width: 10),
Flexible(child: Text(AppLocalizations.of(context)!.doNotRememberAgainUpdate))
Flexible(
child: Text(
AppLocalizations.of(context)!.doNotRememberAgainUpdate,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurfaceVariant
),
)
)
],
),
)

View file

@ -329,6 +329,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
material_segmented_control:
dependency: "direct main"
description:
name: material_segmented_control
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
meta:
dependency: transitive
description:

View file

@ -50,6 +50,7 @@ dependencies:
bottom_sheet: ^3.1.2
percent_indicator: ^4.2.2
store_checker: ^1.1.0
material_segmented_control: ^4.0.0
dev_dependencies:
flutter_test: