mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-05 04:40:37 +00:00
Support AGH without DHCP server
This commit is contained in:
parent
2511ac2c24
commit
83ea589187
9 changed files with 291 additions and 274 deletions
76
lib/screens/settings/dhcp/dhcp_main_button.dart
Normal file
76
lib/screens/settings/dhcp/dhcp_main_button.dart
Normal file
|
@ -0,0 +1,76 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
||||
import 'package:adguard_home_manager/models/dhcp.dart';
|
||||
|
||||
class DhcpMainButton extends StatelessWidget {
|
||||
final NetworkInterface? selectedInterface;
|
||||
final bool enabled;
|
||||
final void Function(bool) setEnabled;
|
||||
|
||||
const DhcpMainButton({
|
||||
super.key,
|
||||
required this.selectedInterface,
|
||||
required this.enabled,
|
||||
required this.setEnabled,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 10,
|
||||
left: 16,
|
||||
right: 16
|
||||
),
|
||||
child: Material(
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: InkWell(
|
||||
onTap: selectedInterface != null
|
||||
? () => setEnabled(!enabled)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 12
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)!.enableDhcpServer,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.onSurface
|
||||
),
|
||||
),
|
||||
if (selectedInterface != null) ...[
|
||||
Text(
|
||||
selectedInterface!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).listTileTheme.textColor
|
||||
),
|
||||
)
|
||||
]
|
||||
],
|
||||
),
|
||||
Switch(
|
||||
value: enabled,
|
||||
onChanged: selectedInterface != null
|
||||
? (value) => setEnabled(value)
|
||||
: null,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue