mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-06-28 11:59:52 +00:00
Changed segmented buttons
This commit is contained in:
parent
a682609d8b
commit
9b4cb09dc2
4 changed files with 51 additions and 35 deletions
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:segmented_button_slide/segmented_button_slide.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/functions/open_url.dart';
|
import 'package:adguard_home_manager/functions/open_url.dart';
|
||||||
|
@ -124,25 +125,26 @@ class _AddCustomRuleState extends State<AddCustomRule> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(height: 30),
|
Container(height: 30),
|
||||||
Padding(
|
SegmentedButtonSlide(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
entries: [
|
||||||
child: SegmentedButton(
|
SegmentedButtonSlideEntry(label: AppLocalizations.of(context)!.block),
|
||||||
segments: [
|
SegmentedButtonSlideEntry(label: AppLocalizations.of(context)!.unblock),
|
||||||
ButtonSegment(
|
SegmentedButtonSlideEntry(label: AppLocalizations.of(context)!.custom),
|
||||||
value: BlockingPresets.block,
|
],
|
||||||
label: Text(AppLocalizations.of(context)!.block)
|
selectedEntry: preset.index,
|
||||||
),
|
onChange: (v) => setState(() => preset = BlockingPresets.values[v]),
|
||||||
ButtonSegment(
|
colors: SegmentedButtonSlideColors(
|
||||||
value: BlockingPresets.unblock,
|
barColor: Theme.of(context).colorScheme.primary.withOpacity(0.2),
|
||||||
label: Text(AppLocalizations.of(context)!.unblock)
|
backgroundSelectedColor: Theme.of(context).colorScheme.primary,
|
||||||
),
|
foregroundSelectedColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
ButtonSegment(
|
foregroundUnselectedColor: Theme.of(context).colorScheme.onSurface,
|
||||||
value: BlockingPresets.custom,
|
hoverColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
label: Text(AppLocalizations.of(context)!.custom)
|
),
|
||||||
),
|
textOverflow: TextOverflow.ellipsis,
|
||||||
],
|
fontSize: 14,
|
||||||
selected: <BlockingPresets>{preset},
|
height: 40,
|
||||||
onSelectionChanged: (value) => setState(() => preset = value.first),
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(height: 20),
|
Container(height: 20),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:segmented_button_slide/segmented_button_slide.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
@ -371,21 +372,25 @@ class _AddServerModalState extends State<AddServerModal> {
|
||||||
label: AppLocalizations.of(context)!.connection,
|
label: AppLocalizations.of(context)!.connection,
|
||||||
padding: const EdgeInsets.all(24),
|
padding: const EdgeInsets.all(24),
|
||||||
),
|
),
|
||||||
Padding(
|
SegmentedButtonSlide(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
entries: const [
|
||||||
child: SegmentedButton<ConnectionType>(
|
SegmentedButtonSlideEntry(label: "HTTP"),
|
||||||
segments: const [
|
SegmentedButtonSlideEntry(label: "HTTPS"),
|
||||||
ButtonSegment(
|
],
|
||||||
value: ConnectionType.http,
|
selectedEntry: connectionType.index,
|
||||||
label: Text("HTTP")
|
onChange: (v) => setState(() => connectionType = ConnectionType.values[v]),
|
||||||
),
|
colors: SegmentedButtonSlideColors(
|
||||||
ButtonSegment(
|
barColor: Theme.of(context).colorScheme.primary.withOpacity(0.2),
|
||||||
value: ConnectionType.https,
|
backgroundSelectedColor: Theme.of(context).colorScheme.primary,
|
||||||
label: Text("HTTPS")
|
foregroundSelectedColor: Theme.of(context).colorScheme.onPrimary,
|
||||||
),
|
foregroundUnselectedColor: Theme.of(context).colorScheme.onSurface,
|
||||||
],
|
hoverColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
selected: <ConnectionType>{connectionType},
|
),
|
||||||
onSelectionChanged: (value) => setState(() => connectionType = value.first),
|
textOverflow: TextOverflow.ellipsis,
|
||||||
|
fontSize: 14,
|
||||||
|
height: 40,
|
||||||
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 24,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 30),
|
const SizedBox(height: 30),
|
||||||
|
|
10
pubspec.lock
10
pubspec.lock
|
@ -518,6 +518,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.5"
|
version: "6.0.5"
|
||||||
|
segmented_button_slide:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: segmented_button_slide
|
||||||
|
sha256: "96d67344fa65f6b98a317d930bfd4e81e47c4f9e3e2ab1ee8925b55f72cded13"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.4"
|
||||||
sentry:
|
sentry:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -789,5 +797,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.2"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.1.0 <4.0.0"
|
dart: ">=3.1.3 <4.0.0"
|
||||||
flutter: ">=3.13.0"
|
flutter: ">=3.13.0"
|
||||||
|
|
|
@ -75,6 +75,7 @@ dependencies:
|
||||||
flutter_reorderable_list: ^1.3.1
|
flutter_reorderable_list: ^1.3.1
|
||||||
pie_chart: ^5.3.2
|
pie_chart: ^5.3.2
|
||||||
flutter_hooks: ^0.20.3
|
flutter_hooks: ^0.20.3
|
||||||
|
segmented_button_slide: ^1.0.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue