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

@ -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)
),
CustomRadioToggle(
groupSelected: connectionType,
value: 'https',
label: 'HTTPS',
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,
),
),
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
),
)
)
],
),
)